diff --git a/examples/objectdetection/android/app/build.gradle b/examples/objectdetection/android/app/build.gradle index 909cbc2..e7d2074 100644 --- a/examples/objectdetection/android/app/build.gradle +++ b/examples/objectdetection/android/app/build.gradle @@ -117,3 +117,8 @@ dependencies { } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +rootProject.ext.vectoricons = [ + iconFontNames: [ 'Ionicons.ttf' ] +] + +apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") diff --git a/examples/objectdetection/ios/Podfile.lock b/examples/objectdetection/ios/Podfile.lock index 04ca671..183ca0e 100644 --- a/examples/objectdetection/ios/Podfile.lock +++ b/examples/objectdetection/ios/Podfile.lock @@ -1136,6 +1136,10 @@ PODS: - glog - RCT-Folly (= 2022.05.16.00) - React-Core + - RNVectorIcons (10.0.3): + - glog + - RCT-Folly (= 2022.05.16.00) + - React-Core - SocketRocket (0.6.1) - VisionCamera (3.9.2): - React @@ -1222,6 +1226,7 @@ DEPENDENCIES: - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - ReactNativeMediaPipe (from `../../..`) - RNScreens (from `../node_modules/react-native-screens`) + - RNVectorIcons (from `../node_modules/react-native-vector-icons`) - VisionCamera (from `../node_modules/react-native-vision-camera`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) @@ -1349,6 +1354,8 @@ EXTERNAL SOURCES: :path: "../../.." RNScreens: :path: "../node_modules/react-native-screens" + RNVectorIcons: + :path: "../node_modules/react-native-vector-icons" VisionCamera: :path: "../node_modules/react-native-vision-camera" Yoga: @@ -1421,6 +1428,7 @@ SPEC CHECKSUMS: ReactCommon: 2aa35648354bd4c4665b9a5084a7d37097b89c10 ReactNativeMediaPipe: 92850eb7623b4bb0d6e8fe90c5e5781b42ccba00 RNScreens: b6b64d956af3715adbfe84808694ae82d3fec74f + RNVectorIcons: 73ab573085f65a572d3b6233e68996d4707fd505 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 VisionCamera: 6c8ca7d04fc62fafccd8f8ad584e96f5303671f5 Yoga: 805bf71192903b20fc14babe48080582fee65a80 diff --git a/examples/objectdetection/ios/objectdetection/Info.plist b/examples/objectdetection/ios/objectdetection/Info.plist index 920d555..2d35058 100644 --- a/examples/objectdetection/ios/objectdetection/Info.plist +++ b/examples/objectdetection/ios/objectdetection/Info.plist @@ -2,6 +2,10 @@ + UIAppFonts + + Ionicons.ttf + CFBundleDevelopmentRegion en CFBundleDisplayName diff --git a/examples/objectdetection/package.json b/examples/objectdetection/package.json index 4157977..fa08b6f 100644 --- a/examples/objectdetection/package.json +++ b/examples/objectdetection/package.json @@ -16,10 +16,12 @@ "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/native": "^6.1.17", "@shopify/react-native-skia": "^1.0.5", + "@types/react-native-vector-icons": "^6.4.18", "react": "18.2.0", "react-native": "0.73.6", "react-native-safe-area-context": "^4.9.0", "react-native-screens": "^3.30.1", + "react-native-vector-icons": "^10.0.3", "react-native-vision-camera": "^3.9.2", "react-native-worklets-core": "^0.4.0" }, diff --git a/examples/objectdetection/src/App.tsx b/examples/objectdetection/src/App.tsx index 1ed7737..c2b3ad0 100644 --- a/examples/objectdetection/src/App.tsx +++ b/examples/objectdetection/src/App.tsx @@ -2,16 +2,53 @@ import * as React from "react"; import { CameraStream } from "./CameraStream"; import { Photo } from "./Photo"; import { Settings } from "./Settings"; -import { NavigationContainer } from "@react-navigation/native"; +import { NavigationContainer, type RouteProp } from "@react-navigation/native"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { type RootTabParamList } from "./navigation"; +import Ionicons from "react-native-vector-icons/Ionicons"; const Tab = createBottomTabNavigator(); +type TabBarIconProps = { + focused: boolean; + color: string; + size: number; + route: RouteProp; +}; + +const RenderTabBarIcon: React.FC = ({ + focused, + color, + size, + route, +}) => { + let iconName; + + if (route.name === "CameraStream") { + iconName = focused ? "camera" : "camera-outline"; + } else if (route.name === "Photo") { + iconName = focused ? "document" : "document-outline"; + } else { + // if (route.name === "Settings") + iconName = focused ? "cog" : "cog-outline"; + } + + return ; +}; + function App() { return ( - + ({ + tabBarIcon: ({ focused, color, size }) => { + return RenderTabBarIcon({ focused, color, size, route }); + }, + tabBarActiveTintColor: "tomato", + tabBarInactiveTintColor: "gray", + })} + >