diff --git a/Libraries/Components/ScrollResponder.js b/Libraries/Components/ScrollResponder.js index 3374cf22d53ed0..84a67c76763dfd 100644 --- a/Libraries/Components/ScrollResponder.js +++ b/Libraries/Components/ScrollResponder.js @@ -388,12 +388,13 @@ var ScrollResponderMixin = { /** * A helper function to zoom to a specific rect in the scrollview. * @param {object} rect Should have shape {x, y, width, height} + * @param {bool} animated Enable the zoom animation */ - scrollResponderZoomTo: function(rect: { x: number; y: number; width: number; height: number; }) { + scrollResponderZoomTo: function(rect: { x: number; y: number; width: number; height: number; }, animated?: boolean = true) { if (Platform.OS === 'android') { invariant('zoomToRect is not implemented'); } else { - ScrollViewManager.zoomToRect(React.findNodeHandle(this), rect); + ScrollViewManager.zoomToRect(React.findNodeHandle(this), rect, animated); } }, diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index 22bb84365235ff..576be1b2b527ab 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -292,7 +292,7 @@ var Navigator = React.createClass({ } return { sceneConfigStack: routeStack.map( - (route) => this.props.configureScene(route) + (route) => this.props.configureScene(route, routeStack) ), routeStack, presentedIndex: initialRouteIndex, @@ -367,7 +367,7 @@ var Navigator = React.createClass({ this.setState({ routeStack: nextRouteStack, sceneConfigStack: nextRouteStack.map( - this.props.configureScene + route => this.props.configureScene(route, nextRouteStack) ), presentedIndex: destIndex, activeGesture: null, @@ -911,7 +911,7 @@ var Navigator = React.createClass({ var nextStack = activeStack.concat([route]); var destIndex = nextStack.length - 1; var nextAnimationConfigStack = activeAnimationConfigStack.concat([ - this.props.configureScene(route), + this.props.configureScene(route, nextStack), ]); this._emitWillFocus(nextStack[destIndex]); this.setState({ @@ -979,7 +979,7 @@ var Navigator = React.createClass({ var nextRouteStack = this.state.routeStack.slice(); var nextAnimationModeStack = this.state.sceneConfigStack.slice(); nextRouteStack[index] = route; - nextAnimationModeStack[index] = this.props.configureScene(route); + nextAnimationModeStack[index] = this.props.configureScene(route, nextRouteStack); if (index === this.state.presentedIndex) { this._emitWillFocus(route); @@ -1083,13 +1083,16 @@ var Navigator = React.createClass({ }, _renderNavigationBar: function() { - if (!this.props.navigationBar) { + let { navigationBar } = this.props; + if (!navigationBar) { return null; } - return React.cloneElement(this.props.navigationBar, { + return React.cloneElement(navigationBar, { ref: (navBar) => { - this.props.navigationBar.ref instanceof Function && this.props.navigationBar.ref(navBar); this._navBar = navBar; + if (navigationBar && typeof navigationBar.ref === 'function') { + navigationBar.ref(navBar); + } }, navigator: this._navigationBarNavigator, navState: this.state, diff --git a/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js b/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js index b6fbcdc378e572..a5be41abf2d4e0 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js +++ b/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js @@ -195,6 +195,7 @@ var NavigatorNavigationBar = React.createClass({ ref={(ref) => { this._components[componentName] = this._components[componentName].set(route, ref); }} + pointerEvents="box-none" style={initialStage[componentName]}> {content} diff --git a/React/Views/RCTScrollViewManager.m b/React/Views/RCTScrollViewManager.m index 702b75043944d3..07f2e87335062f 100644 --- a/React/Views/RCTScrollViewManager.m +++ b/React/Views/RCTScrollViewManager.m @@ -152,12 +152,12 @@ - (UIView *)view }]; } -RCT_EXPORT_METHOD(zoomToRect:(nonnull NSNumber *)reactTag withRect:(CGRect)rect) +RCT_EXPORT_METHOD(zoomToRect:(nonnull NSNumber *)reactTag withRect:(CGRect)rect withAnimated:(BOOL)animated) { [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ UIView *view = viewRegistry[reactTag]; if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { - [(id)view zoomToRect:rect animated:YES]; + [(id)view zoomToRect:rect animated:animated]; } else { RCTLogError(@"tried to zoomToRect: on non-RCTScrollableProtocol view %@ with tag #%@", view, reactTag); }