Skip to content

Shared element with placement shifting with 'modal' #264

@ejkkan

Description

@ejkkan

Hey, I'm using shared elements between multiple different screens. But If I try to use shared elements pushing in to a modal type screen('presentation: 'modal'), the transition between screens the animation is a bit off and then skips into the correct position.
Please see video.

shared.transition.bug.mov
//Stack

<Stack.Navigator
      screenOptions={{
        headerShown: false,
        gestureEnabled: true,
      }}
    >

      <Stack.Screen
        name="Charity"
        sharedElements={(route, otherRoute, showing) => {
          return [
            {
              id: `sharedbutton`,
              animation: 'fade',
            },
          ];
        }}
        component={Charity}
      />
      <Stack.Screen
        sharedElements={() => {
          return [
            {
              id: `sharedbutton`,
              animation: 'fade',
              resize: 'auto',
            },
          ];
        }}
        options={{
          headerShown: false,
          animationEnabled: true,
          presentation:'modal'
        }}
        name="Checkout"
        component={Checkout}
      />
    </Stack.Navigator>
//Component 1

export const Checkout = ({}: Props) => {
  return (
    <SafeAreaView className="flex-1 p-4 bg-[#313642]">
    ... more code
      <View className="absolute right-8 bottom-8">
        <SharedElement id="sharedbutton">
          <GuideButton type="pay" onPress={submit} />
        </SharedElement>
      </View>
    </SafeAreaView>
  );
};
//Component 2

export const Checkout = ({}: Props) => {
  return (
    <SafeAreaView className="flex-1 p-4 bg-[#313642]">
    ... more code
      <View className="flex">
        <SharedElement id="sharedbutton">
          <GuideButton type="pay" onPress={submit} />
        </SharedElement>
      </View>
    </SafeAreaView>
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions