使用React导航面对错误'RNGestureHandlerModule.State'

时间:2018-12-08 05:41:44

标签: react-native react-navigation

我是新来的本地人。在实施反应导航时,我面临一个奇怪的问题。我在iOS模拟器上收到错误消息,“未定义不是一个对象(正在评估'RNGestureHandlerModule.State')。在我的应用程序中无处使用手势识别器。

export default class App extends Component {
  render() {
    return (
      createStackNavigator({
        Home: {screen: HomeScreen},
      })
    )
    }
}

HomeScreen是一个简单的类:

export default class HomeScreen extends Component {
    render() {
        return(
            <View>
                <Text style={{marginTop: 80}}>Thi sis test</Text>
            </View>
        );
    }
}

我正在使用本机CLI。在安装反应导航时,我会收到一些警告

ankur:MyGithub ankurprakash$ cd /Volumes/Glen/MyGithub/navigationSample 
ankur:navigationSample ankurprakash$ npm install --save react-navigation@latest
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/sane as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/sane
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/uuid as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/uuid
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/json5 as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/json5
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/jsesc as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/jsesc
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/jest as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/jest-cli
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/esparse as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/esprima
npm WARN rm not removing /Volumes/Glen/MyGithub/navigationSample/node_modules/.bin/esvalidate as it wasn't installed by /Volumes/Glen/MyGithub/navigationSample/node_modules/esprima

1 个答案:

答案 0 :(得分:2)

尝试一次:

  1. 删除node_modules和package-lock.json
  2. npm安装
  3. npm install-保存反应导航
  4. npm install-保存react-native-gesture-handler
  5. 本机链接