2017-11-09 10 views
0

누군가 내가 뭘 잘못하고 있다고 말할 수 있습니까?React Native : React Navigation 문제

저는 React Native에 매우 익숙하며 React Navigator에 대한 예제를 여기에서 따르고 있습니다.

앱은 Expo IDE를 통해 개발되었습니다.

https://reactnavigation.org/docs/intro/quick-start

이것은 이것은 SRC 안쪽에 RootNavigator.js

import React from 'react'; 
import { View, Text } from 'react-native'; 
import { StackNavigator } from 'react-navigation'; 

const HomeScreen =() => (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> 
    <Text>Home Screen</Text> 
    </View> 
); 

const DetailsScreen =() => (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> 
    <Text>Details Screen</Text> 
    </View> 
); 

const RootNavigator = StackNavigator({ 
    Home: { 
    screen: HomeScreen, 
    navigationOptions: { 
     headerTitle: 'Home', 
    }, 
    }, 
    Details: { 
    screen: DetailsScreen, 
    navigationOptions: { 
     headerTitle: 'Details', 
    }, 
    }, 
}); 

export default RootNavigator; 

Rootnavigator.js 내 SRC 코드 App.js

import React from 'react'; 
import { StyleSheet, Text, View } from 'react-native'; 
import { RootNavigator } from './src/RootNavigator'; 

export default class App extends React.Component { 
    render() { 
    return (
     <View style={styles.container}> 
     <RootNavigator /> 
     </View> 
    ); 
    } 
} 

const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    backgroundColor: '#fff', 
    alignItems: 'center', 
    justifyContent: 'center', 
    }, 
}); 

내 SRC 코드 폴더 (스크린 샷 첨부)

enter image description here

내 아이폰에서 실행하는 동안이 오류가 발생합니다.

import { RootNavigator } from './src/RootNavigator'; 

import RootNavigator from './src/RootNavigator'; 
여기 ES6 가져 오기/내보내기에 대한

더 많은 정보에 : 당신은 익명의 수출이다 export default App을하고있는

enter image description here

+0

가끔은 문제가 있습니다. 당신이 위에있는 것처럼'export default class ... '를 수행한다. 'class App ...'과 파일'export default App;의 맨 아래에 시도해보십시오. 나는 아직까지도 초보자이기 때문에 아무런 약속도하지 않는다. –

+0

@MichaelEvans : 시도한 행운 : (.. –

답변

관련 문제