-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
InteractionManager.runAfterInteractions not running at all! #94
Comments
Forgot to mention; When I replaced my SharedElement Stack Navigator with a I've uploaded my source code for the SharedElement Stack Navigator here. |
@IjzerenHein Maybe some animations ( |
@mrousavy I have the same issue sometimes with InteractionManager, just started trying to narrow it down. Did you find a solution to this? |
@Svarto after a while of debugging I switched to react-native-navigation which solved the problem for me. |
@mrousavy I've had the same issue with |
Hey if anyone can add a repro case to the |
Bumped into something similar. During In our application, we had a In the calling component, you can latch the handle as follows: const handle = React.useRef<number | null>(null);
// onPanResponderGrant
handle.current = panResponder.getInteractionHandle() as number | null;
// onPanResponderTerminate
handle.current !== null && InteractionManager.clearInteractionHandle(handle.current); |
First off
First off, I had a really hard time debugging this, and I've already opened issues at react-native, react-navigation and react-native-screens. I've eliminated all possible causes for this, and finally came to the conclusion that the library causing this issue is react-navigation-shared-element.
Description
I am using a lot of
InteractionManager.runAfterInteractions(() => ...)
calls throughout my project.For example, I have a feed of multiple posts in my HomeScreen (Tab Navigator) and each post has
useEffect
anduseFocusEffect
hooks which callInteractionManager.runAfterInteractions
inside the hook to schedule loading extra post data after some animations have completed. "Some animations" = mostly navigation transitions from react-navigation-shared-element, but since the post items specifically are inside a Tab Navigator, no navigation transitions/animations are run so this should fire almost immediately.In development/debug build everything works fine, but once I build for production/release, the extra post data never gets loaded, a test
Alert.alert(...)
I've put in there never gets shown, and my animations will never start, causing my app to be fully stuck.I have added a
GlobalErrorHandler
callback to my entry point (App.tsx
) since I thought "hey, maybe some JS error is thrown and execution is stopped?":but this doesn't get called either.
Unfortunately, since this only happens on production/release builds, I'm having a hard time debugging this. I will happily provide any extra information needed.
Extra Details
My root view is a
NavigationContainer
, and inside of it, I conditionally render theLoginStackNavigator
or theHomeStackNavigator
depending if the user is logged in or not. I'll go over my navigation hierachy in a bitCurrent Behavior
Right now, the InteractionManager does not call the callback function at all, causing my app to be "broken". Data is never getting loaded, delayed animations are not getting started, etc.
Expected Behavior
The InteractionManager should call the callback after animations have finished. (Which, on a Tab navigator, should be instantly.)
Screenshots
InteractionManager.runAfterInteraction
callbacks inside myuseEffect
hooks are being called.InteractionManager.runAfterInteraction
callbacks inside myuseEffect
hooks are not being called, the text for the post is not being loaded (which is inside anInteractionManager.runAfterInteraction
callback), and weirdly the react-native-vector-icons are not being displayed. no idea why that's the case, since that has nothing to do with anInteractionManager.runAfterInteraction
callback.How to reproduce
react-navigation
for navigation, create NavigationContainer, in my case a Stack Navigator containing a Tab Navigator (Home) and a "Post Details Screen".InteractionManager.runAfterInteractions(() => ...)
callbacks in your components (e.g.useEffect()
hook)Navigation Structure
Dumbed down, I have the following Navigation Structure:
NavigationContainer
Stack.Navigator
fromcreateNativeStackNavigator
Stack.Navigator
fromcreateSharedElementStackNavigator
createBottomTabNavigator
<SharedElement>
inside<SharedElement>
insideMy Environment
Conclusion
I would really appreciate some help with this. I am having an incredibly hard time finding the cause for this and cannot release my app for production.
I have tried rewriting my app to use wix/react-native-navigation, and noticed that all InteractionManagers work correctly there.
The text was updated successfully, but these errors were encountered: