Skip to content

Commit bafc506

Browse files
corbtFacebook Github Bot 1
authored andcommitted
Ignore Navigator touch events for background buttons
Summary:Currently, if the Navigator with the default `NavigatorNavigationBar` has two scenes on its `routeStack` and the bottom one defines a `RightButton` but the top one doesn't, a touch to the location of the underlying `RightButton` will trigger its action. This fix checks if the button's opacity is set to 0 (indicating it has been transitioned off the scene and shouldn't be interacted with) and ignores touch events if so. Closes #5624 Differential Revision: D3139553 fb-gh-sync-id: 6d6da1459e289499b6d8769120a3b6114548c090 fbshipit-source-id: 6d6da1459e289499b6d8769120a3b6114548c090
1 parent 05a852a commit bafc506

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ var NavigatorNavigationBar = React.createClass({
145145
var component = this._components[componentName].get(this.props.navState.routeStack[index]);
146146
var props = this._getReusableProps(componentName, index);
147147
if (component && interpolate[componentName](props.style, amount)) {
148+
props.pointerEvents = props.style.opacity === 0 ? 'none' : 'box-none';
148149
component.setNativeProps(props);
149150
}
150151
}, this);
@@ -203,15 +204,16 @@ var NavigatorNavigationBar = React.createClass({
203204
return null;
204205
}
205206

206-
var initialStage = index === navStatePresentedIndex(this.props.navState) ?
207+
var componentIsActive = index === navStatePresentedIndex(this.props.navState);
208+
var initialStage = componentIsActive ?
207209
this.props.navigationStyles.Stages.Center :
208210
this.props.navigationStyles.Stages.Left;
209211
rendered = (
210212
<View
211213
ref={(ref) => {
212214
this._components[componentName] = this._components[componentName].set(route, ref);
213215
}}
214-
pointerEvents="box-none"
216+
pointerEvents={componentIsActive ? 'box-none' : 'none'}
215217
style={initialStage[componentName]}>
216218
{content}
217219
</View>

0 commit comments

Comments
 (0)