-
Notifications
You must be signed in to change notification settings - Fork 49
Redirect #46
Comments
Your app starts with the Solution is to wrap both Cards in a As you can see in Leo's example he wrapped the starting and main route in a Switch: https://github.com/LeoLeBras/react-router-navigation/blob/master/examples/Basic/src/index.js#L129 |
Hey, @LaszloDev. 👋 Yup, replacing I've also tried using this: <NativeRouter>
<Navigation>
<Switch>
<Card
exact
path="/"
render={() => {
console.log('Redirecting.');
return (
<Redirect to="/redirect" />
);
}}
/>
<Card
path="/redirect"
render={() => (
<Text>Redirected.</Text>
)}
/>
</Switch>
</Navigation>
</NativeRouter> But this gives me the following error: Thanks for your help! 🙏 |
Why do you need for the initial route setup an animation? The reason to use this kind of initial redirect is that you have a default sub route when using BottomNavigation or Tabs to decide with tab is active. |
Hey, @LaszloDev! 👋 Sorry for the late reply. I somehow missed your comment. 😰 That example was made for brevity. The reason I'm using this initial redirect is that, say, I want to redirect the user to the Cheers! 😃 |
I also have troubles using Redirect - it does not work and gives this error, maybe it will help:
|
Hey, Leo! 👋
This is awesome! Thank you for making this. 🙏
Well, I'm having issues using
react-router
's<Redirect />
with this library. 😭I see a blank screen, and it renders/redirects twice resulting in the following warning:
Warning: You tried to redirect to the same route you're currently on: "/redirect"
.Code: 👨💻
I've also prepared a
Snack
for you: https://snack.expo.io/SkgJqwz6W.Thanks for your time. Cheers! 😃
The text was updated successfully, but these errors were encountered: