Skip to content

Commit 3c11987

Browse files
committed
chore: fix llm examples on android
1 parent 142f832 commit 3c11987

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

apps/llm/app/llm/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import PauseIcon from '../../assets/icons/pause_icon.svg';
1818
import ColorPalette from '../../colors';
1919
import Messages from '../../components/Messages';
2020
import { useIsFocused } from '@react-navigation/native';
21+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
2122
import { GeneratingContext } from '../../context';
2223
import Spinner from '../../components/Spinner';
2324
import SuggestedPrompts from '../../components/SuggestedPrompts';
@@ -38,6 +39,7 @@ export default function LLMScreenWrapper() {
3839
}
3940

4041
function LLMScreen() {
42+
const { bottom } = useSafeAreaInsets();
4143
const [isTextInputFocused, setIsTextInputFocused] = useState(false);
4244
const [userInput, setUserInput] = useState('');
4345
const [selectedModel, setSelectedModel] = useState<LLMModelSources>(
@@ -120,7 +122,9 @@ function LLMScreen() {
120122
disabled={llm.isGenerating}
121123
/>
122124
<StatsBar stats={stats} />
123-
<View style={styles.bottomContainer}>
125+
<View
126+
style={[styles.bottomContainer, { paddingBottom: bottom || 16 }]}
127+
>
124128
<TextInput
125129
autoCorrect={false}
126130
onFocus={() => setIsTextInputFocused(true)}
@@ -187,7 +191,7 @@ const styles = StyleSheet.create({
187191
color: ColorPalette.primary,
188192
},
189193
bottomContainer: {
190-
height: 100,
194+
minHeight: 100,
191195
width: '100%',
192196
flexDirection: 'row',
193197
justifyContent: 'space-between',

apps/llm/app/multimodal_llm/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'react-native';
1414
import { launchImageLibrary } from 'react-native-image-picker';
1515
import { useIsFocused } from '@react-navigation/native';
16+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1617
import { useLLM, LFM2_VL_1_6B_QUANTIZED } from 'react-native-executorch';
1718
import SendIcon from '../../assets/icons/send_icon.svg';
1819
import PauseIcon from '../../assets/icons/pause_icon.svg';
@@ -38,6 +39,7 @@ export default function MultimodalLLMScreenWrapper() {
3839
}
3940

4041
function MultimodalLLMScreen() {
42+
const { bottom } = useSafeAreaInsets();
4143
const [imageUri, setImageUri] = useState<string | null>(null);
4244
const [userInput, setUserInput] = useState('');
4345
const [isTextInputFocused, setIsTextInputFocused] = useState(false);
@@ -158,7 +160,9 @@ function MultimodalLLMScreen() {
158160
)}
159161

160162
<StatsBar stats={stats} />
161-
<View style={styles.bottomContainer}>
163+
<View
164+
style={[styles.bottomContainer, { paddingBottom: bottom || 16 }]}
165+
>
162166
{/* Image picker button */}
163167
<TouchableOpacity
164168
style={styles.imageButton}
@@ -309,7 +313,7 @@ const styles = StyleSheet.create({
309313
color: ColorPalette.blueDark,
310314
},
311315
bottomContainer: {
312-
height: 100,
316+
minHeight: 100,
313317
width: '100%',
314318
flexDirection: 'row',
315319
justifyContent: 'space-between',

apps/llm/app/voice_chat/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Messages from '../../components/Messages';
3434
import { AudioManager, AudioRecorder } from 'react-native-audio-api';
3535
import DeviceInfo from 'react-native-device-info';
3636
import { useIsFocused } from '@react-navigation/native';
37+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
3738
import { GeneratingContext } from '../../context';
3839

3940
type LLMModelSources = LLMProps['model'];
@@ -59,6 +60,7 @@ export default function VoiceChatScreenWrapper() {
5960
}
6061

6162
function VoiceChatScreen() {
63+
const { bottom } = useSafeAreaInsets();
6264
const [isRecording, setIsRecording] = useState(false);
6365
const [liveTranscription, setLiveTranscription] = useState('');
6466
const [selectedLLM, setSelectedLLM] =
@@ -194,7 +196,7 @@ function VoiceChatScreen() {
194196
onSelect={(m) => setSelectedSTT(m)}
195197
/>
196198

197-
<View style={styles.bottomContainer}>
199+
<View style={[styles.bottomContainer, { paddingBottom: bottom || 16 }]}>
198200
{DeviceInfo.isEmulatorSync() ? (
199201
<View style={styles.emulatorBox}>
200202
<Text style={[styles.emulatorWarning]}>
@@ -265,7 +267,7 @@ const styles = StyleSheet.create({
265267
color: ColorPalette.primary,
266268
},
267269
bottomContainer: {
268-
height: 100,
270+
minHeight: 100,
269271
width: '100%',
270272
justifyContent: 'center',
271273
alignItems: 'center',

0 commit comments

Comments
 (0)