Skip to content
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

Please update Direct Manipulation docs with setNativeProps's deprecation status #3106

Closed
AlanSl opened this issue May 5, 2022 · 4 comments
Closed
Labels
Stale Issues/PR that are not getting much activity and are closer to be closed

Comments

@AlanSl
Copy link

AlanSl commented May 5, 2022

Description

It's currently unclear if setNativeProps is deprecated or not:

  1. From the documentation, there's no signs of any deprecation - https://reactnative.dev/docs/direct-manipulation
  2. I see that the react-native-renderer had set to show deprecation warnings when element.setNativeProps was used; these were then removed in Stop warning about setNativeProps being deprecated react#17045 but it appears the intention is still to deprecate, just not show warnings in existing apps?
  3. There are various references to setNativeProps not being supported at all in Fabric.
    Presumably this includes the setNativeProps(ref) usage as well as the element.setNativeProps usage? For example see:

What is the problem?

It should be clear from the latest version of the docs what the status is. Are either or both of the element.setNativeProps and/or setNativeProps(ref) usage patterns deprecated?

How can we address it?

Please update the docs to say what the current status (e.g. I think it's not supported in Fabric, and is planned to be deprecated?)

Why is it important?

If a decision has been made to deprecate or drop a feature, that should be apparent from the docs; if it's not then the docs aren't succeeding in being the main source of truth on such things.

Currently it appears a decision has been made, but it's not clear what that decision is because it's fragmented across various issues, discussions, PR comments etc.

Who needs this?

Any developer using or considering using setNativeProps.

When should this happen (use version numbers if needed)?

Depends on what the status is (I can't see for sure because the discussion is fragmented).

@cortinico
Copy link
Contributor

We have a paragraph about it in the New Architecture documentation here:
https://reactnative.dev/docs/new-architecture-library-intro#migrating-off-setnativeprops

You won't be able to use setNativeProps in the New Architecture. Therefore, if you wish to migrate to the New Architecture you should refrain from using it.

As the New Architecture is still experiemental, this API is not deprecated yet.

@AlanSl
Copy link
Author

AlanSl commented May 9, 2022

Great, thanks for the clarification.

And to be clear - this applies equally to the element.setNativeProps({ ...props }) usage as it does to the setNativeProps(ref, { ...props }) usage - it's no longer true that one is favoured over the other?

My understanding now is that there was a plan to deprecate element.setNativeProps({ ...props }) in favour of setNativeProps(ref, { ...props }), on the assumption that the former would not be supported in Fabric and the latter would; but then thinking shifted towards supporting neither in Fabric, so the idea of specifically deprecating element.setNativeProps({ ...props }) was dropped?

So in the short term, the two usages are equally well supported, and in the long term, it's likely they will both be dropped from the new architecture at the same time (but not confirmed yet because the new architecture is still experimental)?

@github-actions
Copy link

github-actions bot commented Aug 8, 2022

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues/PR that are not getting much activity and are closer to be closed label Aug 8, 2022
@github-actions
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Issues/PR that are not getting much activity and are closer to be closed
Projects
None yet
Development

No branches or pull requests

2 participants