react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

Navigator is deprecated in RN 0.44.0 and not working

Open amirrezamahyari opened this issue 9 years ago • 56 comments

after upgrade react native to 0.44.0 i get this error :

i use react-navigation 1.0.0-beta.9 package and i got BackAndroid deprecated too .

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

how can i fix this ?

software version
react-navigation 1.0.0-beta.9
react-native 0.44.0
node 7.9.0
npm or yarn 4.2.0

amirrezamahyari avatar May 01 '17 11:05 amirrezamahyari

As error message indicates, you should install react-native-deprecated-custom-components and import NavigationExperimental from there.

grabbou avatar May 01 '17 12:05 grabbou

@grabbou but i think you closed immediatly without any define a correct solution . as i see in the relative module codes there is a dependency in react-navigation for Navigate component yet . so i think this issue must be reopened till solve this problem .

amirrezamahyari avatar May 01 '17 12:05 amirrezamahyari

There's no issue to be solved. Navigation experimental has been removed from React Native and moved to a separate package that I've listed above. You should slowly upgrade your code to use a new navigation library, like this one. Before that happens, you can keep on using Navigation Experimental from the above package.

grabbou avatar May 01 '17 12:05 grabbou

hi,grabbou,i read your tips and installed react-native-deprecated-custom-components,and import Navigator from 'react-native-deprecated-custom-components' ,but an error occured,it said that Element type is invild:excepted a string or a class/function but got: object; and i just has an Navigator in there ,so can you help me with that? Thanks!

muxiaodeng avatar May 04 '17 13:05 muxiaodeng

@muxiaodeng I think you should import NavigationExperimental and not Navigator: import {NavigationExperimental} from 'react-native-deprecated-custom-components';

ashish-algorythma avatar May 04 '17 13:05 ashish-algorythma

@ashish-algorythma thanks,but it didn't work,still say Element type is invalid;

muxiaodeng avatar May 05 '17 01:05 muxiaodeng

I have the same problem

Juxtlie avatar May 05 '17 13:05 Juxtlie

@amirrezamahyari Do you have resolve?

Juxtlie avatar May 05 '17 13:05 Juxtlie

Fixed with: import NavigationExperimental from 'react-native-deprecated-custom-components';

Use with: <NavigationExperimental.Navigator

davidck avatar May 05 '17 21:05 davidck

I fixed it with code

import {
} from 'react-native';
import Movies from './Movies';

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

const RouteMapper = (route, navigator) => {
  if (route.name === 'movies') {
    return <Movies navigator={navigator} />;
  }
};

export default class App extends Component {
  render() {
    return (
      <NavigationExperimental.Navigator
        // Default to movies route
        initialRoute={{ name: 'movies' }}
        // Use FloatFromBottom transition between screens
        configureScene={(route, routeStack) => NavigationExperimental.Navigator.SceneConfigs.FloatFromBottom}
        // Pass a route mapper functions
        renderScene={RouteMapper}
      />
    );
  }
}

nvs2394 avatar May 06 '17 10:05 nvs2394

Why was React Navigator deprecated?

rexjrs avatar May 07 '17 18:05 rexjrs

@rexjrs Because in last version it don't use Navigator in react-native . It switch to use react-native-deprecated-custom-components. You can see notied when running app.

nvs2394 avatar May 08 '17 04:05 nvs2394

No. My question is, what was the reason behind deprecating the Navigator component? Was it bad, were there much better alternatives? etc.

rexjrs avatar May 08 '17 04:05 rexjrs

Hey Chaps I am using import { StackNavigator } from 'react-navigation'; and I am getting the same error. The solution on here will not work since it is the newest version of react-navigation which needs to be fixed in order for react-native to work. Does anyone know when react-navigation be upgraded to use non deprecated modules?

peterheard01 avatar May 08 '17 04:05 peterheard01

@saeedtabrizi see this issue

amirrezamahyari avatar May 08 '17 07:05 amirrezamahyari

@amirrezamahyari HAZA MEN FAZLE RABBI, thanks a lot .

@peterheard01 , @rexjrs for the solve this problem we commented Navigation component in react native folder in node_modules :) only deprecated message is root of this problem so when we remove Navigation component from react , that working as well as my car :)

saeedtabrizi avatar May 08 '17 07:05 saeedtabrizi

@saeedtabrizi can you clearly explain what you mean by comment in react native folder in node modules? How can I do this.

rexjrs avatar May 08 '17 17:05 rexjrs

@saeedtabrizi thanks MOHANDES @rexjrs ok , i comment this lines and its already ok: node_modules/react-native/Libraries/react-native/react-native-implementation.js line 129 screen shot 2017-05-09 at 9 25 16 am

amirrezamahyari avatar May 09 '17 04:05 amirrezamahyari

Thank you very much!

rexjrs avatar May 09 '17 04:05 rexjrs

@davidck Did you need to pull in something from NPM too? I get a 500 error when i use react-native-deprecated-custom-components. Thanks.

prateekvarma avatar May 09 '17 19:05 prateekvarma