11import React , { useCallback , useEffect , useMemo , useState } from 'react' ;
22import { LayoutChangeEvent , StyleSheet , ViewStyle } from 'react-native' ;
3+ import { useSafeAreaInsets } from 'react-native-safe-area-context' ;
34import { Image } from 'react-native-ui-lib' ;
45import Animated , { useAnimatedKeyboard , useAnimatedStyle , useSharedValue , withTiming } from 'react-native-reanimated' ;
56import { Keyboard } from 'uilib-native' ;
67import View from '../view' ;
78import Assets from '../../assets' ;
89import { Colors , Shadows , Spacings } from '../../style' ;
910import { asBaseComponent , Constants } from '../../commons/new' ;
11+ import { useKeyboardHeight } from '../../hooks' ;
1012import {
1113 ScreenFooterProps ,
1214 ScreenFooterLayouts ,
@@ -110,7 +112,10 @@ const ScreenFooter = (props: ScreenFooterProps) => {
110112 }
111113 } , [ layout , itemsFit , alignment ] ) ;
112114
113- const { bottom : safeAreaBottom } = Constants . getSafeAreaInsets ( ) ;
115+ const insets = useSafeAreaInsets ( ) ;
116+
117+ const keyboardHeight = useKeyboardHeight ( ) ;
118+ const isKeyboardVisible = keyboardHeight > 0 ;
114119
115120 const contentContainerStyle = useMemo ( ( ) => {
116121 const style : any [ ] = [
@@ -119,7 +124,10 @@ const ScreenFooter = (props: ScreenFooterProps) => {
119124 { alignItems, justifyContent}
120125 ] ;
121126
122-
127+ if ( useSafeArea && ! isKeyboardVisible ) {
128+ style . push ( { paddingBottom : insets . bottom } ) ;
129+ }
130+
123131 if ( isSolid ) {
124132 const shadowStyle = Shadows [ shadow ] ?. top ;
125133 const backgroundElevation = shadowStyle ?. elevation || 0 ;
@@ -128,7 +136,7 @@ const ScreenFooter = (props: ScreenFooterProps) => {
128136 }
129137
130138 return style ;
131- } , [ layout , alignItems , justifyContent , useSafeArea , safeAreaBottom , isSolid , shadow ] ) ;
139+ } , [ layout , alignItems , justifyContent , useSafeArea , insets . bottom , isSolid , shadow , isKeyboardVisible ] ) ;
132140
133141 const solidBackgroundStyle = useMemo ( ( ) => {
134142 if ( ! isSolid ) {
@@ -182,7 +190,7 @@ const ScreenFooter = (props: ScreenFooterProps) => {
182190
183191 if ( isHorizontal && React . isValidElement ( child ) && itemsFit === ItemsFit . STRETCH ) {
184192 return (
185- < View key = { index } style = { styles . stretchItemWrapper } >
193+ < View flex row centerH key = { index } >
186194 { child }
187195 </ View >
188196 ) ;
@@ -194,12 +202,12 @@ const ScreenFooter = (props: ScreenFooterProps) => {
194202
195203 const renderFooterContent = useCallback ( ( ) => {
196204 return (
197- < View useSafeArea = { useSafeArea } >
205+ < >
198206 { renderBackground ( ) }
199207 < View testID = { testID ? `${ testID } .content` : undefined } style = { contentContainerStyle } >
200208 { childrenArray }
201209 </ View >
202- </ View >
210+ </ >
203211 ) ;
204212 } , [ renderBackground , testID , contentContainerStyle , childrenArray ] ) ;
205213
@@ -255,11 +263,6 @@ const styles = StyleSheet.create({
255263 flexDirection : 'column' ,
256264 gap : Spacings . s3
257265 } ,
258- stretchItemWrapper : {
259- flexDirection : 'row' ,
260- flex : 1 ,
261- justifyContent : 'center'
262- } ,
263266 background : {
264267 width : '100%' ,
265268 height : '100%'
0 commit comments