React-Native引用自定义组件

来源:互联网 发布:复杂网络研究方向 编辑:程序博客网 时间:2024/05/20 18:40

自定义组件LoginView:

import React, { Component } from 'react';import {    AppRegistry,    StyleSheet,    Text,    View} from 'react-native';export default class LoginView extends Component {    render() {        return (            <View style={styles.container}>                <Text>aaa</Text>            </View>        );    }}const styles = StyleSheet.create({    container:{        flex:1,        backgroundColor:'red',        alignItems:'center',        justifyContent:'center',    },});// 输出,这里千万别忘记module.exports = LoginView;

在index.ios.js文件中代码如图:



如上操作即可


0 0