olafguesswhapp
olafguesswhapp

Reputation: 140

Navigator.SceneConfigs can't find variable: Navigator

I want to configure various scene animations with Navigator.SceneConfigs ("FloatFromRight" and "FloatFromLeft").

Within the Scene - if I call the scene with a configured animation I receive the error message "Can't find variable: Navigator" (although I am of the opinion that I copied the code above from the React-Native examples).

_onPressBar1: function(){
    debugger;
    this.props.nav.push({
      id: 'Login',
      sceneConfig: Navigator.SceneConfigs.FloatFromLeft,
    });
  },

I created the following Navigator:

render: function() {
    return (
      <Navigator
        style={styles.container}  
        renderScene ={this.renderScene}
        configureScene={(route) => {
          if (route.sceneConfig) {
            return route.sceneConfig;
          }
          return Navigator.SceneConfigs.FloatFromRight;
        }}
        initialRoute={{
          id: 'Login',
          index: 0,
        }} />
    );
  }

with the following renderScene:

renderScene: function(route, navigator){
    if ('Login' === route.id) {
    return (
      <View style={{flex: 1}}>
        <TopBar nav={navigator} displBackIcon={false} />
        <Login
          name={route.name}
          navigator={navigator} />
        <BottomBar nav={navigator} currentPage={route.id} />
      </View>
      );
    } else if ('Test' === route.id) {
      return (
        <View style={{flex: 1}}>
          <TopBar nav={navigator} displBackIcon={false} />
          <Test
              navigator={navigator} />
          <BottomBar nav={navigator} currentPage={route.id} />
        </View>
      );
    } 
  },

Upvotes: 0

Views: 2497

Answers (1)

olafguesswhapp
olafguesswhapp

Reputation: 140

The _onPressBar1 function was included in a different file where I forgot to include the Navigator in the React definition: var { Image, Navigator, StyleSheet, Text, TouchableOpacity, View, } = React;

Upvotes: 3

Related Questions