2017-09-03 78 views
0

我剛剛瞭解React-Native,因此請在您的答案中提供一些解釋。將IOS轉換爲Android時,React-Native元素類型無效

我努力使Android上對此做出何種反應,本地IOS例如工作 https://www.raywenderlich.com/165140/react-native-tutorial-building-ios-android-apps-javascript

的例子適用於iOS很大,所以,我編輯index.android.js使用NavigatorAndroid代替NavigatorIOS這樣

import React, { Component } from 'react'; 
import { 
    AppRegistry, 
    StyleSheet, 
    Text, 
    View, 
    NavigatorAndroid, 
} from 'react-native'; 
import SearchPage from './SearchPage'; 

class PropertyFinder extends Component { 
    render(){ 
    return (
     <NavigatorAndroid 
     style={styles.container} 
     initialRoute={{ 
      title: 'Property Finder', 
      component: SearchPage, 
     }}/> 
    ); 
    } 
} 

const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    } 
}); 

AppRegistry.registerComponent('PropertyFinder',() => PropertyFinder); 

我還在我的android目錄中添加了local.properties文件來定位android-sdk,那肯定是正確的,因爲我嘗試了其他項目。

我已經看到其他職位上SO重新這個錯誤,但他們沒有提供我的情況下的答案。

但在Android上運行會顯示此錯誤。

enter image description here

回答

1

有沒有這樣的事情NavigatorAndroid。您應該使用Navigator。它適用於這兩個平臺。選中此項:Navigator documentation

相關問題