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

encounter blink effect when navigate screens #222

Open
chj-damon opened this issue Jan 12, 2022 · 9 comments
Open

encounter blink effect when navigate screens #222

chj-damon opened this issue Jan 12, 2022 · 9 comments

Comments

@chj-damon
Copy link

Thanks for this amazing library to help improve user experience especially after upgrade to the latest version.
But I also encountered some trouble when using it on android.

issue 1:
when I navigate from ListScreen to DetailScreen, if the image is half on screen, then it will blink.
issue 2:
when I navigate back from DetailScreen to ListScreen, it will blink and I can clearly see there's a blank area goes from left to right.

here is the reproduce repository: sharedElementExample

thank you very much.

@chj-damon
Copy link
Author

1641973128598809.mp4

@chj-damon
Copy link
Author

Navigator:

<Navigator initialRouteName="List" screenOptions={commonStackOptions}>
      <Screen name="List" component={ListScreen} options={{ headerShown: false }} />
      <Screen
        name="Detail"
        component={DetailScreen}
        options={{ headerShown: false }}
        sharedElements={route => {
          const { item } = route.params;
          return [`item.${item.id}.photo`];
        }}
      />
    </Navigator>

ListScreen:

export default function ListScreen() {
  const navigation = useNavigation<StackNavigationProp<any>>();

  const renderItem = ({ item }: any) => {
    return (
      <TouchableOpacity activeOpacity={1} onPress={() => navigation.push('Detail', { item })}>
        <SharedElement id={`item.${item.id}.photo`}>
          <Image source={item.image} style={styles.image} />
        </SharedElement>
      </TouchableOpacity>
    );
  };

  return <FlatList style={styles.container} data={items} renderItem={renderItem} keyExtractor={item => item.id} />;
}

DetailScreen:

export default function DetailScreen() {
  const navigation = useNavigation();
  const route = useRoute();
  const { item } = route.params as any;
  return (
    <TouchableOpacity activeOpacity={1} onPress={navigation.goBack}>
      <SharedElement id={`item.${item.id}.photo`}>
        <Image source={item.image} style={styles.image} />
      </SharedElement>
    </TouchableOpacity>
  );
}

@chj-damon
Copy link
Author

Simulator.Screen.Recording.-.iPhone.13.-.2022-01-12.at.16.46.25.mp4

@chj-damon
Copy link
Author

chj-damon commented Jan 12, 2022

issue 1 does not exist on ios
issue 2 still exists on ios

@tharyckgusmao
Copy link

Same problem

@pietroanello
Copy link

pietroanello commented Mar 25, 2022

I think that the problem is relative to the position of the element in the prev and next screen, but I don't know why.

I've a working example where if the element in the next screen is positioned lower than the element in the previous screen, then the blink doesn't happen.

Even for me the problem is only on Android.

@dirmich
Copy link

dirmich commented May 26, 2022

try
cardStyle: {backgroundColor: 'transparent'},
cardStyleInterpolator: ({current: {progress}}) => ({
gestureEnabled: false,
cardStyle: {opacity: progress},
}),

on Stack.Navigator.screenOptions or Stack.Screen.options

@chj-damon
Copy link
Author

try cardStyle: {backgroundColor: 'transparent'}, cardStyleInterpolator: ({current: {progress}}) => ({ gestureEnabled: false, cardStyle: {opacity: progress}, }),

on Stack.Navigator.screenOptions or Stack.Screen.options

tried, not working. it still blinks...

@CCPablo
Copy link

CCPablo commented Oct 14, 2022

This is also happening to me, it's kind of frustrating, as it loses all the smoothness.

It would be really nice if someone come up with a solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants