意外令牌,预期;

时间:2018-07-28 21:11:17

标签: ios reactjs react-native

我不断收到错误消息:

  

“意外令牌,预期为”,(101:93)

两个小时以来,我一直在浏览代码的每一行,无法解决这个问题。

运行完全正常,当我退出应用程序(因为应用程序被冻结)并再次运行项目(react-native run-ios)时,它抛出了此错误。

这是我的代码。由于我是一个完整的初学者,请原谅样式/组织。另外-还有很多我没用过的样式。

  import React, {Component} from 'react'
  import {StyleSheet, Text, View, Image, TouchableWithoutFeedback, StatusBar, TextInput, SafeAreaView, Keyboard, TouchableOpacity, KeyboardAvoidingView} from 'react-native'
  import {createStackNavigator} from 'react-navigation'
  import LinearGradient from 'react-native-linear-gradient'


     export default class MainScreen extends Component {

constructor(props) {
    super(props);
    this.state={
        username: '', 
        email: '',
        name: '',
        password: '',
        User: this.props.navigation.state.params.username,
        Email: this.props.navigation.state.params.email,
        Name: this.props.navigation.state.params.name,
        Password: this.props.navigation.state.params.password   
    }
}

render() {
    const { navigation } = this.props;
    const {state} = this.props.navigation;

    return(

        <SafeAreaView style={styles.container} >
        <StatusBar barStyle="light-content"/>
            <View style = {styles.container}>
                <View style = {styles.topContainer}>
                    <TouchableOpacity onPress={() => navigation.navigate('Help')}>
                        <Image style = {styles.questionMark} 
                            source ={require('../images/questionWhite.png')}>
                        </Image>
                    </TouchableOpacity>
                    <View style={styles.logoContainer}>
                        <Image style = {styles.logo} 
                            source ={require('../images/white.png')}>
                        </Image>
                        <Image style = {styles.logoTwo} 
                            source ={require('../images/whitetext.png')}>
                        </Image>

                    </View>
                </View> 

                <View style={styles.middleContainer}>
                        <View style={styles.textContainer}>
                            <Text style={styles.textStyle}>
                                Earn points
                            </Text>
                            <Text style={styles.lowerTextStyle}>
                                for recommending
                            </Text>
                        </View>
                        <View style={styles.exclusiveButtonContainer}> 
                            <TouchableOpacity onPress={() => navigation.navigate('PurchaseScreenOne')}>
                        <View style = {{backgroundColor: 'white', alignItems: 'center', justifyContent: 'center', borderRadius: 30, height: 50, width: 330, marginLeft: 0, marginTop:35}}>
                                <Text style = {styles.exclusiveButton}>Get Deals </Text>
                            </View>
                            </TouchableOpacity> 

                            <Image style = {styles.templateLayout} 
                                source ={require('../images/template.png')}>
                            </Image>

                            <Image style = {{marginTop: -210, marginLeft: 0, height: 81, width: 81}} 
                            source = {{uri: 'https://imagesource.com/8346278432'}}/>

                            <TouchableOpacity onPress={() => navigation.navigate('Edit', {username: this.state.User, email: this.state.Email, name: this.state.Name, password: this.state.Password})}>


                            <Image style = {{marginTop: -90, marginLeft: 300, height: 41, width: 41}} 
                                source ={require('../images/editProfile.png')}>
                            </Image>
                            </TouchableOpacity>


                            <TextInput style={{fontWeight: '700', fontSize: 22, marginTop: 5, color: '#d0011b'}} value={this.state.User}/>

                        <Text style={{fontWeight: '700', fontSize: 22, marginTop: 40, color: '#d0011b', marginLeft: 180}}>
                        0
                        </Text>
                        <Text style={{fontWeight: '700', fontSize: 22, marginTop: 5, color: '#d0011b', marginTop: -30, marginRight: 180}}>
                        $0
                        </Text>

                            <View style={{flexDirection: 'row', marginTop: 30, marginBottom: 90}}>
                                <TouchableOpacity onPress={() => navigation.navigate('History')}>

                                    <View style = {{backgroundColor: 'white', alignItems: 'center', justifyContent: 'center', borderRadius: 30, height: 50, width: 171, marginLeft: 0, marginBottom: 15}}>
                                            <Text style = {styles.loginButton}>View Purchases</Text>
                                    </View>
                                </TouchableOpacity> 

                                <TouchableOpacity onPress={() => navigation.navigate('GetFreeMoney', {username: this.state.User})}>
                                        <View style = {{backgroundColor: 'white', alignItems: 'center', justifyContent: 'center', borderRadius: 30, height: 50, width: 171, marginLeft: 10}}>
                                            <Text style = {styles.loginButton}>Invite Friends</Text>
                                        </View>
                                    </TouchableOpacity> 
                            </View>

                        </View>
                </View> 
        </View>
    </SafeAreaView>
    )   
}
}


 const styles = StyleSheet.create({ 
      container: {
        flex: 1,
        backgroundColor: '#D0011B', 
        flexDirection: 'column'
   },

topContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 90,
    flex: 1 
},

logo: {
    width: 168,
    height: 61,
    resizeMode: 'contain'
},

logoTwo: {
    width: 238,
    height: 39,
    resizeMode: 'contain'
},

logoContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 90
},

