1

我正在使用 expo 的 react-native 项目中工作,我共享链接时出现错误,请共享无错误代码。我将在描述中分享我的代码

我的确切错误的链接

在此处输入图像描述

应用程序.js

 import React from 'react';
    import MovieList from './components/list';
    import  Detail from './components/detail';
    
    
    import { createAppContainer } from 'react-navigation';
    import { createStackNavigator } from 'react-navigation-stack';
    
    const AppNavigator = createStackNavigator({
      MovieList: {screen: MovieList},
      Detail: {screen: Detail},
    
    })
    
    const App = createAppContainer(AppNavigator);
    
    export default App();

细节.js

import React from 'react';
import { StyleSheet, View, Text} from 'react-native';
 
 export default class Detail extends React.Component {
 
  render() {
    return (
      <View>
        <Text>Details page here</Text>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center"
  },
  item: {
    flex: 1,
    padding: 10,
    height: 50,
    backgroundColor: '#282C35'
  },
  itemText: {
color: '#fff',
fontSize: 24
  }
});
4

1 回答 1

3

export default App();应该export default App;改为。该错误告诉您这App不是一个函数,因此您需要删除括号。

于 2019-11-16T11:32:51.867 回答