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. centos 6.x 编译安装 pgsql 9.6

    文章结构如下: 一. 环境配置 1. 配置防火墙 查看IPTABLES 当前状态与关闭过程 chkconfig --list|grep iptables 关闭iptables service ipta ...

  2. Solr IK分词器配置

    下载地址:https://search.maven.org/search?q=com.github.magese 分词器配置: 参考:https://www.cnblogs.com/mengjinlu ...

  3. 牛客假日团队赛5J 护城河 bzoj 1670: [Usaco2006 Oct]Building the Moat护城河的挖掘 (凸包的周长)

    链接:https://ac.nowcoder.com/acm/contest/984/J 来源:牛客网 护城河 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言6 ...

  4. [每日一学]apache camel简介

    apache camel 是轻量级esb框架.如下是它的架构图: 它有几个比较重要的概念就是: 1.endpoint,所谓的endpoint,就是一种可以接收或发送数据的组件.可以支持多种协议,如jm ...

  5. jQuery $.ajax传递数组的traditional参数传递必须true 对象的序列化

    数组类型参数传递: 若一个请求中包含多个值,如:(test.action?tid=1&tid=2&tid=3),参数都是同一个,只是指定多个值,这样请求时后台会发生解析错误,应先使用 ...

  6. HIVE 必知必会

    hive: 基于hadoop,数据仓库软件,用作OLAP OLAP:online analyze process 在线分析处理OLTP:online transaction process 在线事务处 ...

  7. HttpClient——ESP8266HTTPClient库

    针对Http请求操作的库,ESP8266HTTPClient库不属于ESP8266WiFi库的一部分,所以需要引入  #include <ESP8266HTTPClient.h> HTTP ...

  8. percona-xtrabackup-8.0.7简单快捷使用

    percona-xtrabackup-8.0.7简单快捷使用 # 参考资料: https://blog.csdn.net/vkingnew/article/details/83012316 # 环境: ...

  9. 对浏览器如何计算CSS的研究---------------引用

    1. 加载CSS 在构建DOM的过程中,如果遇到link的标签,当把它插到DOM里面之后,就会触发资源加载——根据href指明的链接: 上面的rel指明了它是一个样式文件.这个加载是异步,不会影响DO ...

  10. 曙光浪潮IBM驱动

    https://pan.baidu.com/s/1lDrotg5jpdN_z0yOYyAo4w