@@ -213,10 +213,21 @@ class NavigationController extends React.Component {
213213 // Hide the previous view wrapper
214214 const prevViewWrapper = this [ `__view-wrapper-${ prev } ` ] ;
215215 prevViewWrapper . style . display = 'none' ;
216+ // Did hide view lifecycle event
217+ const prevView = this . refs [ 'view-0' ] ;
218+ if ( prevView && typeof prevView . navigationControllerDidHideView === 'function' ) {
219+ prevView . navigationControllerDidHideView ( this ) ;
220+ }
221+ // Did show view lifecycle event
222+ const nextView = this . refs [ 'view-1' ] ;
223+ if ( nextView && typeof nextView . navigationControllerDidShowView === 'function' ) {
224+ nextView . navigationControllerDidShowView ( this ) ;
225+ }
216226 // Unmount the previous view
217227 const mountedViews = [ ] ;
218228 mountedViews [ prev ] = null ;
219229 mountedViews [ next ] = last ( this . state . views ) ;
230+
220231 this . setState ( {
221232 transition : null ,
222233 mountedViews : mountedViews
@@ -261,6 +272,16 @@ class NavigationController extends React.Component {
261272 onComplete ( ) ;
262273 }
263274 } ;
275+ // Will hide view lifecycle event
276+ const prevView = this . refs [ 'view-0' ] ;
277+ if ( prevView && typeof prevView . navigationControllerWillHideView === 'function' ) {
278+ prevView . navigationControllerWillHideView ( this ) ;
279+ }
280+ // Will show view lifecycle event
281+ const nextView = this . refs [ 'view-1' ] ;
282+ if ( nextView && typeof nextView . navigationControllerWillShowView === 'function' ) {
283+ nextView . navigationControllerWillShowView ( this ) ;
284+ }
264285 // Built-in transition
265286 if ( typeof transition === 'number' ) {
266287 // Manually transition the views
@@ -288,7 +309,7 @@ class NavigationController extends React.Component {
288309 if ( typeof transition === 'function' ) {
289310 const [ prev , next ] = this . __viewIndexes ;
290311 const prevView = this [ `__view-wrapper-${ prev } ` ] ;
291- const nextView = this [ `__view-wrapper-${ next } ` ] ;
312+ const nextView = this [ `__view-wrapper-${ next } ` ] ;
292313 transition ( prevView , nextView , ( ) => {
293314 this . __animateViewsComplete ( ) ;
294315 this . __transitionViewsComplete ( ) ;
0 commit comments