gpt4 book ai didi

ios - React Native - 错误 : undefined is not an object (evaluating 'require(' NativeModules'). UIManager.AndroidDrawerLayout.Constants')

转载 作者:行者123 更新时间:2023-12-01 21:48:48 25 4
gpt4 key购买 nike

我按照官方启动指南 here 遵循 React Native 的 Hello World 示例。在 XCode 上运行实际项目(未修改,未编辑文件)时,我在“红屏死机”上收到以下错误。

错误:未定义不是对象(正在评估 'require('NativeModules').UIManager.AndroidDrawerLayout.Constants')

该代码是库存标准默认代码,没有任何改动。

有什么想法吗?

谢谢!

Red Screen of Death

/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';

var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;

var HelloWorld = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
});

var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

AppRegistry.registerComponent('HelloWorld', () => HelloWorld);

最佳答案

尝试以下操作:

https://github.com/facebook/react-native/issues/8436

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
NavigatorIOS,
View
} from 'react-native';

class HelloWorld extends Component {

关于ios - React Native - 错误 : undefined is not an object (evaluating 'require(' NativeModules'). UIManager.AndroidDrawerLayout.Constants'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32824358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com