Skip to content

Commit

Permalink
add onAppear callback
Browse files Browse the repository at this point in the history
  • Loading branch information
osdnk committed Jan 9, 2020
1 parent ecc4056 commit cef9b8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions createNativeStackNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class StackView extends React.Component {
this.props.navigation.dispatch(StackActions.pop({ key: route.key }));
};

_onSceneFocus = route => {
_onSceneFocus = (route, descriptor) => {
descriptor.options && descriptor.options.onAppear && descriptor.options.onAppear()
this.props.navigation.dispatch(
StackActions.completeTransition({ toChildKey: route.key })
);
Expand Down Expand Up @@ -190,7 +191,7 @@ class StackView extends React.Component {
style={options.cardStyle}
stackAnimation={stackAnimation}
stackPresentation={stackPresentation}
onAppear={() => this._onSceneFocus(route)}
onAppear={() => this._onSceneFocus(route, descriptor)}
onDismissed={() => this._removeScene(route)}>
{this._renderHeaderConfig(index, route, descriptor)}
<SceneView
Expand Down

0 comments on commit cef9b8f

Please sign in to comment.