redux React Native - Expo更新导致main没有注册并尝试注册两个同名错误

h9vpoimq  于 2022-11-12  发布在  React
关注(0)|答案(1)|浏览(250)

我最近尝试将我的React原生应用程序从expo 44更新到46,但它导致错误
这是我的App.js

import React from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import ReduxThunk from 'redux-thunk';
import reducers from './src/reducers';
import Router from './src/Router';

export default class App extends React.Component {

  render() {
    const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
    return (
      <Provider store={store}>
        <Router />
      </Provider>
    );
  }
}

我得到的错误是:

Invariant Violation: Tried to register two views with the same name RNGestureHandlerButton
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:

* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

请找到我的github link

x4shl7ld

x4shl7ld1#

我相信世博会的文件对此并不清楚:不要安装react-native-gesture-handler,它已经存在于Expo中。

  • 如果您使用Expo构建react native应用,则不必从npm或yarn导入react-native-gesture-handler。它已在expo包中。如果导入该包,则会遇到此错误。*

此外,你可以在github上检查错误,而不是直接发布问题:https://github.com/software-mansion/react-native-gesture-handler/issues/451

相关问题