【React Native】React Native之Navigator has been remove from this package...的问题

  前些天在对之前创建的RN项目使用navigator的时候,发现一个错误:Navigator is deprecated and has been removed from this package. It can now be installed and import from ‘react-native-deprecated-custom-components’ instead of ‘react-native’.截图如下:
  
  【React Native】React Native之Navigator has been remove from this package...的问题

  根据信息,react-native这个包中的Navigator已经被移除,而需要导入react-native-deprecated-custom-components这个包来使用Navigator。于是就需要安装这个包并引入。具体做法如下:
  
1. 通过npm安装相应的库
  在项目根目录下通过git命令框输入npm i react-native-deprecated-custom-components –save 回车。
  【React Native】React Native之Navigator has been remove from this package...的问题
  (例如,我的项目名称就是NaviTest,在这个目录下输入)
  
2. 在使用的JS文件中将Navigator引入进来,就是import
  import {Navigator} from ‘react-native-deprecated-custom-components’;

然后就可以在项目中正确使用Navigator了。