I want to navigate a splash screen to next screen after certain timeout. Splash screen have an animation, done with the help of Airbnb Lottie for React Native.
The splashscreen code goes as follows:
After I run the app following errors comes up:
undefined is not a function (evaluating'_reactNavigation.NavigationActions.reset')
The Main.js
file looks like as follows:
import React from "react";
import { View, Text } from "react-native";
import { createStackNavigator } from "react-navigation";
import SplashScreen from "./screens/SplashScreen";
import Walkthrough from "./screens/Walkthrough";
const Routes = createStackNavigator({
Home: {
screen: SplashScreen
},
Walkthrough: {
screen: Walkthrough
}
});
export default class Main extends React.Component {
render() {
return <Routes />;
}
}
Any help/feedback?
reset
action is removed from NavigationActions
and there is StackActions
specific to StackNavigator
in v2 of react-navigation.
StackActions
is an object containing methods for generating actions specific to stack-based navigators. Its methods expand upon the actions available in NavigationActions.The following actions are supported:
Reset - Replace current state with a new state
Replace - Replace a route at a given key with another route
Push - Add a route on the top of the stack, and navigate forward to it
Pop - Navigate back to previous routes
PopToTop - Navigate to the top route of the stack, dismissing all other routes