Skip to content

withContext doesn't pass static properties forward #1

@ghmendonca

Description

@ghmendonca

I am developing an app with React Native v0.54 and I am using React Navigation for the router. When I try to render a screen that is wrapped with my consumer, for some reason the wrapper don't pass the necessary data for the router and this breaks alot of features that I need, for example the title of my screen and the DrawerMenu title of this screen.

This happens only when I wrap my screen with my consumer using the decorator or exporting the function.

Any idea why or can you fix it?

This code doesn't work:

@ProdutoConsumer
export default class Notificacoes extends React.Component {
  static navigationOptions = {
    title: "Notificações"
  }

  render(){
    return(
      <View>
        <Text>Notificações</Text>
      </View>
    )
  }
}

This works:

export default class Notificacoes extends React.Component {
  static navigationOptions = {
    title: "Notificações"
  }

  render(){
    return(
      <View>
        <Text>Notificações</Text>
      </View>
    )
  }
}

EDIT: Testing a little more, I think the problem is that withContext is not passing static properties forward, but I don't know how to fix it neither a workaround yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions