超级、超级basic在这里响应本机安装;尝试向我的应用程序添加一个简单的NavigatorIOS实例。我已经用一个NavigatorIOS参数填充了initialRoute,并将该组件设置为另一个组件,但是在运行时我会得到标题中的错误。这是我看到的照片。

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.14Mojave上运行Xcode-10测试版,并使用Reactinative最新版本。
发布于 2018-09-12 09:27:01
这是因为这里的错误
<NavigatorIOS
intitialRoute ={{ // <== here
component: HomePage,
title: 'Home'
}}/> 将intitialRoute替换为initialRoute
https://stackoverflow.com/questions/52291364
复制相似问题