我想在特定超时后将启动画面导航到下一个屏幕.启动画面有一个动画,在Airbnb Lottie的帮助下为React Native完成.
splashscreen代码如下:
import React from "react";
import { Animated, Easing } from "react-native";
import LottieView from "lottie-react-native";
import { NavigationActions } from "react-navigation";
export default class SplashScreen extends React.Component {
static navigationOptions = {
header: null
};
constructor() {
super();
this.state = {
progress: new Animated.Value(0),
}
}
componentDidMount() {
setTimeout(() => {
this.navigateToWalkthrough()
}, 3500);
Animated.timing(this.state.progress, {
toValue: 1,
duration: 3000,
easing: Easing.linear,
}).start();
}
navigateToWalkthrough = () => {
const navigateAction = …Run Code Online (Sandbox Code Playgroud)我看到很多人在反应导航问题部分使用this.props.navigation.dispatch以编程方式导航.是否有任何特定的原因或用例使用它this.props.navigation.navigate?
看起来您可以将更多选项传递给调度函数?还有别的事吗?您是否可以在没有明确地将反应导航绑定到您的应用程序redux商店的情况下使用调度?现在我有一个具有redux的应用程序,但我没有明确配置我的redux设置以了解react-navigation(如果可以的话,我更愿意保持这种方式).
我观察到Back按钮逻辑可以看到堆栈中的屏幕序列.我有一个放置在堆栈导航器中的抽屉导航器.
在堆栈顶部我有Splash画面.在仪表板上,当我按下后退按钮时,我需要启动屏幕.
进入应用程序后,如何从堆栈中删除启动画面,因此当我按下后退按钮仪表板时,它将退出应用程序,而不是转到SPLASH SCREEN.
/* @flow */
import React from "react";
import { Platform, Text } from "react-native";
import { Root } from "native-base";
import { StackNavigator, DrawerNavigator} from "react-navigation";
import Register from "./components/Register";
import Available from "./components/Available";
import Splash from "./components/splash/“;
import SideBar from "./components/sidebar";
import Discover from "./components/Discover/";
import Dashboard from "./components/Dashboard/";
import Contact from "./components/Contact"
const Drawer = DrawerNavigator(
{
Dashboard: { screen: Dashboard },
Discover: { screen: Discover },
Contact: { screen: Contact},
},
{
navigationOptions: …Run Code Online (Sandbox Code Playgroud)