Skip to content

Commit 5b4eef0

Browse files
authored
[RNE Rewrite] fix(example): add bottom safe area inset to classification screen (#1299)
## Description Follow-up PR to two problems raised in review of #1296 - #1296 (comment) - #1296 (comment) It - Fixes the classification example screen to not overlap with Android navigation buttons. - Leaves the default YOLO threshold as `0.25` since it is the official recommended default value (see: [ultralytics docs](https://docs.ultralytics.com/modes/predict#fixed-shape-vs-minimum-rectangle-rect:~:text=float-,0.25,-Sets%20the%20minimum)) ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [x] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [ ] iOS - [x] Android ### Testing instructions - [ ] Run the computer-vision app on Android and confirm that there is no overlap with navigation buttons. ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent 7b6446d commit 5b4eef0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • apps/computer-vision/app/classification

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react';
22
import { View, Text, StyleSheet, ScrollView, Platform } from 'react-native';
3-
import { commonStyles, ColorPalette } from '../../theme';
3+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
4+
import { commonStyles, ColorPalette, theme } from '../../theme';
45
import { useImage } from '@shopify/react-native-skia';
56
import { useClassifier, models } from 'react-native-executorch';
67
import ScreenWrapper from '../../components/ScreenWrapper';
@@ -28,6 +29,7 @@ const MODEL_OPTIONS: ModelOption[] = [
2829
];
2930

3031
function ClassificationContent() {
32+
const insets = useSafeAreaInsets();
3133
const [selectedModel, setSelectedModel] = useState<any>(MODEL_OPTIONS[0].value);
3234
const [imageUri, setImageUri] = useState<string | null>(null);
3335
const [isProcessing, setIsProcessing] = useState(false);
@@ -97,7 +99,10 @@ function ClassificationContent() {
9799
return (
98100
<ScrollView
99101
style={commonStyles.container}
100-
contentContainerStyle={commonStyles.contentContainer}
102+
contentContainerStyle={[
103+
commonStyles.contentContainer,
104+
{ paddingBottom: insets.bottom + theme.spacing.large },
105+
]}
101106
>
102107
<Text style={commonStyles.description}>
103108
Upload or capture an image to identify objects using a classifier.

0 commit comments

Comments
 (0)