I'm stuck in adding save method inside navigationOptions
can you please help me to do right way.
static navigationOptions = ({navigation}) => ({
headerTitle: "Add New Item",
...css.header,
headerRight: <NavViewRight
onPress={() => this.rightHeaderAction()} />,
})
Actually it's not clear what exactly you try to do. But seems like you want to call a non-static method inside class from static method.
You referring to this
, but this
here not means class instance. In order to call something from your class you need to make method static.
Something like this:
class MyScreen extends Component {
static navigationOptions = ({
navigation
}) => ({
headerTitle: "Add New Item",
...css.header,
headerRight: < NavViewRight
onPress = {
() => MyScreen.rightHeaderAction()
}
/>,
})
static rightHeaderAction() {
// your code here
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With