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. NSIS打包软件使用

    NSIS打包软件使用 最近做的一个调用远程桌面的小应用需要打个安装包,并且在安装的时候需要添加注册表,我之前使用的都是"Advanced Installer"来打包应用程序的,这个 ...

  2. Exceptionless

    参考 Exceptionless - .Net Core开源日志框架

  3. homebrew学习(五)之homebrew cask和homebrew services

    homebrew cask 如果我想安装Chrome浏览器怎么办?试试下面的命令: brew install google-chrome 发现并不能安装,没有该软件.怎么办?好消息是一个叫做homeb ...

  4. python3:tuple元组

    https://www.runoob.com/python3/python3-tuple.html 元组使用小括号,列表使用方括号. 元组创建很简单,只需要在括号中添加元素,并使用逗号隔开即可. Py ...

  5. 简单了解node stream

    Almost all Node.js applications, no matter how simple, use streams in some manner. 开篇先吓吓自己.画画图,分析分析代 ...

  6. OneDrive高速下载链接分享

    目录 1. 下载帮助 2. 本文地址 3. 资源链接 4. 打赏&支持 5. 关于&联系我 1. 下载帮助 OneDrive下载教程,建议不了解的先看下: https://www.cn ...

  7. C#基础知识之理解HTTP协议

    在互联网时代HTTP协议的重要性无需多言,对于技术岗位的同学们来说理解掌握HTTP协议是必须的.本篇博客就从HTTP协议的演进.特性.重要知识点和工作中常见问题的总结等方面进行简单的介绍.理解掌握了这 ...

  8. Error: unable to perform an operation on node 'rabbit@DESKTOP-6JT7D2H'. Please see diagnostics information and suggestions below.

    https://blog.csdn.net/qq_32814555/article/details/79494533

  9. 查看系统的DPI

    #include <Windows.h> #include <iostream> int main() { SetProcessDpiAwarenessContext(DPI_ ...

  10. C/C++运算符优先级关系

    C/C++优先级 从高到低 1~14梯队 1.  ()  []  .  -> 2.   !  ~   -(负号) ++  --   &(取变量地址)*   (type)(强制类型)   ...