【发布时间】:2018-09-12 09:02:47
【问题描述】:
超级,超级基础的 React Native 安装在这里;试图向我的应用程序添加一个简单的 NavigatorIOS 实例。我已经使用initialRoute 参数填充了 NavigatorIOS,并将其组件设置为另一个组件,但在运行时标题中出现错误。这是我所看到的图像。
App.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import {Platform, StyleSheet, Text, View, NavigatorIOS, TabBarIOS} from 'react-native';
import {HomePage} from './app/pages/Home';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu'
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.instructions}>{instructions}</Text>
<NavigatorIOS
intitialRoute={{
component: HomePage,
title: 'Home'
}}/>
</View>
);
}
}
Home.js
import React, {Component} from "react";
import {View} from "react-native";
export class HomePage extends Component<{}> {
constructor(props, context) {
super(props, context);
}
_onForward = () => {
this.props.navigator.push({
title: 'Scene foo',
});
};
render() {
return (
<View>
</View>
);
}
}
为什么我会看到这个?在 macOS 10.14 Mojave 上运行 Xcode-10 beta 和最新版本的 React Native。
【问题讨论】:
标签: react-native