@@ -126,10 +126,11 @@ interface SceneWrapperProps {
126126 // True to make the scene scrolling (if avoidKeyboard is false):
127127 scroll ?: boolean
128128
129- // Optional KeyboardAccessoryView rendered as a sibling to the SceneWrapper content:
130- kavProps ?: {
129+ // Optional "dock" view rendered at the bottom of the scene, attached to the
130+ // keyboard, tabs, footer, etc, whatever is highest:
131+ dockProps ?: {
131132 children : React . ReactNode
132- alwaysVisible ?: boolean
133+ keyboardVisibleOnly ?: boolean
133134 contentContainerStyle ?: ViewStyle
134135 }
135136}
@@ -162,7 +163,7 @@ function SceneWrapperComponent(props: SceneWrapperProps): React.ReactElement {
162163 padding = 0 ,
163164 renderFooter,
164165 scroll = false ,
165- kavProps
166+ dockProps : kavProps
166167 } = props
167168
168169 const notificationHeight = useSelector ( state => state . ui . notificationHeight )
@@ -179,42 +180,23 @@ function SceneWrapperComponent(props: SceneWrapperProps): React.ReactElement {
179180 }
180181 } )
181182
182- // Local keyboard visible state for KAV parity (iOS willShow vs Android didShow) :
183+ // Local keyboard visibility and opening/closing state for dock parity:
183184 const [ isKeyboardVisibleFull , setKeyboardVisibleKav ] = useState ( false )
184- useEffect ( ( ) => {
185- const keyboardDidShowListener = Keyboard . addListener (
186- isIos ? 'keyboardWillShow' : 'keyboardDidShow' ,
187- ( ) => {
188- setKeyboardVisibleKav ( true )
189- }
190- )
191- const keyboardDidHideListener = Keyboard . addListener (
192- isIos ? 'keyboardWillHide' : 'keyboardDidHide' ,
193- ( ) => {
194- setKeyboardVisibleKav ( false )
195- }
196- )
197- return ( ) => {
198- keyboardDidShowListener . remove ( )
199- keyboardDidHideListener . remove ( )
200- }
201- } , [ isIos ] )
202-
203185 // Track closing/opening state explicitly for animation direction:
204186 const isClosingSv = useSharedValue ( false )
205187 useEffect ( ( ) => {
206- const showListener = Keyboard . addListener (
207- isIos ? 'keyboardWillShow ' : 'keyboardDidShow' ,
208- ( ) => {
209- isClosingSv . value = false
210- }
211- )
212- const hideListener = Keyboard . addListener (
213- isIos ? 'keyboardWillHide' : 'keyboardDidHide' ,
214- ( ) => {
215- isClosingSv . value = true
216- }
217- )
188+ const showEvent = isIos ? 'keyboardWillShow' : 'keyboardDidShow'
189+ const hideEvent = isIos ? 'keyboardWillHide ' : 'keyboardDidHide'
190+ const onShow = ( ) : void => {
191+ setKeyboardVisibleKav ( true )
192+ isClosingSv . value = false
193+ }
194+ const onHide = ( ) : void => {
195+ setKeyboardVisibleKav ( false )
196+ isClosingSv . value = true
197+ }
198+ const showListener = Keyboard . addListener ( showEvent , onShow )
199+ const hideListener = Keyboard . addListener ( hideEvent , onHide )
218200 return ( ) => {
219201 showListener . remove ( )
220202 hideListener . remove ( )
@@ -342,7 +324,7 @@ function SceneWrapperComponent(props: SceneWrapperProps): React.ReactElement {
342324 } , [ children , sceneWrapperInfo ] )
343325
344326 // Build Keyboard Accessory View element
345- const alwaysVisibleKav = kavProps ?. alwaysVisible === true
327+ const keyboardVisibleOnlyKav = kavProps ?. keyboardVisibleOnly ?? true
346328 const kavBaseStyle = useMemo (
347329 ( ) => ( {
348330 position : 'absolute' as const ,
@@ -380,7 +362,7 @@ function SceneWrapperComponent(props: SceneWrapperProps): React.ReactElement {
380362 return { bottom }
381363 } )
382364 const shouldShowKav =
383- kavProps != null && ( alwaysVisibleKav || isKeyboardVisibleFull )
365+ kavProps != null && ( ! keyboardVisibleOnlyKav || isKeyboardVisibleFull )
384366 const kavElement = ! shouldShowKav ? null : (
385367 < Reanimated . View
386368 style = { [ kavBaseStyle , kavAnimatedStyle , kavProps ?. contentContainerStyle ] }
0 commit comments