Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- import {
- View,
- Button
- } from 'react-native'
- class MyScreen extends React.Component {
- static navigationOptions = ({ navigation }) => {
- const { state } = navigation
- return {
- headerTitle: 'New Task',
- headerRight: <Button title="Save" onPress={() => state.params.handleSave()} />,
- }
- }
- saveDetails() {
- alert('saved')
- }
- componentDidMount() {
- this.props.navigation.setParams({ handleSave: () => this.saveDetails() })
- }
- render() {
- return (
- <View />
- )
- }
- }
Add Comment
Please, Sign In to add comment