fram-x / FluidTransitions

Fluid Transitions for React Navigation
MIT License
2.93k stars 194 forks source link

Transitions don't occur if navigating immediately after load #200

Open njdancer opened 5 years ago

njdancer commented 5 years ago

Hello there, Love the API. Decided to try and use it to transition from our splash screen to login. Essentially I have a fluid navigator which has a default screen that visually replicates our static splash screen with our app logo configured as a shared element. We then have this same element on the login screen. The splash screen is able to check the current auth status and navigate to the appropriate screen. In theory this should transition the logo to its position on the next screen and if we artificially create a short delay after loading this works perfectly. If we do this immediately however the transition never occurs. I tried moving this into useLayoutEffect as I assumed it wasn't working as the SplashScreen was never being laid out and therefore the transition doesn't know its start position but this didn't change anything.


useEffect(() => {
  setTimeout(() => {
    SplashScreenAPI.hide()
    navigation.navigate(userStore.username ? "Main" : "Landing")
  }, 100)
})```

This is currently working fine as a workaround so I'm not inclined to spend a lot of time digging through the source to find the cause, however, may take a look if you had any ideas on where to start.