1.Main 目录下新建LaunchImage.js:

/**
* 启动页
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image
} from 'react-native'; /*==============导入外部组件================*/
var Main = require('./Main'); // ES5
var Launch = React.createClass({
render() {
return (
<Image source={{uri:'launchimage'}} style={styles.launchimageStyle} />
);
}, // 组件加载完成
componentDidMount(){
// 2秒后切换到Main
setTimeout(()=>{
this.props.navigator.replace({
component:Main
});
},2000);
}
}); const styles = StyleSheet.create({
launchimageStyle:{
flex:1, }
}); // 输出
module.exports = Launch;

2.修改index.android.js:

/**
* android
*/
import React, { Component } from 'react';
import {
AppRegistry,
} from 'react-native'; /*==============导入外部组件================*/
import CustomerComponents, { Navigator } from 'react-native-deprecated-custom-components';
var LaunchImage = require('./Component/Main/LaunchImage'); class BuyDemo extends Component {
render() {
return (
<Navigator
initialRoute={{name: '启动页', component:LaunchImage}}
renderScene={(route, navigator) =>{
let Component = route.component;
return <Component {...route.passProps} navigator={navigator} />
}}
/>
);
}
} AppRegistry.registerComponent('BuyDemo', () => BuyDemo);

.

React Native商城项目实战06 - 设置安卓中的启动页的更多相关文章

  1. React Native商城项目实战07 - 设置“More”界面导航条

    1.More/More.js /** * 更多 */ import React, { Component } from 'react'; import { AppRegistry, StyleShee ...

  2. React Native商城项目实战05 - 设置首页的导航条

    1.Home.js /** * 首页 */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Te ...

  3. React Native商城项目实战08 - 设置“More”界面cell

    1.自定义可复用的cell More/CommonCell.js: /** * 自定义可复用的cell */ import React, { Component } from 'react'; imp ...

  4. React Native商城项目实战01 - 初始化设置

    1.创建项目 $ react-native init BuyDemo 2.导入图片资源 安卓:把文件夹放到/android/app/src/main/res/目录下,如图: iOS: Xcode打开工 ...

  5. React Native商城项目实战10 - 个人中心中间内容设置

    1.新建一个MineMiddleView.js,专门用于构建中间的内容 /** * 个人中心中间内容设置 */ import React, { Component } from 'react'; im ...

  6. React Native商城项目实战04 - 封装TabNavigator.Item的创建

    1.Main.js /** * 主页面 */ import React, { Component } from 'react'; import { StyleSheet, Text, View, Im ...

  7. React Native商城项目实战03 - 包装Navigator

    1.在Home目录下新建首页详细页HomeDetail.js /** * 首页详情页 */ import React, { Component } from 'react'; import { App ...

  8. React Native商城项目实战02 - 主要框架部分(tabBar)

    1.安装插件,cd到项目根目录下执行: $ npm i react-native-tab-navigator --save 2.主框架文件Main.js /** * 主页面 */ import Rea ...

  9. React Native商城项目实战12 - 首页头部内容

    1.HomeTopView为首页头部内容,HomeTopListView为HomeTopView子视图. 2.HomeTopView.js /** * 首页头部内容 */ import React, ...

随机推荐

  1. 使用procedump捕获未处理异常的dump

    -ma full memory dump, always do this on 2003 as 4gb is not much and it is good to have the heap -mp  ...

  2. 在docker下运行mysql

    docker pull mysql 从镜像仓库中拉取mysql镜像. 运行镜像 到此mysql在docker容器下运行成功. 使用Navicat连接工具连接到mysql 经过以上步骤就完成了在dock ...

  3. C++循环单链表删除连续相邻重复值

    比如:1(头)->2->2->3->3->1->1(头) 去除以后的结果是1->2->3,注意头尾的1也要去掉一个. #include "st ...

  4. Delphi 算术运算符与算术表达式

  5. zabbix 图形注释乱码

    1.寻找字体文件 1.1 首先需要找到zabbix后台的字体文件路径,字体文件的后缀为.ttf [root@zabbix ~]# cd /usr/share/zabbix/ [root@zabbix ...

  6. python中使用schedule模块定时执行任务

    python中有一个轻量级的定时任务调度的库:schedule.他可以完成每分钟,每小时,每天,周几,特定日期的定时任务.因此十分方便我们执行一些轻量级的定时任务. 代码如下: import sche ...

  7. SQL小操作

    用string.Format格式化参数 string sqlCmd = string.Format("select NO from [dbo].[SendAcerData] where BA ...

  8. JQuery 时间戳转时间

    JQuery 时间戳转时间 var date = new Date(stocks[i]['create_time'] * 1000); var y = date.getFullYear(); var ...

  9. python路径拼接os.path.join()函数的用法

    os.path.join()函数:连接两个或更多的路径名组件 1.如果各组件名首字母不包含’/’,则函数会自动加上 2.如果有一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃 3.如果最后一个组 ...

  10. jQuery后续和 前端框架Bootstrap

    目录 一.jQuery后续 1. 动画效果 (1)自定义点赞动画实例 2. jQuery的自带方法 (1)each (类似for循环) (2)data() (存放隐形的数据) 二.前端框架之Boots ...