Skip to content

Commit

Permalink
[Exp] Fix nav bar hit test for hidden components
Browse files Browse the repository at this point in the history
  • Loading branch information
terribleben authored and skevy committed Mar 24, 2016
1 parent 2d68ae7 commit ce5c744
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Libraries/CustomComponents/Navigator/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ var Navigator = React.createClass({
if (AnimationsDebugModule) {
AnimationsDebugModule.stopRecordingFps(Date.now());
}
this._navBar && this._navBar.updatePointerEvents &&
this._navBar.updatePointerEvents(this.state.transitionFromIndex, this.state.presentedIndex);
this.state.transitionFromIndex = null;
this.spring.setCurrentValue(0).setAtRest();
this._hideScenes();
Expand Down
17 changes: 16 additions & 1 deletion Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ var NavigatorNavigationBar = React.createClass({
ref={(ref) => {
this._components[componentName] = this._components[componentName].set(route, ref);
}}
pointerEvents="box-none"
pointerEvents={
route === this.props.navigator.navigationContext.currentRoute ? 'box-none' : 'none'
}
style={initialStage[componentName]}>
{content}
</View>
Expand All @@ -221,6 +223,19 @@ var NavigatorNavigationBar = React.createClass({
return rendered;
},

updatePointerEvents: function(fromIndex, toIndex) {
var routeFrom = this.props.navState.routeStack[fromIndex];
var routeTo = this.props.navState.routeStack[toIndex];

COMPONENT_NAMES.forEach(function (componentName) {
var map = this._components[componentName];
var componentFrom = map.get(routeFrom);
var componentTo = map.get(routeTo);
componentFrom && componentFrom.setNativeProps({ pointerEvents:'none' });
componentTo && componentTo.setNativeProps({ pointerEvents:'box-none' });
}, this);
},

});


Expand Down

0 comments on commit ce5c744

Please sign in to comment.