I'm trying to implement a deletePost button, but I'm struggling to pass it into my header component. Here's the
export class PostScreen extends Component {
// Custom headerTitle component.
static navigationOptions = ({ navigation }) => {
const { params } = navigation.state;
return { headerTitle: <PostTitle {...params} handleDelete={this.handleDelete}/> }
};
handleDelete = async (id) => {
const { deletePost } = this.props;
const token = await AsyncStorage.getItem('token');
deletePost(token, id);
}
render() {
This does'nt seem to be the right way to pass it in. What's the correct way? I can't find anything in the docs.
react-native-navigationand notreact-navigation?react-navigation