facebookexperimental / Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
https://recoiljs.org/
MIT License
19.5k stars 1.18k forks source link

Recoil and React Navigation Problem for React Native #2276

Closed burakgokcinarr closed 9 months ago

burakgokcinarr commented 10 months ago

Hi,

React Native does not work properly when Recoil and React Navigation are used together ( RecoilRoot and NavigationController )

The content of my app's package.json;

Ekran Resmi 2023-08-22 09 55 51

This is my starting code.

Ekran Resmi 2023-08-22 09 57 34

But in this case, I see blank on the screen. ( Components are available ) But when I define my home page directly without using NavigationController it works fine.

Simulator Screenshot - iPhone 14 Pro - 2023-08-22 at 09 59 45

Ekran Resmi 2023-08-22 10 00 20

Simulator Screenshot - iPhone 14 Pro - 2023-08-22 at 10 00 48

Have you encountered this? Am I doing it wrong :(

bilalfawadkhan commented 10 months ago

I am confused to see that in one example which it is working your putting component Directly but in the first one your router is one tag isn't it supposed to be be a whole enclosing tag with route pointing to the page ?

burakgokcinarr commented 10 months ago

The label on the first is actually where all my routes are. (GalleryPage.js, ProfilePage.js, EditPage.js etc...) If I point directly to my page in the 2nd case, it works fine, but if I do it like the first one, it doesn't.

dskoneczny commented 7 months ago

@burakgokcinarr Did you find a solution? I have the same issue

theDevSoham commented 5 months ago

@burakgokcinarr I'm facing the same issue. What I did is changed some code inside the recoil root and the screen rendered perfectly even inside navigation container. So my hard guess is that the Suspense call is running indefinitely on the first render and suspense action stops the moment app is re rendered and dom tree refreshes. Will have to test more before confirming though.