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

RNScreens Attempt to register InsestsObserverProxy on DecorView a while it has been already registered on DecorView b EXPO SDK 52 #2519

Closed
Odyrac opened this issue Nov 19, 2024 · 27 comments · Fixed by #2526
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android

Comments

@Odyrac
Copy link

Odyrac commented Nov 19, 2024

Description

After migrating to Expo SDK52 my project is starting with an error. The first time it's working and on the first reload the error RNScreens Attempt to register InsestsObserverProxy on DecorView a while it has been already registered on DecorView b is shown on Expo Go (not in the console).

Steps to reproduce

Use React Native Screens with Expo SDK 52.

Snack or a link to a repository

/

Screens version

4.2.0 and 4.1.0

React Native version

0.76.2

Platforms

Android

JavaScript runtime

Hermes

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Missing info The user didn't precise the problem enough labels Nov 19, 2024
Copy link

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Nov 19, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@outaTiME
Copy link

Hi there,
I'm having the same issue on Android with Expo 51 and react-native ~0.75.4 using react-native-screens ^4.2.0.
It happens when I switch back and forth to the app.

@Odyrac
Copy link
Author

Odyrac commented Nov 19, 2024

Hi, when i delete all the data of my Expo Go it's working once, then error comes back. So many issues since upgrading to sdk 52 lmao

@outaTiME
Copy link

Hi, when i delete all the data of my Expo Go it's working once, then error comes back. So many issues since upgrading to sdk 52 lmao

Hi @Odyrac,
(As I mentioned earlier) I don't think this is specific to Expo 52. I'm experiencing the same issue with the previous version of Expo.

@Odyrac
Copy link
Author

Odyrac commented Nov 19, 2024

Hi, when i delete all the data of my Expo Go it's working once, then error comes back. So many issues since upgrading to sdk 52 lmao

Hi @Odyrac, (As I mentioned earlier) I don't think this is specific to Expo 52. I'm experiencing the same issue with the previous version of Expo.

What was the trigger for you? I didn't have this error before upgrading

@outaTiME
Copy link

Hi, when i delete all the data of my Expo Go it's working once, then error comes back. So many issues since upgrading to sdk 52 lmao

Hi @Odyrac, (As I mentioned earlier) I don't think this is specific to Expo 52. I'm experiencing the same issue with the previous version of Expo.

What was the trigger for you? I didn't have this error before upgrading

In your case, this error is probably happening because you updated to react-native-screens version 4.x when switching to Expo 52. This issue didn’t occur with version 3.35.0.

@Odyrac
Copy link
Author

Odyrac commented Nov 19, 2024

Yes but I tried to use version 3.35.0 and I had other errors due to incompatibilty with Expo probably, so I still don't have solution with sdk52

@outaTiME
Copy link

Just in case,
here’s a video of the issue (using Expo 51 with react-native ~0.75.4 and react-native-screens ^4.2.0):

CleanShot.2024-11-19.at.15.57.20.mp4

@doughsay
Copy link

Duplicate of this? #2507

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

I want to confirm that I've managed to reproduce the issue.

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

Could someone confirm whether applying this patch resolves the issue for you?

https://github.com/software-mansion/react-native-screens/pull/2526.patch

You can either apply this patch or try to install react-native-screens directly from branch:

"react-native-screens": "software-mansion/react-native-screens#@kkafar/fix-crash-with-proxy-already-registered"

@outaTiME
Copy link

Could someone confirm whether applying this patch resolves the issue for you?

https://github.com/software-mansion/react-native-screens/pull/2526.patch

You can either apply this patch or try to install react-native-screens directly from branch:

"react-native-screens": "software-mansion/react-native-screens#@kkafar/fix-crash-with-proxy-already-registered"

Now, after installing the dependency pointing to the branch and creating a new build, I’m running into a different error:

CleanShot 2024-11-20 at 10 35 10@2x

For reference, im using Expo 51 with react-native ~0.75.4.

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

@outaTiME Idk your setup, but Expo 51 used react-navigation v6, which is incompatible with react-native-screens@4. Second thing is that the error messsage you got suggests that you need to rebundle the app. I guess fresh install would be the best to ensure there are no invalidated caches there: rm -fr node_modules android/build android/app/build && yarn install && yarn start --reset-cache.

Note that AFAIK if you're running your app with Expo Go you can not just hotswap library version, as the native code won't be rebuilt. AFAIK you need the development build.

@outaTiME
Copy link

@outaTiME Idk your setup, but Expo 51 used react-navigation v6, which is incompatible with react-native-screens@4. Second thing is that the error messsage you got suggests that you need to rebundle the app. I guess fresh install would be the best to ensure there are no invalidated caches there: rm -fr node_modules android/build android/app/build && yarn install && yarn start --reset-cache.

