-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the the replacement of setNativeProps in Fabric? #34391
Comments
thanks, @ecreeth but nop, the documentation said that now we are forced to move all to state, but that has a big performance impact, the idea of setNativeProp was to avoid re-render all the components and gain performance (very useful in some cases, but now without that option, we return to the previews issue, forced to re-render all the component in all cases). |
I think the performance issue could in theory be resolved as there is no high bridge traffic cost? Still agree this is not a super ideal migration strategy. Changing an entire application's inputs from uncontrolled to controlled is a bit rough, but unsure what the alternative would be or if it would be possible to layer the |
In theory, should not, but the reality is different... I was testing with Fabric enabled to see if I can migrate a library that was using setNativeProp, but I found big performance issues after moving all to state, and in theory that is expected because each time you change a value, react has to validate and figure-out what to update. The original idea of setNativeProp was to avoid all that pre-processing validations. So if setNativeProp will not be supported I will like to know what will be the new way to update directly a value without re-validations, probable will be good to expose an internal method to do that in JSI. |
I'm also trying to create a layout animation library like framer motion that uses the FLIP technique, which basically on useLayoutEffect we should be able to use setNativeProps to reverse the current style of an Element. |
According to this merge setNativeProps should be supported, Do any person knows how to use it in fabric? |
We have added setNativeProps support to Fabric. It is available in 0.72. Closing this. Please open a new issue if you find any problems with setNativeProps in Fabric. |
Description
Hi ReactNative team, I know that in the new architecture you don't plan to give support to ref.setNativeProps.
So according to that premise, could you please give me an example of how is the new way to update the props of an element (View, TextInput) without forcing an update of the entire component?
I am looking around but don't find documentation yet and moving all to state generates performance issues...
forcing
Version
0.68.0
Output of
npx react-native info
setNativeProps is not implemented in fabric
Steps to reproduce
setNativeProps is not implemented in fabric
Snack, code example, screenshot, or link to a repository
No extra data
The text was updated successfully, but these errors were encountered: