noa*_*dev 18 ecmascript-6 reactjs react-native
我已经看到类似的问题,但我似乎无法识别问题.我正在使用react native v 0.27我已将所有需要的方法更改为导入.
这是我收到的错误:
我不知道它是否相关,但错误的第一个位置指向我的LoginComp.js文件,其中包含以下代码:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
TouchableHighlight
} from 'react-native';
class LoginComp extends Component {
constructor(){
super(props);
}
render() {
return (
<View style={{flex: 1}}>
<View style={this.props.styles.loginLogoContainer}>
<Image style={this.props.styles.view1logo} source={require('../imgs/Logo.png')} />
</View>
<View style={this.props.styles.loginContainer}>
<Text>U?ytkownik:</Text>
<TextInput
style={this.props.styles.defaultInput}
placeholder="U?ytkownik"
stretch={true}
autoComplete={false}
autoCorrect={false}
/>
<Text>Has?o:</Text>
<TextInput
style={this.props.styles.defaultInput}
placeholder="Has?o"
stretch={true}
autoComplete={false}
autoCorrect={false}
secureTextEntry={true}
/>
<TouchableHighlight onPress={this.props.LoginPress}>
<Text style={this.props.styles.loginButton}>Login</Text>
</TouchableHighlight>
</View>
<View style={this.props.styles.registrationWrapper}>
<Text>- lub -</Text>
<TouchableHighlight onPress={this.props.t_Registration}>
<Text style={this.props.styles.registration}>Za?ó? nowe konto</Text>
</TouchableHighlight>
</View>
</View>
);
}
}
module.exports = LoginComp;
Run Code Online (Sandbox Code Playgroud)
Jic*_*son 51
像下面一样更改您的import语句并尝试.
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
TouchableHighlight,
} from 'react-native';
Run Code Online (Sandbox Code Playgroud)
构造函数也应如下所示
constructor(props){
super(props);
}
Run Code Online (Sandbox Code Playgroud)
akh*_*ier 12
我遇到了同样的问题.错误导入
import React, { Component } from "react-native";
Run Code Online (Sandbox Code Playgroud)
代替
import React, { Component } from "react";
Run Code Online (Sandbox Code Playgroud)
看到这个答案/sf/answers/2637365251/
我在尝试使用时遇到此错误:
class Leaderboard extends React.component {
}
Run Code Online (Sandbox Code Playgroud)
它应该是带有大写C的组件!
归档时间: |
|
查看次数: |
24595 次 |
最近记录: |