module appregistry is not a registered callable module (calling runApplication) 模块appregistry不是一个已注册的可调用模块(调用runApplication)。
module appregistry is not a registered callable module (calling runApplication) 模块appregistry不是一个已注册的可调用模块(调用runApplication)。
我完全找不到让react-navigation工作的方法。我从互联网上复制了一些可行的示例,但它们似乎也无法运行。有人可以告诉我我做错了什么吗?\n我使用的版本是:\n node: 8.9.4\n react: 16.3.0-alpha.1\n react-native: 0.54.0\n react-navigation: ^1.4.0\n这是index.js的代码:\n
import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; import { TabNavigator, StackNavigator } from 'react-navigation'; import Home from './first'; import Homes from './second'; export default class demoApp extends Component { render() { return (); } } export const SimpleNavigation = StackNavigator({ Home: { screen: Home, header: { visible: false }, navigationOptions: { title: 'Home', header: null }, }, Homes: { screen: Homes, navigationOptions: { title: 'second' }, }, },{});
\n这是first.js的代码:\n
import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image, TextInput, Button, TouchableHighlight } from 'react-native'; export default class Home extends Component { constructor(props){ super(props); this.state = {zipCode: ''} } navigate = (zipCode) => { this.props.navigation.navigate('Search', zipCode); } render() { return (); } } An application to do things this.setState({zipCode})} > this.navigate(this.state.zipCode)}> Search
\n我似乎无法使其运行。我也尝试了很多其他教程,但都没有成功。我做错了什么?
(module appregistry is not a registered callable module (calling runApplication))这个问题的出现的原因是在运行React Native应用程序时,AppRegistry模块没有正确注册。这可能是由于以下原因之一:
1. 缺少必要的配置文件或依赖项。
2. 项目结构或文件路径错误。
3. 缓存问题或代码冲突。
为了解决这个问题,可以尝试以下方法:
1. 杀死所有的Node进程并重新启动npm服务器和运行应用程序:
- 步骤1:运行命令killall -9 node
来杀死所有Node进程。
- 步骤2:运行命令npm start
来启动npm服务器。
- 步骤3:运行命令react-native run-ios
或react-native run-android
来运行应用程序。
通过执行上述步骤,可以清除任何可能导致AppRegistry模块未正确注册的问题,并重新启动应用程序。这将提供一个干净的环境,以确保AppRegistry正确运行并注册。