Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native Navigator is deprecated and has been removed from this package

I get the following error.

Navigator is deprecated and has been removed from this package. It can now be installed and imported from react-native-deprecated-custom-components instead of react-native. Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html

Then I would update react-native-deprecated-custom-components package but issue not solved

Package.Json

"dependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "0.44.2",
    "react-native-deprecated-custom-components": "^0.1.0",
    "sendbird": "^3.0.30"
},

main.js

var React = require('react-native')
var {
  Navigator,
  StyleSheet
} = React;

var Login = require('./components/login');

import NavigationExperimental from 'react-native-deprecated-custom-components';

var ROUTES = {
  login: Login
};

module.exports = React.createClass({
  renderScene: function(route, navigator) {
    var Component = ROUTES[route.name];
    return <Component route={route} navigator={navigator} />;
  },
  render: function() {
    return (

      <NavigationExperimental.Navigator
        style={ styles.container }
        initialRoute={ {name: 'login'} }
        renderScene={this.renderScene}
        configureScene={ () => { return Navigator.SceneConfigs.FloatFromRight; } }
      />
    );
  }
});

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

Any one let me know to solve this issue

like image 245
Arunkumar Avatar asked Jun 02 '17 11:06

Arunkumar


People also ask

Is react navigation deprecated?

This version has been deprecated This version of React Navigation is no longer supported.

How to install react native stack navigation?

Installation​ To use this navigator, ensure that you have @react-navigation/native and its dependencies (follow this guide), then install @react-navigation/native-stack : npm. Yarn.

What is difference between react navigation 5 and 6?

While React Navigation 5 was complete overhaul to the API of React Navigation, React Navigation 6 keeps the same API, with some breaking changes to make things more consistent and provide more flexibility. We also tried to address some common pain points and confusions that users had.

What is createstacknavigator in react native?

Provides a way for your app to transition between screens where each new screen is placed on top of a stack. By default the stack navigator is configured to have the familiar iOS and Android look & feel: new screens slide in from the right on iOS, fade in from the bottom on Android.


1 Answers

Ive use below code to fix my issue

main.js

var React = require('react-native')
var {
  Navigator,
  StyleSheet
} = React;

var Login = require('./components/login');

import NavigationExperimental from 'react-native-deprecated-custom-components';

var ROUTES = {
  login: Login
};

module.exports = React.createClass({
  renderScene: function(route, navigator) {
    var Component = ROUTES[route.name];
    return <Component route={route} navigator={navigator} />;
  },
  render: function() {
    return (

      <NavigationExperimental.Navigator
        style={ styles.container }
        initialRoute={ {name: 'login'} }
        renderScene={this.renderScene}
        configureScene={ () => { return NavigationExperimental.Navigator.SceneConfigs.FloatFromRight; } }
      />
    );
  }
});

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

Any one let me know to solve this issue

I've change the lines

configureScene={ () => { return NavigationExperimental.Navigator.SceneConfigs.FloatFromRight; } }

To

configureScene={ () => { return NavigationExperimental.Navigator.SceneConfigs.FloatFromRight; } }

Fix my issue

like image 150
Arunkumar Avatar answered Sep 23 '22 04:09

Arunkumar