0

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

after doing that it says, cannot find scrollview!! :(
Have you imported it?
That was the issue. I did and error was gone. I have just started working on react-native so such silly doubt. lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.