英文:
receiving Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). after implementing redux into my app
问题
收到这个错误。不变违例:
无法调用 JavaScript 模块方法
AppRegistry.runApplication()。模块尚未注册为
可调用。已注册可调用的 JavaScript 模块(n = 11):Systrace、
JSTimers、HeapCapture、SamplingProfiler、RCTLog、
RCTDeviceEventEmitter、RCTNativeAppEventEmitter、
GlobalPerformanceLogger、JSDevSupportModule、HMRClient、
RCTEventEmitter。
错误的一个常见原因是应用程序入口文件路径不正确。当 JS 捆绑包损坏或在加载 React Native 时出现早期初始化错误时,也会发生这种情况。
在实施 Redux 后出现了这个错误。Redux 正常工作,没有进行任何更改,突然之间我运行应用程序就出现了这个错误。
import {createStackNavigator} from '@react-navigation/stack';
import Home from './Screens/Home';
import PrEnteryScreen from './Screens/PrEnteryScreen';
import LogBookScreen from './Screens/LogBookScreen';
import AuthScreen from './Screens/AuthScreen';
import SelectExerciseModal from './Screens/SelectExerciseModal';
import RegisterModalScreen from './Screens/RegisterModalScreen';
import ExerciseInformationScreen from './Screens/ExerciseInformation';
import {AppRegistry} from 'react-native';
const MainStack = createStackNavigator();
const App = () => {
return (
<NavigationContainer>
<MainStack.Navigator
screenOptions={{ headerShown: false }}
initialRouteName='AuthScreen'
>
<MainStack.Group>
<MainStack.Screen name="AuthScreen" component={AuthScreen} />
<MainStack.Screen name="Home" component={Home} />
<MainStack.Screen name="PrEnteryScreen" component={PrEnteryScreen} />
<MainStack.Screen name="LogBookScreen" component={LogBookScreen} />
<MainStack.Screen
name="ExerciseInformationScreen"
component={ExerciseInformationScreen}
/>
</MainStack.Group>
<MainStack.Group screenOptions={{ presentation: 'modal' }}>
<MainStack.Screen name="RegisterModalScreen" component={RegisterModalScreen} />
<MainStack.Screen name="SelectExerciseModal" component={SelectExerciseModal} />
</MainStack.Group>
</MainStack.Navigator>
</NavigationContainer>
);
}
AppRegistry.registerComponent('PrApp', () => App);
export default App;
我添加了 AppRegistry.registerComponent('PrApp', () => App);
来尝试解决问题,但它不起作用。当我从实施 Redux 之前重新启动应用程序时,应用程序可以正常工作。
英文:
Receiving this error. Invariant Violation:
> Failed to call into JavaScript module method
> AppRegistry.runApplication(). Module has not been registered as
> callable. Registered callable JavaScript modules (n = 11): Systrace,
> JSTimers, HeapCapture, SamplingProfiler, RCTLog,
> RCTDeviceEventEmitter, RCTNativeAppEventEmitter,
> GlobalPerformanceLogger, JSDevSupportModule, HMRClient,
> RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
This error came about after implementing redux. Redux was working, nothing was changed and then all the sudden I ran the app and this error appeared.
import {createStackNavigator } from '@react-navigation/stack';
import Home from './Screens/Home';
import PrEnteryScreen from './Screens/PrEnteryScreen'
import LogBookScreen from './Screens/LogBookScreen';
import AuthScreen from './Screens/AuthScreen';
import SelectExerciseModal from './Screens/SelectExerciseModal';
import RegisterModalScreen from './Screens/RegisterModalScreen';
import ExerciseInformationScreen from './Screens/ExerciseInformation';
import { AppRegistry} from 'react-native';
const MainStack = createStackNavigator();
const App = () => {
return (
<NavigationContainer
>
<MainStack.Navigator
screenOptions={{headerShown: false}}
initialRouteName='AuthScreen'
>
<MainStack.Group>
<MainStack.Screen name = "AuthScreen" component={AuthScreen}/>
<MainStack.Screen name = "Home" component={Home}/>
<MainStack.Screen name = "PrEnteryScreen" component = {PrEnteryScreen}/>
<MainStack.Screen name = "LogBookScreen" component={LogBookScreen}/>
<MainStack.Screen name = "ExerciseInformationScreen" component={ExerciseInformationScreen}/>
</MainStack.Group>
<MainStack.Group screenOptions={{presentation: 'modal'}}>
<MainStack.Screen name ="RegisterModalScreen" component={RegisterModalScreen}/>
<MainStack.Screen name ="SelectExerciseModal" component={SelectExerciseModal} />
</MainStack.Group>
</MainStack.Navigator>
</NavigationContainer>
);
}
AppRegistry.registerComponent('PrApp', () => App);
export default App;
I added AppRegistry.registerComponent('PrApp', () => App);
to try and solve the problem but it doesn't work. When I restart from before implementing redux the app works.
答案1
得分: 1
在最新的React Native版本(大于0.70)中,有许多变化,似乎有一些包不受支持。只需将React Native降级到>0.69,直到他们修复它。
英文:
In the latest react native version (greater than 0.70). there are many changes and it seems some packages are not supported. just downgrade react native to >0.69
until they fix it .
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论