@@ -206,10 +206,21 @@ class NavigationController extends React.Component {
206206 // Hide the previous view wrapper
207207 const prevViewWrapper = this [ `__view-wrapper-${ prev } ` ] ;
208208 prevViewWrapper . style . display = 'none' ;
209+ // Did hide view lifecycle event
210+ const prevView = this . refs [ 'view-0' ] ;
211+ if ( prevView && typeof prevView . navigationControllerDidHideView === 'function' ) {
212+ prevView . navigationControllerDidHideView ( this ) ;
213+ }
214+ // Did show view lifecycle event
215+ const nextView = this . refs [ 'view-1' ] ;
216+ if ( nextView && typeof nextView . navigationControllerDidShowView === 'function' ) {
217+ nextView . navigationControllerDidShowView ( this ) ;
218+ }
209219 // Unmount the previous view
210220 const mountedViews = [ ] ;
211221 mountedViews [ prev ] = null ;
212222 mountedViews [ next ] = last ( this . state . views ) ;
223+
213224 this . setState ( {
214225 transition : null ,
215226 mountedViews : mountedViews
@@ -254,6 +265,16 @@ class NavigationController extends React.Component {
254265 onComplete ( ) ;
255266 }
256267 } ;
268+ // Will hide view lifecycle event
269+ const prevView = this . refs [ 'view-0' ] ;
270+ if ( prevView && typeof prevView . navigationControllerWillHideView === 'function' ) {
271+ prevView . navigationControllerWillHideView ( this ) ;
272+ }
273+ // Will show view lifecycle event
274+ const nextView = this . refs [ 'view-1' ] ;
275+ if ( nextView && typeof nextView . navigationControllerWillShowView === 'function' ) {
276+ nextView . navigationControllerWillShowView ( this ) ;
277+ }
257278 // Built-in transition
258279 if ( typeof transition === 'number' ) {
259280 // Manually transition the views
@@ -281,7 +302,7 @@ class NavigationController extends React.Component {
281302 if ( typeof transition === 'function' ) {
282303 const [ prev , next ] = this . __viewIndexes ;
283304 const prevView = this [ `__view-wrapper-${ prev } ` ] ;
284- const nextView = this [ `__view-wrapper-${ next } ` ] ;
305+ const nextView = this [ `__view-wrapper-${ next } ` ] ;
285306 transition ( prevView , nextView , ( ) => {
286307 this . __animateViewsComplete ( ) ;
287308 this . __transitionViewsComplete ( ) ;
0 commit comments