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
Failing test and future fix of issue #10912 #10932
base: dev
Are you sure you want to change the base?
Conversation
See remix-run#10912 For now I created a failing test for the new version of React Native's linking api. This test ensures that the listeners are cleaned up properly using the remove method of the new subscription based Linking.addEventListener function. The old api is outlined as deprecated here: https://github.com/facebook/react-native/blob/main/CHANGELOG-pre-070.md#deprecated-2 I am also planning on submitting the bug-fix soon. With the fix I assume the new API of React-Native is all that would work for future versions of `react-router-native` if that's not what `react-router` maintainers want this then you may want to take a different approach than the code below and the bug-fix I will create soon, but if it is what react-router wants then we will just need to update two lines in react-router-native/index.tsx In this function: ```tsx export function useDeepLinking() { // ... code elided for brevity ... // Listen for URL changes React.useEffect(() => { // ... code elided ... Linking.addEventListener(URLEventType, handleURLChange); return () => { Linking.removeEventListener(URLEventType, handleURLChange); }; }, [navigate]); } ``` From this: ```tsx Linking.addEventListener(URLEventType, handleURLChange); return () => { Linking.removeEventListener(URLEventType, handleURLChange); }; ``` To this: ```tsx const subscription = Linking.addEventListener(URLEventType, handleURLChange); return () => { subscription.remove(); }; ``` This change will pass the tests.
|
Hi @johnsonjo4531, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Unsure how I should do the changeset and semver for this change. I could use a little direction. Thanks. |
See #10912
For now I created a failing test for the new
version of React Native's linking api.
This test ensures that the listeners are cleaned
up properly using the remove method of the new subscription
based Linking.addEventListener function.
The old api is outlined as deprecated here:
https://github.com/facebook/react-native/blob/main/CHANGELOG-pre-070.md#deprecated-2 I am also planning on submitting the
bug-fix soon.
With the fix I assume the new API of
React-Native is all that would work for
future versions of
react-router-native
ifthat's not what
react-router
maintainers want this then you may want
to take a different approach than the code
below and the bug-fix I will create soon,
but if it is what react-router wants
then we will just need to update two
lines in react-router-native/index.tsx
In this function:
From this:
To this:
This change will pass the tests.