Skip to content

Commit efda95a

Browse files
committed
fix: Ensure tab bar does not cover ai chat
fixes: #865
1 parent 54c8d61 commit efda95a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

app/src/app/settings/ai/planner.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { spacing, useAppTheme } from '@/hooks/useAppTheme';
33

44
import { T, useTranslate } from '@tolgee/react';
55
import { Stack, useRouter } from 'expo-router';
6-
import { I18nManager, Platform, View } from 'react-native';
6+
import { I18nManager, Platform, ScrollView, View } from 'react-native';
77
import { FlatList } from 'react-native-gesture-handler';
88
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
99
import { useDispatch } from 'react-redux';
@@ -46,13 +46,16 @@ import { setProToken } from '@/store/settings';
4646
import { Session } from '@/models/session-models';
4747
import { usePreferredWeightUnit } from '@/hooks/usePreferredWeightUnit';
4848
import { Loader } from '@/components/presentation/foundation/loader';
49+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
4950

5051
export 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

Comments
 (0)