@@ -3,7 +3,7 @@ import { spacing, useAppTheme } from '@/hooks/useAppTheme';
33
44import { T , useTranslate } from '@tolgee/react' ;
55import { Stack , useRouter } from 'expo-router' ;
6- import { I18nManager , Platform , View } from 'react-native' ;
6+ import { I18nManager , Platform , ScrollView , View } from 'react-native' ;
77import { FlatList } from 'react-native-gesture-handler' ;
88import { KeyboardAvoidingView } from 'react-native-keyboard-controller' ;
99import { useDispatch } from 'react-redux' ;
@@ -46,13 +46,16 @@ import { setProToken } from '@/store/settings';
4646import { Session } from '@/models/session-models' ;
4747import { usePreferredWeightUnit } from '@/hooks/usePreferredWeightUnit' ;
4848import { Loader } from '@/components/presentation/foundation/loader' ;
49+ import { useSafeAreaInsets } from 'react-native-safe-area-context' ;
4950
5051export default function AiPlanner ( ) {
5152 const { t } = useTranslate ( ) ;
5253 const dispatch = useDispatch ( ) ;
5354 const messages = useAppSelector ( ( x ) => x . aiPlanner . plannerChat ) ;
5455 const { handleScroll } = useScroll ( true ) ;
5556 const isLoadingResponse = useAppSelector ( selectIsLoadingAiPlannerMessage ) ;
57+ const insets = useSafeAreaInsets ( ) ;
58+ const bottomInsetHeight = Platform . select ( { ios : insets . bottom } ) ?? 0 ;
5659 useMountEffect ( ( ) => {
5760 dispatch ( initChat ( ) ) ;
5861 } ) ;
@@ -76,7 +79,7 @@ export default function AiPlanner() {
7679 return (
7780 < KeyboardAvoidingView
7881 behavior = { 'translate-with-padding' }
79- style = { { flex : 1 } }
82+ style = { { flex : 1 , insetBlockEnd : bottomInsetHeight } }
8083 >
8184 < Stack . Screen
8285 options = { {
@@ -88,8 +91,12 @@ export default function AiPlanner() {
8891 ) ,
8992 } }
9093 />
94+ { /* Hack as the native tabs add inset to the first scrollview on the page */ }
95+ < ScrollView style = { { height : 0 } } />
9196 < View style = { { flex : 1 } } >
9297 < FlatList
98+ contentInsetAdjustmentBehavior = "never"
99+ automaticallyAdjustContentInsets = { false }
93100 onScroll = { handleScroll }
94101 data = { messages }
95102 inverted
0 commit comments