You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Android] No API for updating props on android root component #6303
In iOS, you can do rctRootView.appProperties = newProps, and it will update the root view with new props. On android it doesn't seem to be implemented.
This behavior is critical for my use case of incrementally adopting react native in a large android app.
I think I want a function like ReactRootView.updateProps(Bundle props) that would look something like
Before I made a PR I wanted to check my direction -- does it look reasonable? I think I'll have to store the rootTag on the ReactRootView instance, b/c I can't find anywhere else that it's already stored.
changed the title [-]No API for updating props on android root component[/-][+][Android] No API for updating props on android root component[/+]on Mar 4, 2016
ok so my initial attempt was unsuccessful (pretty much doing what I outlined above), and we've decided not to invest in RN yet, so it's unlikely I'll dig into this further in the near future
No worries, we'll do it eventually.
Would you mind giving feedback why you have decided to not proceed with RN right now?
Any particular pain or aspect you think we should address?
mostly immaturity of android, and to a lesser extent iOS. We have large apps that we're thinking of integrating react native into incrementally, which definitely isn't a well-documented use case. we're planning on doing further investigation in a few months and might have a different decision depending on how things have matured.
@bestander What is the status of this feature request? My use case requires inserting a RN view in a native ListView. Removing and creating new react views doesn't allow for smooth scrolling and emitting events with prop updates sends the same props to all children.
Is the feature currently being worked on? If not, what might it involve to implement?
It sounds like this issue has played out, and we are keeping issues focused on bugs rather than feature requests at the moment, so I am going to close this issue. Feel free to send a pull request improving this though!
Hi guys. Thank you for the amazing work you are doing with react.
Anyway i agree with @tianxind, someone should mention that Android is not ready to update props of a running component. I've lost half of my brain looking for a solution then a came here XD
There is a method in ReactRootView called setAppProperties that does what is intended, I believe.
The problem is, like in iOS, the root component gets recreated instead of just updated (componentWillUnmount will be called and then the component will be recreated). Is this the intended behavior? Is there any way to just re-render the root component?
Activity
[-]No API for updating props on android root component[/-][+][Android] No API for updating props on android root component[/+]brentvatne commentedon Mar 6, 2016
@bestander - could you check this out to see if it's reasonable? This is part of getting parity with iOS, cc @mkonicek
bestander commentedon Mar 6, 2016
Will do on Tuesday
On Sunday, 6 March 2016, Brent Vatne notifications@github.com wrote:
brentvatne commentedon Mar 6, 2016
🚀
bestander commentedon Mar 8, 2016
@jaredly go for it, we would appreciate this feature.
Ping me with the PR.
jaredly commentedon Mar 9, 2016
ok so my initial attempt was unsuccessful (pretty much doing what I outlined above), and we've decided not to invest in RN yet, so it's unlikely I'll dig into this further in the near future
bestander commentedon Mar 10, 2016
No worries, we'll do it eventually.
Would you mind giving feedback why you have decided to not proceed with RN right now?
Any particular pain or aspect you think we should address?
jaredly commentedon Mar 10, 2016
mostly immaturity of android, and to a lesser extent iOS. We have large apps that we're thinking of integrating react native into incrementally, which definitely isn't a well-documented use case. we're planning on doing further investigation in a few months and might have a different decision depending on how things have matured.
bestander commentedon Mar 10, 2016
👍
Thanks, this gives some very important feedback.
MikeOrtiz commentedon Jun 7, 2016
@bestander What is the status of this feature request? My use case requires inserting a RN view in a native ListView. Removing and creating new react views doesn't allow for smooth scrolling and emitting events with prop updates sends the same props to all children.
Is the feature currently being worked on? If not, what might it involve to implement?
satya164 commentedon Jun 7, 2016
@MikeOrtiz nobody is working on it right now. feel free to send a pull request.
skeyboy commentedon Aug 25, 2016
I want to get a data from Java to JS
bundle.putString("value", "aValue");
mReactRootView.startReactApplication(mReactInstanceManager, "IndexActivity", bundle);
but, I can not get the value from this.props.value
lacker commentedon Nov 30, 2016
It sounds like this issue has played out, and we are keeping issues focused on bugs rather than feature requests at the moment, so I am going to close this issue. Feel free to send a pull request improving this though!
jaredly commentedon Feb 23, 2017
@brentvatne bump :P this is totally basic for having sane integration with an existing app
tianxind commentedon Mar 9, 2017
Bump this feature request. @brentvatne Or at least I think the lack of this feature on Android should be mentioned here: https://facebook.github.io/react-native/docs/communication-ios.html It will save people from mistakenly assuming that it exists for Android.
SunburtReynolds commentedon Mar 20, 2017
+1
tommasoresti commentedon Jun 7, 2017
Hi guys. Thank you for the amazing work you are doing with react.
Anyway i agree with @tianxind, someone should mention that Android is not ready to update props of a running component. I've lost half of my brain looking for a solution then a came here XD
boliveira commentedon Jul 12, 2018
Hi,
There is a method in ReactRootView called setAppProperties that does what is intended, I believe.
The problem is, like in iOS, the root component gets recreated instead of just updated (componentWillUnmount will be called and then the component will be recreated). Is this the intended behavior? Is there any way to just re-render the root component?