0
這裏是我的代碼:如何在最新版本的React Native中使用Navigator?
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Navigator
} from 'react-native';
import Component5 from './app/components/component5/component5.js';
import Component6 from './app/components/component6/component6.js';
export default class myproject extends Component {
renderScene(route, navigator){
switch(route.id){
case 'component5':
return(<Component5 navigator={navigator} title="component5" />)
case 'component6':
return(<Component6 navigator={navigator} title="component6" />)
}
}
render() {
return (
<Navigator
initialRoute={{id:'component5'}}
renderScene={this.renderScene}
configureScreen={(route, routeStack) => Navigtator.SceneConfigs.FloatFromBottom}
/>
);
}
}
AppRegistry.registerComponent('myproject',() => myproject);
當我運行它時,它拋出這個錯誤:
所有的首先,爲什麼Navigator
在最新的版本已經過時?我現在該怎麼辦?我幾乎不認爲安裝已棄用的東西是一個好主意。
我明白了,謝謝,upvote。你對「路由器通量」有什麼看法? –
嗨,我無法對路由器通量發表任何評論,因爲我之前沒有使用它。但如果你想找到一個新的導航解決方案,我會推薦react-navigation。這是一種「官方」導航解決方案,用於反應原生且相當穩定。 – KimHau
啊,正是你的意思*反應導航*正好?你在你的問題或[this](https://github.com/wix/react-native-navigation)中鏈接的那個? –