@@ -46,8 +46,8 @@ type Props = {
4646 renderScene : ( props : { route : Route } ) => React . ReactNode ;
4747 headerMode : HeaderMode ;
4848 onTransitionStart ?: (
49- curr : { index : number } ,
50- prev : { index : number }
49+ current : { index : number } ,
50+ previous : { index : number }
5151 ) => void ;
5252 onGestureBegin ?: ( ) => void ;
5353 onGestureCanceled ?: ( ) => void ;
@@ -60,7 +60,7 @@ type State = {
6060 scenes : HeaderScene < Route > [ ] ;
6161 progress : ProgressValues ;
6262 layout : Layout ;
63- floaingHeaderHeight : number ;
63+ floatingHeaderHeight : number ;
6464} ;
6565
6666const dimensions = Dimensions . get ( 'window' ) ;
@@ -171,7 +171,7 @@ export default class Stack extends React.Component<Props, State> {
171171 // This is not a great heuristic here. We don't know synchronously
172172 // on mount what the header height is so we have just used the most
173173 // common cases here.
174- floaingHeaderHeight : getDefaultHeaderHeight ( layout ) ,
174+ floatingHeaderHeight : getDefaultHeaderHeight ( layout ) ,
175175 } ;
176176
177177 private handleLayout = ( e : LayoutChangeEvent ) => {
@@ -192,11 +192,32 @@ export default class Stack extends React.Component<Props, State> {
192192 private handleFloatingHeaderLayout = ( e : LayoutChangeEvent ) => {
193193 const { height } = e . nativeEvent . layout ;
194194
195- if ( height !== this . state . floaingHeaderHeight ) {
196- this . setState ( { floaingHeaderHeight : height } ) ;
195+ if ( height !== this . state . floatingHeaderHeight ) {
196+ this . setState ( { floatingHeaderHeight : height } ) ;
197197 }
198198 } ;
199199
200+ private handleTransitionStart = ( {
201+ route,
202+ current,
203+ previous,
204+ } : {
205+ route : Route ;
206+ current : { index : number } ;
207+ previous : { index : number } ;
208+ } ) => {
209+ const { onTransitionStart, descriptors } = this . props ;
210+ const options = descriptors [ route . key ] . options ;
211+
212+ onTransitionStart && onTransitionStart ( current , previous ) ;
213+ options . onTransitionStart && options . onTransitionStart ( ) ;
214+ } ;
215+
216+ private handleTransitionEnd = ( { route } : { route : Route } ) => {
217+ const options = this . props . descriptors [ route . key ] . options ;
218+ options . onTransitionEnd && options . onTransitionEnd ( ) ;
219+ } ;
220+
200221 render ( ) {
201222 const {
202223 mode,
@@ -212,13 +233,12 @@ export default class Stack extends React.Component<Props, State> {
212233 renderHeader,
213234 renderScene,
214235 headerMode,
215- onTransitionStart,
216236 onGestureBegin,
217237 onGestureCanceled,
218238 onGestureEnd,
219239 } = this . props ;
220240
221- const { scenes, layout, progress, floaingHeaderHeight } = this . state ;
241+ const { scenes, layout, progress, floatingHeaderHeight } = this . state ;
222242
223243 const focusedRoute = navigation . state . routes [ navigation . state . index ] ;
224244 const focusedOptions = descriptors [ focusedRoute . key ] . options ;
@@ -300,7 +320,7 @@ export default class Stack extends React.Component<Props, State> {
300320 onGestureCanceled = { onGestureCanceled }
301321 onGestureEnd = { onGestureEnd }
302322 gestureResponseDistance = { gestureResponseDistance }
303- floaingHeaderHeight = { floaingHeaderHeight }
323+ floatingHeaderHeight = { floatingHeaderHeight }
304324 hasCustomHeader = { header === null }
305325 getPreviousRoute = { getPreviousRoute }
306326 headerMode = { headerMode }
@@ -309,7 +329,8 @@ export default class Stack extends React.Component<Props, State> {
309329 renderScene = { renderScene }
310330 onOpenRoute = { onOpenRoute }
311331 onCloseRoute = { onCloseRoute }
312- onTransitionStart = { onTransitionStart }
332+ onTransitionStart = { this . handleTransitionStart }
333+ onTransitionEnd = { this . handleTransitionEnd }
313334 onGoBack = { onGoBack }
314335 direction = { direction }
315336 transitionSpec = { transitionSpec }
0 commit comments