React Native Navigation Undefined不是函数

时间:2017-07-19 04:10:21

标签: react-native react-native-navigation

我努力让Node Package react-native-navigation在我的项目中工作。但是,当我尝试运行我的应用程序时,我遇到了一个令人讨厌的错误,我似乎无法追查。感谢帮助。

错误:

errorr

index.js:

import Navigation from 'react-native-navigation';
import SideBar from './sidebar';
import Meetups from './meetups';

export default function() {
    Navigation.registerComponent('inbetween.sidebar', () => SideBar);
    Navigation.registerComponent('inbetween.meetups', () => Meetups);
}

App.js:

import Navigation from 'react-native-navigation';
import registerScreens from './screens';

registerScreens();

export default class App {

}

Navigation.startSingleScreenApp({
  screen: {
    screen: 'inbetween.meetups',
    title: 'Meetups',
    navigatorStyle: {},
    navigatorButtons: {}
  },
  drawer: {
    left: {
      screen: 'inbetween.sidebar',
      passProps: {}
    },
    disableOpenGesture: false
  },
  passProps: {},
  animationType: 'slide-down'
});

index.android.js

import App from './src/App';
AppRegistry.registerComponent('App', () => App);

边栏:

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

class SideBar extends React.Component {
  render() {
    return (
      <View>
         <Text>Navigation List Here</Text> 
      </View>
    );
  }
};

export default SideBar;

聚会:

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

class Meetups extends React.Component {
  render() {
    return (
      <View style>
        <Text>Meetup List Here</Text>
      </View>
    );
  }
};

export default Meetups;

1 个答案:

答案 0 :(得分:1)

您需要像这样导入Navigationimport {Navigation} from 'react-native-navigation';