Skip to content

Commit 142f832

Browse files
committed
chore: add fix for android overlap of button and navbar
1 parent 9b3de98 commit 142f832

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

apps/computer-vision/app/text_to_image/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Platform,
1212
} from 'react-native';
1313
import React, { useContext, useEffect, useState } from 'react';
14+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1415
import Spinner from '../../components/Spinner';
1516
import {
1617
useTextToImage,
@@ -34,6 +35,7 @@ const MODELS: ModelOption<TextToImageModelSources>[] = [
3435
];
3536

3637
export default function TextToImageScreen() {
38+
const { bottom } = useSafeAreaInsets();
3739
const [inferenceStepIdx, setInferenceStepIdx] = useState<number>(0);
3840
const [image, setImage] = useState<string | null>(null);
3941
const [steps, setSteps] = useState<number>(40);
@@ -173,7 +175,7 @@ export default function TextToImageScreen() {
173175

174176
<StatsBar inferenceTime={generationTime} />
175177

176-
<View style={styles.inputRow}>
178+
<View style={[styles.inputRow, { marginBottom: bottom || 12 }]}>
177179
<TextInput
178180
style={styles.textInput}
179181
placeholder="Enter prompt..."

apps/computer-vision/components/BottomBar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import ColorPalette from '../colors';
22
import FontAwesome from '@expo/vector-icons/FontAwesome';
33
import DeviceInfo from 'react-native-device-info';
44
import { View, TouchableOpacity, StyleSheet, Text } from 'react-native';
5+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
56

67
export const BottomBar = ({
78
handleCameraPress,
@@ -10,8 +11,10 @@ export const BottomBar = ({
1011
handleCameraPress: (isCamera: boolean) => void;
1112
runForward: () => void;
1213
}) => {
14+
const { bottom } = useSafeAreaInsets();
15+
1316
return (
14-
<View style={styles.bottomContainer}>
17+
<View style={[styles.bottomContainer, { paddingBottom: bottom || 16 }]}>
1518
<View style={styles.bottomIconsContainer}>
1619
<TouchableOpacity onPress={() => handleCameraPress(false)}>
1720
<FontAwesome name="photo" size={24} color={ColorPalette.primary} />
@@ -40,8 +43,8 @@ const styles = StyleSheet.create({
4043
width: '100%',
4144
gap: 15,
4245
alignItems: 'center',
43-
padding: 16,
44-
flex: 1,
46+
paddingTop: 16,
47+
paddingHorizontal: 16,
4548
},
4649
bottomIconsContainer: {
4750
flexDirection: 'row',

0 commit comments

Comments
 (0)