Zorayr
Zorayr

Reputation: 24874

How to disable push animation when using Expo router replace()?

I am using Expo Router for my React Native application. I am trying to navigate to a page within my app without any animations; in React Navigation, there is an option to set the animation, but seems like expo router hides this parameter. Is there a way to do this?

router.replace({
  pathname: '/my-link',
  params: {},
});

Upvotes: 1

Views: 12

Answers (1)

David Leuliette
David Leuliette

Reputation: 1951

On your _layout.tsx file you can have something like this

export default function Layout() {
  return (
    <Stack
      screenOptions={{
        animation: "none"
      }}
    >
      <Stack.Screen name="screen1" />
      <Stack.Screen name="screen2" />
    </Stack>
  );
}

Upvotes: 0

Related Questions