questionMark: {
    width: 37,
    height: 37,
    resizeMode: 'contain',
    marginLeft: 320,
    marginBottom: 50,
    marginTop: -20
},

textStyle: {
    color: 'white',
    fontSize: 20,
    width: 186,
    height: 27,
    alignItems: 'center',
    justifyContent: 'center'
},
lowerTextStyle: {
    color: 'white',
    fontSize: 20,
    width: 244,
    height: 27,
    alignItems: 'center',
    justifyContent: 'center',
},
textContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginBottom: 20
},
exclusiveButtonContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginBottom: 200   
},
exclusiveButton: {
    width: 311,
    height: 50,
    alignItems: 'center',
    justifyContent: 'center',
    resizeMode: 'contain',
},
middleContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 200
},
textTemplateFormat: {
    color: '#D0011B',
    fontSize: 22,
    fontWeight: 'bold'
},
profileTemplateContainer: {
    marginLeft: 13,
    width: 351,
    height: 209,
    alignItems: 'center',
    justifyContent: 'center',
    resizeMode: 'contain',
    marginTop: -280
},
displayPictureStyle: {
    marginLeft: 13,
    alignItems: 'center',
    justifyContent: 'center',
    resizeMode: 'contain',
    marginTop: -200
},

lowerContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    marginBottom: 1000,
    marginLeft: -10
},
groundContainer: {
    alignItems: 'center',
    justifyContent: 'center',
},
textTemplateFormat: {
    alignItems: 'center',
    justifyContent: 'center',
    flex: 1,
    marginTop: -110,
    fontSize: 20,
    fontWeight: 'bold',
    marginLeft: 15,
    color: '#D0011B'    
},

savingsStyle: {
    width: 120,
    height: 20,
    alignItems: 'center',
    justifyContent: 'center',
    marginRight: 160,
    marginBottom: 200
},

buttonContainer: {
    alignItems: 'center',
    justifyContent: 'center'
},
templateLayout: {
    width: 370,
    height: 230,
    resizeMode: 'contain',
    marginTop: 20
},
loginButton: {
    fontSize: 16,
    fontWeight: "700",
    textAlign: "center",
    color: '#d0011b'
},
exclusiveButton: {
    fontSize: 22,
    fontWeight: "700",
    textAlign: "center",
    color: '#d0011b'
}


   })

请注意,我已经删除了主要的代码区域,并且错误仍然显示在同一行位置,这让我认为这是某种故障?

0 个答案:

没有答案