@@ -110,7 +110,7 @@ export function ModalRenderer(props: ModalRendererProps) {
110110 const currentOpenedModal = useReduxState ( selectors . currentOpenedModal )
111111 const previouslyOpenedModal = usePrevious ( currentOpenedModal )
112112
113- const isSettings = ! ! modalStack . find ( m => m . name === 'SETTINGS' )
113+ const isSettings = ! ! modalStack . find ( m => m && m . name === 'SETTINGS' )
114114 const wasSettings = usePrevious ( isSettings )
115115
116116 const closeAllModals = useReduxAction ( actions . closeAllModals )
@@ -164,62 +164,58 @@ export function ModalRenderer(props: ModalRendererProps) {
164164 } ,
165165 ) [ 0 ]
166166
167- const modalTransitions = useTransition < ModalPayloadWithIndex , any > (
168- modalStack ,
169- item => `modal-stack-${ item . name } ` ,
170- {
171- reset : false ,
172- config : getDefaultReactSpringAnimationConfig ( { precision : 1 } ) ,
173- immediate,
174- ...( appOrientation === 'portrait'
175- ? {
176- from : ( item : ModalPayloadWithIndex ) =>
177- ( item . index === 0 && modalStack . length ) ||
178- ( item . index > 0 && ! modalStack . length )
179- ? { top : Dimensions . get ( 'window' ) . height , left : 0 }
180- : { top : 0 , left : size } ,
181- enter : { top : 0 , left : 0 } ,
182- update : ( item : ModalPayloadWithIndex ) =>
183- modalStack . length > 1 && item . index !== modalStack . length - 1
184- ? { top : 0 , left : - 50 }
185- : { top : 0 , left : 0 } ,
186- leave : ( item : ModalPayloadWithIndex ) =>
187- item . index === 0 || ! modalStack . length
188- ? { top : Dimensions . get ( 'window' ) . height , left : 0 }
189- : { top : 0 , left : size } ,
190- }
191- : {
192- from : ( item : ModalPayloadWithIndex ) =>
193- ( item . index === 0 &&
194- modalStack . length &&
195- ! previouslyOpenedModal ) ||
196- ( item . index > 0 && ! modalStack . length )
197- ? { left : - size }
198- : { left : size } ,
199- enter : { left : 0 } ,
200- update : ( item : ModalPayloadWithIndex ) =>
201- item . index !== modalStack . length - 1
202- ? { left : - size / 3 }
203- : { left : 0 } ,
167+ const modalTransitions = useTransition <
168+ ModalPayloadWithIndex | undefined ,
169+ any
170+ > ( modalStack , item => `modal-stack-${ item && item . name } ` , {
171+ reset : false ,
172+ config : getDefaultReactSpringAnimationConfig ( { precision : 1 } ) ,
173+ immediate,
174+ ...( appOrientation === 'portrait'
175+ ? {
176+ from : ( item : ModalPayloadWithIndex ) =>
177+ ( item . index === 0 && modalStack . length ) ||
178+ ( item . index > 0 && ! modalStack . length )
179+ ? { top : Dimensions . get ( 'window' ) . height , left : 0 }
180+ : { top : 0 , left : size } ,
181+ enter : { top : 0 , left : 0 } ,
182+ update : ( item : ModalPayloadWithIndex ) =>
183+ modalStack . length > 1 && item . index !== modalStack . length - 1
184+ ? { top : 0 , left : - 50 }
185+ : { top : 0 , left : 0 } ,
186+ leave : ( item : ModalPayloadWithIndex ) =>
187+ item . index === 0 || ! modalStack . length
188+ ? { top : Dimensions . get ( 'window' ) . height , left : 0 }
189+ : { top : 0 , left : size } ,
190+ }
191+ : {
192+ from : ( item : ModalPayloadWithIndex ) =>
193+ ( item . index === 0 && modalStack . length && ! previouslyOpenedModal ) ||
194+ ( item . index > 0 && ! modalStack . length )
195+ ? { left : - size }
196+ : { left : size } ,
197+ enter : { left : 0 } ,
198+ update : ( item : ModalPayloadWithIndex ) =>
199+ item . index !== modalStack . length - 1
200+ ? { left : - size / 3 }
201+ : { left : 0 } ,
204202
205- leave : ( item : ModalPayloadWithIndex ) =>
206- item . index >= modalStack . length &&
207- modalStack . length &&
208- previouslyOpenedModal &&
209- previouslyOpenedModal . name === item . name &&
210- previousModalStack &&
211- previousModalStack [ 0 ] &&
212- previousModalStack [ 0 ] . name ===
213- ( modalStack [ 0 ] && modalStack [ 0 ] . name )
214- ? { left : size }
215- : { left : - size } ,
216- } ) ,
217- } ,
218- )
203+ leave : ( item : ModalPayloadWithIndex ) =>
204+ item . index >= modalStack . length &&
205+ modalStack . length &&
206+ previouslyOpenedModal &&
207+ previouslyOpenedModal . name === item . name &&
208+ previousModalStack &&
209+ previousModalStack [ 0 ] &&
210+ previousModalStack [ 0 ] . name === ( modalStack [ 0 ] && modalStack [ 0 ] . name )
211+ ? { left : size }
212+ : { left : - size } ,
213+ } ) ,
214+ } )
219215
220216 const separatorTransitions = useTransition < string , any > (
221217 renderSeparator && sizename !== '2-medium' && modalStack . length
222- ? [ modalStack [ 0 ] . name ]
218+ ? [ ( modalStack [ 0 ] && modalStack [ 0 ] ! . name ) || '' ]
223219 : [ ] ,
224220 item => `modal-separator-${ item } ` ,
225221 {
0 commit comments