加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React-Native基础_1.初识React-Native项目

发布时间:2020-12-15 06:57:49 所属栏目:百科 来源:网络整理
导读:1.初识React-Native项目'use strict'//使用严格模式import React,{ Component } from 'react';//导入React的Component组件import { AppRegistry,StyleSheet,Text,View} from 'react-native';//导入View Text AppRegistry等类export default class Day0718 ex
1.初识React-Native项目

'use strict'//使用严格模式
import React,{ Component } from 'react';//导入React的Component组件
import {
    AppRegistry,StyleSheet,Text,View
} from 'react-native';//导入View Text AppRegistry等类

export default class Day0718 extends Component{

    render(){
        return(
            <View>
               <Text >
                   Welcome to React Native!
               </Text>
            </View>
        );
    }
 }
 //render 渲染一个View
 AppRegistry.registerComponent('Day0718',() => Day0718);
 
在app 下面的MainActivity 中
package com.day0718;

import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "Day0718";
    }
}

通过ComponentName  来绑定模块到原生Activity 中


---------------欢迎各位大神加群

----------------Android交流群:230274309

-----------------------------期待大神们的到来

------------------------一---起分享,一起进步!需要你们

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读