Skip to content

Commit

Permalink
Update navigation-prop.md
Browse files Browse the repository at this point in the history
It's neater with null chaining
  • Loading branch information
adamsythe committed Jul 25, 2023
1 parent 99d242d commit fc882b8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions versioned_docs/version-3.x/navigation-prop.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,7 @@ Be sure to always check that the call returns a valid value.
class UserCreateScreen extends Component {
static navigationOptions = ({ navigation }) => {
const parent = navigation.dangerouslyGetParent();
const gesturesEnabled =
parent &&
parent.state &&
parent.state.routeName === 'StackWithEnabledGestures';
const gesturesEnabled = parent?.state?.routeName === 'StackWithEnabledGestures';

return {
title: 'New User',
Expand Down

0 comments on commit fc882b8

Please sign in to comment.