Note that AFAIK if you're running your app with Expo Go you can not just hotswap library version, as the native code won't be rebuilt. AFAIK you need the development build.

Got it, I didn’t know that react-native-screens@4 wasn’t compatible with Expo 51 and React Navigation 6.

On another note, I updated the react-native-screens dependency to point to your branch and created a fresh development build using expo run:android --variant debug --device. Before that, I deleted the Android folder to avoid conflicts, but I didn’t clear the node_modules or Yarn cache.

@outaTiME
Copy link

@outaTiME Idk your setup, but Expo 51 used react-navigation v6, which is incompatible with react-native-screens@4. Second thing is that the error messsage you got suggests that you need to rebundle the app. I guess fresh install would be the best to ensure there are no invalidated caches there: rm -fr node_modules android/build android/app/build && yarn install && yarn start --reset-cache.
Note that AFAIK if you're running your app with Expo Go you can not just hotswap library version, as the native code won't be rebuilt. AFAIK you need the development build.

Got it, I didn’t know that react-native-screens@4 wasn’t compatible with Expo 51 and React Navigation 6.

On another note, I updated the react-native-screens dependency to point to your branch and created a fresh development build using expo run:android --variant debug --device. Before that, I deleted the Android folder to avoid conflicts, but I didn’t clear the node_modules or Yarn cache.

Maybe my issue is related to how Yarn 4.x downloads dependencies from a branch. When I check the downloaded code, the android folder seems incomplete:

CleanShot 2024-11-20 at 11 01 22@2x

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

Yeah, this definitely looks like some kind of problem with our package. We've had this behaviour reported before (when installing the library from branch source files aren't downloaded), but I've no idea why this happens. It is especially baffling that when I'm installing from branch it works...

If you have capacity maybe try to apply the patch I've linked in one of the posts above ☝🏻 git apply...

@Odyrac
Copy link
Author

Odyrac commented Nov 20, 2024

Could someone confirm whether applying this patch resolves the issue for you?

https://github.com/software-mansion/react-native-screens/pull/2526.patch

You can either apply this patch or try to install react-native-screens directly from branch:

"react-native-screens": "software-mansion/react-native-screens#@kkafar/fix-crash-with-proxy-already-registered"

Is this patch compatible with Expo environment ?
git apply 2526.patch
error: android/src/main/java/com/swmansion/rnscreens/InsetsObserverProxy.kt: No such file or directory
error: android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt: No such file or directory

I don't have android folder in my project

@Odyrac
Copy link
Author

Odyrac commented Nov 20, 2024

Okay so I apply the patch directly in the module react-native-screens (this actually seems more logical) but still get same error message with the second reload. I started with --clear my expo go to be sure of no conflict

@Odyrac
Copy link
Author

Odyrac commented Nov 21, 2024

I don't understand why the issue was closed because it's still a problem.

I tried to update RNScreens, I'm now in "react-native-screens": "^4.2.0", but still the same error when app is starting :(

@Odyrac
Copy link
Author

Odyrac commented Nov 21, 2024

update, this has definitly a link with statusBarTranslucent: true, in a Stack.Screen, when I remove it, error disappered, any idea of a fix ?

@Odyrac
Copy link
Author

Odyrac commented Nov 21, 2024

@kkafar did your merge fix the issue with statusBarTranslucent ?

@kkafar
Copy link
Member

kkafar commented Nov 21, 2024

The issue is closed because the PR with fix has been merged. The release will be in few hours, I had a minor hickup when testing

@kkafar
Copy link
Member

kkafar commented Nov 21, 2024

I've released the 4.3.0 which hopes to resolve the issue. Let me know in case the issue persists.

@Odyrac
Copy link
Author

Odyrac commented Nov 21, 2024

@kkafar I tried but still same error. Did you investigate into statusBarTranslucent ? If I remove it, error disappear

@kkafar
Copy link
Member

kkafar commented Nov 21, 2024

@Odyrac there can not be the same error, because I've removed the code that thrown the error completely ;D

Make sure you have appropriate version installed in your node_modules. In case you're using Expo Go you can't just upgrade the library, because it's native code won't be updated. You need to setup development build.

@OlivierSte
Copy link

@kkafar I tried but still same error. Did you investigate into statusBarTranslucent ? If I remove it, error disappear

@Odyrac Did you manage to fix it? I'm experiencing the exact same issue. If I remove the statusBarTranslucent it disappears.
I have the 4.40 version of react-native-screens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android
Projects
None yet
5 participants