欢迎页
路由配置
Welcome:{
screen:welcomePage,
navigationOptions:{
header:null //去掉导航条
}
}
welcome.js
import React, { Component } from 'react';
import { View, Text,Image,StyleSheet,Dimensions } from 'react-native';
const {width,height,scale} =Dimensions.get('window') //获取高度宽度
export default class welcomePage extends Component {
render() {
return (
<View style={styles.container}>
<Image style={styles.image} source={require("../assets/1.jpg")}/>
<Button style={styles.btn} color="blue" title="跳过" onPress={this.toggledet}/>
</View>
);
}
componentDidMount(){
this.timer = setTimeout(()=>{
this.props.navigation.navigate("Home")
},3000)
}
componentWillUnmount(){
if(this.timer){
clearTimeout(this.timer)
}
}
toggledet=()=>{
this.props.navigation.navigate("Home")
}
}
const styles = StyleSheet.create({
image:{
width:width, //赋给图片
height:height,
}
})
去掉返回按钮
navigationOptions:{
headerTitle:"网易",
headerLeft:null //去掉返回按钮
}