【发布时间】:2018-02-23 21:02:21
【问题描述】:
我找不到这里有什么问题:https://hastebin.com/fuwofavuso.scala(我不能在这里发布,我不想缩进所有行)。
import React, { Component} from 'react';
import { Text, View, StyleSheet, Image, TextInput, AppRegistry} from 'react-native';
import { Constants, BlurView } from 'expo';
export default class App extends Component {
render() {
return (
<View style={{ height: 200, width: 300 }}>
<InputText/>
</View>
);
}
}
class InputText extends Component {
constructor(props) {
super(props);
this.state = {
text: 'lel',
};
}
render() {
return (
<div>
<TextInput
onChangeText={(text) => this.setState({ text })}
value={this.state.text}
/>
<Text value={this.state.text}></Text>
</div>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
color: '#34495e',
},
});
AppRegistry.registerComponent('Unknown Snack', () => InputText);
我的错误是:
undefined 不是评估 _reactnative.appregistry.registerComponent() 的对象
我在 Expo Snack 上运行它
【问题讨论】:
-
“不想缩进所有行” – 突出显示代码并单击一个按钮太费力了?
-
你是如何运行它的?
-
诚实的忠告;当向别人寻求帮助时,你应该付出你期望得到的回报的尽可能多的努力。您已将代码粘贴在链接后面,并且没有说明您已尝试解决此问题。所以我会给你一个同样努力的答案; “看起来您导入的 AppRegistry 组件不起作用”。
-
请上传您的完整代码,我找不到您在哪里使用
appregistry.registerComponent()。 -
@VahidBoreiri 它也不适用于...
标签: reactjs react-native