sver
sver

Reputation: 942

Build failing while run react native project on ios simulator : Unexpected Token

I have recently started working on a react native project and this maybe a very easy thing and when I run my app on ios simulator, I get the attached issue , The code is given below

export class FCAHeader extends React.Component<any,any>  {
    constructor(props:any) {
        super(props);       
      }    
      const CustomDrawerComponent = *{props:any}=>* (
        <ScrollView>
      <SafeAreaView
        style={styles.container}
        forceInset={{ top: 'always', horizontal: 'never' }}
      >
        <DrawerNavigatorItems {...props} />
      </SafeAreaView>
    </ScrollView>
  );




  Logoutuser=async()=> {     
    try {
        await AsyncStorage.setItem('result', ''); 
        this.props.navigation.navigate('Userlogin')
    } catch (error) {
        console.log("Error resetting data" + error);
      }
    }
render() {
    return (      
        <View>
         <Header    
           leftComponent={{ icon: 'menu', color: '#fff' }}           
           centerComponent={{ text: 'FCA Chat', style: { color: '#fff' } }}
           rightComponent={ <Icon name="power" color='#fff' size={20} onPress={this.Logoutuser}/>}
           backgroundColor="#130f40"
         />             
      </View>

        )
}

}

The issue coming is: Syntax error "unexpected Token" and pointing towards props.any.

Upvotes: 0

Views: 111

Answers (1)

emeraldsanto
emeraldsanto

Reputation: 4731

This is a little syntax error, { props : any } should instead be (props : any).

Upvotes: 1

Related Questions