How can i access the this.props.navigation.navigate inside the static navigationOptions object?

It works inside the render method but i wanna do it in the Header top right button i.e Add link… kindly guide…

import React, {
Component
} from ‘react’;
import {
View,
Button,
Text
} from ‘react-native’;

// import { FormLabel, FormInput } from ‘react-native-elements’

class AllPropertiesScreen extends React.Component {

static navigationOptions = {
  title: 'All',
  headerRight: <Button title="Add"
  />,
};

render() {
return (

AllPropertiesScreen
AllPropertiesScreen Screen
AllPropertiesScreen Screen

      <Button
              onPress={() => this.props.navigation.navigate('createProperty', {name: 'Lucy'})}
              title="Go to CreateProperty"
        />

  </View>
);

}
}

export default AllPropertiesScreen;

//

Resolved .

static navigationOptions = ({ navigation }) => {
  const {state, setParams} = navigation;
  return {
    title: 'alll',
    headerRight: (
      <Button
        title='Add'
        // onPress={() => setParams({ mode: isInfo ? 'none' : 'info'})}
         onPress={() => navigation.navigate('create')
         }
      />
    ),
  };
};

glad you figured this out!

I appreciate your reply sir.