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. 学会这些 pycharm 编程小技巧,编程效率提升 10 倍

    PyCharm 是一款非常强大的编写 python 代码的工具.掌握一些小技巧能成倍的提升写代码的效率,本篇介绍几个经常使用的小技巧. 一.分屏展示 当你想同时看到多个文件的时候: 1.右击标签页: ...

  2. Linux 问题集

    解决E: Encountered a section with no Package: header错误 我的ubuntu机器上出现下面这个错误. Reading package lists... E ...

  3. springcloud-概念

    springcloud-概念 一.架构演进过程 单体架构----分布式架构----SOA(eg.dubbo)服务治理架构----微服务 随着互联网的发展,需求的激增致使网站应用规模的扩大,最后转成了技 ...

  4. 关于&联系我

    本文已迁移至: Github博客:https://coco5666.github.io/blog/about Gitee博客:https://coco56.gitee.io/blog/about 博客 ...

  5. linux下mysql5.7的MHA高可用架构搭建

    一.MHA简介 MHA(Master High Availability)目前在mysql高可用方面比较成熟.是一套优秀的作为 mysql高可用性环境下故障切换和主从提升的高可用软件.在MySQL故障 ...

  6. C++ STL(一)string的用法

    # 1.string的用法- string在<iostream>的头中就有,但是还是得用<string>的头 ##### 构造函数- str(const char* ch) 直 ...

  7. Spring Framework Part1

    初识Spring 1.Spring是一个支持IOC(Inversion of Control),DI(Dependency Injection),AOP(Aspect Oriented Program ...

  8. 十二、S3C2440 裸机 — SDRAM

    12.1 SDRAM 介绍 12.1.1 SDRAM 定义 SDRAM(Synchronous Dynamic Random Access Memory):同步动态随机存储器-内存条 同步是指内存工作 ...

  9. Linux文件命名规则

    Linux目录结构命名规定 几乎所有的Linux版本都会遵循FHS(Filesystem Hierarchy Standard),中文翻译过来即为文件系统层次化标准.类似于Windows操作系统中c盘 ...

  10. linux资源管理命令之-----vmstat

    一.作用及语法: 命令用来显示Linux系统虚拟内存状态,也可以报告关于进程.内存.I/O等系统整体运行状态. vmstat [options] [delay [count]] 二.vmstat各字段 ...