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. [Vue] vue的一些面试题3

    1. vue 组件里的定时器要怎么销毁? 当生命周期销毁后,并没有将组件中的计时器销毁,虽然页面上看不出来,但是如果在控制台打印的话,会发现计时器还在运行,所以要销毁计时器,避免代码一直执行 cons ...

  2. Jade学习(二)之语法规则上

    语法 ⚠️实例均结合node jade缩进代表层级 html <html></html> html <html> head <head> style & ...

  3. Jquery复习(四)之text()、html()、val()

    三个简单实用的用于 DOM 操作的 jQuery 方法: text() - 设置或返回所选元素的文本内容 html() - 设置或返回所选元素的内容(包括 HTML 标记) val() - 设置或返回 ...

  4. kafka消费之kafka查看topic是否有数据

    通过原生kafka,查看对应的topic是否有数据 下载kafka:登录Apache kafka官方下载 http://kafka.apache.org/downloads.html 配置config ...

  5. RedHat7安装yum工具

    一                   RedHat7安装yum工具 1.1        查看yum是否可用 yum list yum repolist 1.2        卸载原yum rpm ...

  6. git 与gitlab

    1.gitlab 创建project ,命名为test2 2.git push项目 git remote add ******* mkdir test1 cd test1 git init nano ...

  7. Educational Codeforces Round 77 比赛总结

    比赛情况 我太菜了 A题 加减乘除不会 B题 二元一次方程不会 C题 gcd不会 就会一个D题二分答案大水题,本来想比赛最后一分钟来一个绝杀,结果 Wrong Answer on test 4 比赛总 ...

  8. node.js 实现 AES CTR 加解密

    node.js 实现 AES CTR 加解密 node aesctr 前言 由于最近我们在做一款安全的文件分享 App, 所有文件均需要使用 aes ctr 来进行加密,aes key 还有一整套完整 ...

  9. Linux系统中的硬件问题如何排查?(1)

    在Linux系统中,对于硬件故障问题的排查可能是计算机管理领域最棘手的工作,即使是经验相当丰富的用户有时也会遇上自己搞不定的状况,本文分享一些实用的技巧与处理方法,希望有助于读者朋友理解.查明并最终搞 ...

  10. 微信小程序-饮食日志_开发记录01

    今天主要了解微信小程序的框架结构以及环境部署等. 小程序的框架主要分为: js.json.wxss.wxml等 和java web的内容相似,主要了解内部代码的使用情况和语言方式. 主要写了页面的框架 ...