博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
React-Native启动页到主页过渡
阅读量:4086 次
发布时间:2019-05-25

本文共 744 字,大约阅读时间需要 2 分钟。

启动页是图片过渡两秒,componentWillUnmount()
需要清除定时器

'use strict';import React from 'react';import {  Dimensions,  Image,  InteractionManager,  View,  Text,} from 'react-native';import AppMain from './AppMain';var {height, width} = Dimensions.get('window');class Splash extends React.Component {  constructor(props) {    super(props);  }  componentDidMount() {    const {navigator} = this.props;     this.timer=setTimeout(() => {      InteractionManager.runAfterInteractions(() => {        navigator.resetTo({          component: AppMain,          name: 'AppMain'        });      });    }, 2500);  }  componentWillUnmount() {    this.timer && clearTimeout(this.timer);  }  render() {    return (      
); }}export default Splash;

转载地址:http://vpeni.baihongyu.com/

你可能感兴趣的文章
【Lua】Mac系统下配置SublimeText的Lua编译环境
查看>>
【C#】利用Conditional属性完成编译忽略
查看>>
【Unity】微信登录后将头像存为bytes,将bytes读取成sprite图片
查看>>
【Unity】使用GPS定位经纬度
查看>>
【UGUI/NGUI】一键换Text/Label字体
查看>>
【C#】身份证本地验证
查看>>
【Unity】坑爹的Bug
查看>>
【算法】求数组中某两个数的和为目标值
查看>>
Android面试题(2):一般什么情况下会导致内存泄漏问题?
查看>>
Android 面试题(3):回答一下什么是强、软、弱、虚引用以及它们之间的区别?
查看>>
Android 面试题(4):谈谈 Activity 的启动模式
查看>>
Android 面试题(5):谈谈 Handler 机制和原理?
查看>>
Android 面试题(6):谈谈你对 ANR 的了解?
查看>>
Android 面试题(7):你对单例模式了解多少?
查看>>
Android 面试题(8):抽象类和接口的区别?
查看>>
DECLARE_DYNAMIC和IMPLEMENT_DYNAMIC宏
查看>>
vs2008 mfc 添加ActiveX控件
查看>>
隐式调用动态链接库(DLL)中的类
查看>>
Android APK 签名原理
查看>>
如何快速上传开源项目至 Jcenter
查看>>