react navigation props not working after adding react context

357 Views Asked by At

i have used react context to use the information of different component however, after adding a context and wrapping it with the current components is blocking the navigation props and stopped displaying header component from the screen.

i have tried almost all the possible solution which i know. earlier navigation and header was visible.

Navigation:

static navigationOptions = ({ navigation }) => ({
    header: <Header headerTitle="Profile" onPress={() => navigation.goBack()} />
  })


export default withTheme(
  React.forwardRef((props, ref) => (
    <UserContext.Consumer>
      {({ updateUser }) => <UserProfileScreen {...props} updateUser={updateUser} ref={ref} />}
    </UserContext.Consumer>
  ))
)

after wrapping a component the static navigationOptions stopped working and in fact header disappeared from the app.

Everything is working fine, i am able to update the user information after react context code but unable to get the information of navigation props. i expect i can use Header component from the user profile screen and header component to be visible.

0

There are 0 best solutions below