【发布时间】:2020-09-13 10:26:07
【问题描述】:
错误:
ESLint: App.js (22:21) Parsing error: Unexpected token, expected ";"
20 | export default function App() {
21 |
> 22 | constructor(props){
| ^
23 | super(props)
24 |
25 | this.state = ({ (null)
代码:
import React from 'react';
import { StyleSheet, Image, Text, View } from 'react-native';
import { Container, Content, Header, Form, Input, Item, Button, Label, } from 'native-base';
import * as firebase from 'firebase';
var firebaseConfig = {
apiKey: "AIzaSyB387ecmvoIcHvboydLrxL_vwBJqWHhXGw",
authDomain: "shootgeorgiaapp.firebaseapp.com",
databaseURL: "https://shootgeorgiaapp.firebaseio.com",
projectId: "shootgeorgiaapp",
storageBucket: "shootgeorgiaapp.appspot.com"
};
if (!firebase.apps.length){
firebase.initializeApp(firebaseConfig);
}
export default function App() {
constructor(props){
super(props)
this.state = ({
email:'',
password:''
})
}
signUpUser = (email,password) =>{
try{
if(this.state.password.length<6){
alert("გთხოვთ მიუთთოთ 6-ზე მეტ ციფრიანი პაროლი")
return;
}
firebase.auth().createUserWithEmailAndPassword(email,password)
}
catch(error){
console.log(error.toString())
}
}
logInUser = (email,password) =>{
}
return (
<Container style={styles.container}>
<Form>
<Image
style={{height:170 , width:170, alignItems: 'center',}}
source={require('./img/logo.png')}
/>
<Item floatingLabel>
<Label>Email</Label>
<Input
autoCorrect={false}
autoCapitalize="none"
onChangeText={(email) => this.setState({email})}
/>
</Item>
<Item floatingLabel>
<Label>Password</Label>
<Input
secureTextEntry={true}
autoCorrect={false}
autoCapitalize="none"
onChangeText={(password) => this.setState({password})}
/>
</Item>
<Button style={{marginTop:10} }
full
rounded
success
onPress={() => this.logInUser(this.state.email,this.state.password)}
>
<Text style={{color:'white'}}>Log in</Text>
</Button>
<Button style={{marginTop:10} }
full
rounded
primary
onPress={() => this.signUpUser(this.state.email,this.state.password)}
>
<Text style={{color:'white'}}>Sign in</Text>
</Button>
</Form>
</Container>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
justifyContent: 'center',
padding: 10,
},
});
我尝试了数千种方法,但没有任何效果。
【问题讨论】:
标签: android react-native expo