Permalink
Browse files

NavigatorIOS - Remove NavigationContext

Reviewed By: fkgozali

Differential Revision: D4774022

fbshipit-source-id: 0184bcbcf6a458eac6377cc6e1cffc0924f0d2d2
  • Loading branch information...
ericvicenti authored and facebook-github-bot committed Mar 27, 2017
1 parent af34c34 commit 7aa2c9ab17097ca7bc748fbbd104bce213ae1fce
Showing with 0 additions and 20 deletions.
  1. +0 −20 Libraries/Components/Navigation/NavigatorIOS.ios.js
@@ -13,7 +13,6 @@
var EventEmitter = require('EventEmitter');
var Image = require('Image');
var NavigationContext = require('NavigationContext');
var RCTNavigatorManager = require('NativeModules').NavigatorManager;
var React = require('React');
var ReactNative = require('ReactNative');
@@ -499,7 +498,6 @@ var NavigatorIOS = React.createClass({
},
navigator: (undefined: ?Object),
navigationContext: new NavigationContext(),
componentWillMount: function() {
// Precompute a pack of callbacks that's frequently generated and passed to
@@ -515,19 +513,14 @@ var NavigatorIOS = React.createClass({
resetTo: this.resetTo,
popToRoute: this.popToRoute,
popToTop: this.popToTop,
navigationContext: this.navigationContext,
};
this._emitWillFocus(this.state.routeStack[this.state.observedTopOfStack]);
},
componentDidMount: function() {
this._emitDidFocus(this.state.routeStack[this.state.observedTopOfStack]);
this._enableTVEventHandler();
},
componentWillUnmount: function() {
this.navigationContext.dispose();
this.navigationContext = new NavigationContext();
this._disableTVEventHandler();
},
@@ -608,7 +601,6 @@ var NavigatorIOS = React.createClass({
_handleNavigatorStackChanged: function(e: Event) {
var newObservedTopOfStack = e.nativeEvent.stackLength - 1;
this._emitDidFocus(this.state.routeStack[newObservedTopOfStack]);
invariant(
newObservedTopOfStack <= this.state.requestedTopOfStack,
@@ -661,14 +653,6 @@ var NavigatorIOS = React.createClass({
});
},
_emitDidFocus: function(route: Route) {
this.navigationContext.emit('didfocus', {route: route});
},
_emitWillFocus: function(route: Route) {
this.navigationContext.emit('willfocus', {route: route});
},
/**
* Navigate forward to a new route.
* @param route The new route to navigate to.
@@ -678,7 +662,6 @@ var NavigatorIOS = React.createClass({
// Make sure all previous requests are caught up first. Otherwise reject.
if (this.state.requestedTopOfStack === this.state.observedTopOfStack) {
this._tryLockNavigator(() => {
this._emitWillFocus(route);
var nextStack = this.state.routeStack.concat([route]);
var nextIDStack = this.state.idStack.concat([getuid()]);
@@ -709,7 +692,6 @@ var NavigatorIOS = React.createClass({
this._tryLockNavigator(() => {
var newRequestedTopOfStack = this.state.requestedTopOfStack - n;
invariant(newRequestedTopOfStack >= 0, 'Cannot pop below 0');
this._emitWillFocus(this.state.routeStack[newRequestedTopOfStack]);
this.setState({
requestedTopOfStack: newRequestedTopOfStack,
makingNavigatorRequest: true,
@@ -758,8 +740,6 @@ var NavigatorIOS = React.createClass({
updatingAllIndicesAtOrBeyond: index,
});
this._emitWillFocus(route);
this._emitDidFocus(route);
},
/**

5 comments on commit 7aa2c9a

@gre

This comment has been minimized.

Show comment
Hide comment
@gre

gre May 3, 2017

Contributor

some of my code was relying on observing the WillFocus and DidFocus event, it's no longer possible?

Contributor

gre replied May 3, 2017

some of my code was relying on observing the WillFocus and DidFocus event, it's no longer possible?

@rossmartin

This comment has been minimized.

Show comment
Hide comment
@rossmartin

rossmartin Jun 16, 2017

@ericvicenti why was this removed?

rossmartin replied Jun 16, 2017

@ericvicenti why was this removed?

@AnyGong

This comment has been minimized.

Show comment
Hide comment
@AnyGong

AnyGong Jul 28, 2017

@ericvicenti I do not know how to upgrade my part of the relevant code, have better suggestions or ideas? Thank you very much

AnyGong replied Jul 28, 2017

@ericvicenti I do not know how to upgrade my part of the relevant code, have better suggestions or ideas? Thank you very much

@ericvicenti

This comment has been minimized.

Show comment
Hide comment
@ericvicenti

ericvicenti Jul 28, 2017

Contributor

If you want to use the old version of this JS file, you should be able to copy it into your project, use it directly, and change it however you'd like.

Contributor

ericvicenti replied Jul 28, 2017

If you want to use the old version of this JS file, you should be able to copy it into your project, use it directly, and change it however you'd like.

@rossmartin

This comment has been minimized.

Show comment
Hide comment
@rossmartin

rossmartin Jul 28, 2017

@ericvicenti Thanks for the update. I moved to react-navigation but this will probably help others.

rossmartin replied Jul 28, 2017

@ericvicenti Thanks for the update. I moved to react-navigation but this will probably help others.

Please sign in to comment.