IjzerenHein / react-navigation-shared-element

React Navigation bindings for react-native-shared-element 💫
https://github.com/IjzerenHein/react-native-shared-element
MIT License
1.27k stars 124 forks source link

Transition back not triggered #102

Open jcajasmc opened 3 years ago

jcajasmc commented 3 years ago

I searched on the issues but didnt find something realted to my issue.

I have this structre with React Navigation 5

Screen 1: Does not have any shared element registered Screen 2: Shared element registered to animate Screen 1 <-> Screen 2 Screen 3: Shared element registered to animate Screen 2 <-> Screen 3

Screen 1 <-> Screen 2 Works like a charm for push and back. Screen 2 -> Screen 3 works only the push transition, but transition back is not triggered

If I remove the shared elements registration on Screen 2 (losing the animation between Screen1 <-> Screen 2) the animation of Screen 2 <-> Screen 3 works.

jcajasmc commented 3 years ago

Found a workaround using a blacklist of "coming from" screens:

GroupDetails.sharedElements = (route, otherRoute) => {
  const {group} = route.params
  const blackList = ['EventDetails', 'GroupMembers', 'GroupMessages']

  return blackList.includes(otherRoute.name)  ? [] : [
    {id: `group-${group.id}`, animation: 'fade'},
  ]
}
misaeldossantos commented 3 years ago

for me it worked with gestureEnabled: false in screenOptions of (v5)