栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

React Native

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

React Native

使用Expo时,您不应该自己注册应用程序,而应该让Expo自己进行注册,请记住,您必须始终导出默认组件:此外,您还需要从react-
native导入View和Button:请在下面找到完整内容码:

import React from 'react';import {  AppRegistry,  Text,  View,  Button} from 'react-native';import { StackNavigator } from 'react-navigation'; class HomeScreen extends React.Component {  static navigationOptions = {    title: 'Welcome',  };  render() {    const { navigate } = this.props.navigation;    return (      <View>        <Text>Hello, Chat App!</Text>        <Button          onPress={() => navigate('Chat', { user: 'Lucy' })}          title="Chat with Lucy"        />      </View>    );  }} class ChatScreen extends React.Component {  // Nav options can be defined as a function of the screen's props:  static navigationOptions = ({ navigation }) => ({    title: `Chat with ${navigation.state.params.user}`,  });  render() {    // The screen's current route is passed in to `props.navigation.state`:    const { params } = this.props.navigation.state;    return (      <View>        <Text>Chat with {params.user}</Text>      </View>    );  }}const  SimpleAppNavigator = StackNavigator({  Home: { screen: HomeScreen },  Chat: { screen: ChatScreen }});const AppNavigation = () => (  <SimpleAppNavigator  />);export default class App extends React.Component {  render() {    return (        <AppNavigation/>    );  }}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/370192.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号