Skip to content

Commit bf4d314

Browse files
committed
🔧
1 parent c805546 commit bf4d314

10 files changed

Lines changed: 253 additions & 13 deletions

File tree

apps/example/app.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@
2727
]
2828
},
2929
"ios": {
30-
"metalAPIValidation": false
30+
"metalAPIValidation": false,
31+
"infoPlist": {
32+
"NSCameraUsageDescription": "$(PRODUCT_NAME) needs access to your Camera.",
33+
"NSMicrophoneUsageDescription": "$(PRODUCT_NAME) needs access to your Microphone."
34+
}
35+
},
36+
"android": {
37+
"permissions": [
38+
{ "android:name": "android.permission.CAMERA" },
39+
{ "android:name": "android.permission.RECORD_AUDIO" }
40+
]
3141
},
3242
"macos": {
3343
"metalAPIValidation": false

apps/example/ios/Podfile.lock

Lines changed: 114 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,65 @@ PODS:
88
- hermes-engine (0.81.4):
99
- hermes-engine/Pre-built (= 0.81.4)
1010
- hermes-engine/Pre-built (0.81.4)
11+
- NitroImage (0.14.0):
12+
- boost
13+
- DoubleConversion
14+
- fast_float
15+
- fmt
16+
- glog
17+
- hermes-engine
18+
- NitroModules
19+
- RCT-Folly
20+
- RCT-Folly/Fabric
21+
- RCTRequired
22+
- RCTTypeSafety
23+
- React-callinvoker
24+
- React-Core
25+
- React-debug
26+
- React-Fabric
27+
- React-featureflags
28+
- React-graphics
29+
- React-ImageManager
30+
- React-jsi
31+
- React-NativeModulesApple
32+
- React-RCTFabric
33+
- React-renderercss
34+
- React-rendererdebug
35+
- React-utils
36+
- ReactCodegen
37+
- ReactCommon/turbomodule/bridging
38+
- ReactCommon/turbomodule/core
39+
- SocketRocket
40+
- Yoga
41+
- NitroModules (0.35.7):
42+
- boost
43+
- DoubleConversion
44+
- fast_float
45+
- fmt
46+
- glog
47+
- hermes-engine
48+
- RCT-Folly
49+
- RCT-Folly/Fabric
50+
- RCTRequired
51+
- RCTTypeSafety
52+
- React-callinvoker
53+
- React-Core
54+
- React-debug
55+
- React-Fabric
56+
- React-featureflags
57+
- React-graphics
58+
- React-ImageManager
59+
- React-jsi
60+
- React-NativeModulesApple
61+
- React-RCTFabric
62+
- React-renderercss
63+
- React-rendererdebug
64+
- React-utils
65+
- ReactCodegen
66+
- ReactCommon/turbomodule/bridging
67+
- ReactCommon/turbomodule/core
68+
- SocketRocket
69+
- Yoga
1170
- RCT-Folly (2024.11.18.00):
1271
- boost
1372
- DoubleConversion
@@ -2460,7 +2519,7 @@ PODS:
24602519
- ReactCommon/turbomodule/core
24612520
- SocketRocket
24622521
- Yoga
2463-
- RNReanimated (4.3.1):
2522+
- RNReanimated (4.2.1):
24642523
- boost
24652524
- DoubleConversion
24662525
- fast_float
@@ -2487,12 +2546,11 @@ PODS:
24872546
- ReactCodegen
24882547
- ReactCommon/turbomodule/bridging
24892548
- ReactCommon/turbomodule/core
2490-
- RNReanimated/apple (= 4.3.1)
2491-
- RNReanimated/common (= 4.3.1)
2549+
- RNReanimated/reanimated (= 4.2.1)
24922550
- RNWorklets
24932551
- SocketRocket
24942552
- Yoga
2495-
- RNReanimated/apple (4.3.1):
2553+
- RNReanimated/reanimated (4.2.1):
24962554
- boost
24972555
- DoubleConversion
24982556
- fast_float
@@ -2519,10 +2577,11 @@ PODS:
25192577
- ReactCodegen
25202578
- ReactCommon/turbomodule/bridging
25212579
- ReactCommon/turbomodule/core
2580+
- RNReanimated/reanimated/apple (= 4.2.1)
25222581
- RNWorklets
25232582
- SocketRocket
25242583
- Yoga
2525-
- RNReanimated/common (4.3.1):
2584+
- RNReanimated/reanimated/apple (4.2.1):
25262585
- boost
25272586
- DoubleConversion
25282587
- fast_float
@@ -2552,7 +2611,7 @@ PODS:
25522611
- RNWorklets
25532612
- SocketRocket
25542613
- Yoga
2555-
- RNWorklets (0.8.3):
2614+
- RNWorklets (0.7.2):
25562615
- boost
25572616
- DoubleConversion
25582617
- fast_float
@@ -2579,11 +2638,10 @@ PODS:
25792638
- ReactCodegen
25802639
- ReactCommon/turbomodule/bridging
25812640
- ReactCommon/turbomodule/core
2582-
- RNWorklets/apple (= 0.8.3)
2583-
- RNWorklets/common (= 0.8.3)
2641+
- RNWorklets/worklets (= 0.7.2)
25842642
- SocketRocket
25852643
- Yoga
2586-
- RNWorklets/apple (0.8.3):
2644+
- RNWorklets/worklets (0.7.2):
25872645
- boost
25882646
- DoubleConversion
25892647
- fast_float
@@ -2610,9 +2668,10 @@ PODS:
26102668
- ReactCodegen
26112669
- ReactCommon/turbomodule/bridging
26122670
- ReactCommon/turbomodule/core
2671+
- RNWorklets/worklets/apple (= 0.7.2)
26132672
- SocketRocket
26142673
- Yoga
2615-
- RNWorklets/common (0.8.3):
2674+
- RNWorklets/worklets/apple (0.7.2):
26162675
- boost
26172676
- DoubleConversion
26182677
- fast_float
@@ -2642,6 +2701,37 @@ PODS:
26422701
- SocketRocket
26432702
- Yoga
26442703
- SocketRocket (0.7.1)
2704+
- VisionCamera (5.0.10):
2705+
- boost
2706+
- DoubleConversion
2707+
- fast_float
2708+
- fmt
2709+
- glog
2710+
- hermes-engine
2711+
- NitroImage
2712+
- NitroModules
2713+
- RCT-Folly
2714+
- RCT-Folly/Fabric
2715+
- RCTRequired
2716+
- RCTTypeSafety
2717+
- React-callinvoker
2718+
- React-Core
2719+
- React-debug
2720+
- React-Fabric
2721+
- React-featureflags
2722+
- React-graphics
2723+
- React-ImageManager
2724+
- React-jsi
2725+
- React-NativeModulesApple
2726+
- React-RCTFabric
2727+
- React-renderercss
2728+
- React-rendererdebug
2729+
- React-utils
2730+
- ReactCodegen
2731+
- ReactCommon/turbomodule/bridging
2732+
- ReactCommon/turbomodule/core
2733+
- SocketRocket
2734+
- Yoga
26452735
- Yoga (0.0.0)
26462736

26472737
DEPENDENCIES:
@@ -2652,6 +2742,8 @@ DEPENDENCIES:
26522742
- fmt (from `../../../node_modules/react-native/third-party-podspecs/fmt.podspec`)
26532743
- glog (from `../../../node_modules/react-native/third-party-podspecs/glog.podspec`)
26542744
- hermes-engine (from `../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
2745+
- NitroImage (from `../../../node_modules/react-native-nitro-image`)
2746+
- NitroModules (from `../../../node_modules/react-native-nitro-modules`)
26552747
- RCT-Folly (from `../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
26562748
- RCTDeprecation (from `../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
26572749
- RCTRequired (from `../../../node_modules/react-native/Libraries/Required`)
@@ -2726,6 +2818,7 @@ DEPENDENCIES:
27262818
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
27272819
- RNWorklets (from `../../../node_modules/react-native-worklets`)
27282820
- SocketRocket (~> 0.7.1)
2821+
- VisionCamera (from `../../../node_modules/react-native-vision-camera`)
27292822
- Yoga (from `../../../node_modules/react-native/ReactCommon/yoga`)
27302823

27312824
SPEC REPOS:
@@ -2748,6 +2841,10 @@ EXTERNAL SOURCES:
27482841
hermes-engine:
27492842
:podspec: "../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
27502843
:tag: hermes-2025-07-07-RNv0.81.0-e0fc67142ec0763c6b6153ca2bf96df815539782
2844+
NitroImage:
2845+
:path: "../../../node_modules/react-native-nitro-image"
2846+
NitroModules:
2847+
:path: "../../../node_modules/react-native-nitro-modules"
27512848
RCT-Folly:
27522849
:podspec: "../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
27532850
RCTDeprecation:
@@ -2892,6 +2989,8 @@ EXTERNAL SOURCES:
28922989
:path: "../../../node_modules/react-native-reanimated"
28932990
RNWorklets:
28942991
:path: "../../../node_modules/react-native-worklets"
2992+
VisionCamera:
2993+
:path: "../../../node_modules/react-native-vision-camera"
28952994
Yoga:
28962995
:path: "../../../node_modules/react-native/ReactCommon/yoga"
28972996

@@ -2903,6 +3002,8 @@ SPEC CHECKSUMS:
29033002
fmt: 530618a01105dae0fa3a2f27c81ae11fa8f67eac
29043003
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
29053004
hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394
3005+
NitroImage: 4ffcf183d975de179ae1662b7c3b4b3b37747c7e
3006+
NitroModules: 9ec4a2e0b9af22ba1f1f550e1dd9be94143afd18
29063007
RCT-Folly: b29feb752b08042c62badaef7d453f3bb5e6ae23
29073008
RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585
29083009
RCTRequired: 58719f5124f9267b5f9649c08bf23d9aea845b23
@@ -2973,9 +3074,10 @@ SPEC CHECKSUMS:
29733074
ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3
29743075
ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf
29753076
RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b
2976-
RNReanimated: 9d012d4031abc9df896f8a82f9928eb2b9eae417
2977-
RNWorklets: 0da2552f9ff5d17506918a692304110cfebb9f0a
3077+
RNReanimated: 464375ff2caa801358547c44eca894ff0bf68e74
3078+
RNWorklets: ee58e869ea579800ec5f2f1cb6ae195fd3537546
29783079
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
3080+
VisionCamera: 8c913d0cb2c868f779035fb69a1e0ab69e10f1c3
29793081
Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d
29803082

29813083
PODFILE CHECKSUM: 22a8651333bf096f67ca333598bd33455d994c1f

apps/example/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
"react-native": "0.81.4",
3434
"react-native-gesture-handler": "^2.28.0",
3535
"react-native-macos": "^0.79.0",
36+
"react-native-nitro-image": "0.14.0",
37+
"react-native-nitro-modules": "0.35.7",
3638
"react-native-reanimated": "4.2.1",
3739
"react-native-safe-area-context": "^5.4.0",
40+
"react-native-vision-camera": "5.0.10",
3841
"react-native-web": "^0.21.2",
3942
"react-native-wgpu": "*",
4043
"react-native-worklets": "0.7.2",

apps/example/react-native.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ const project = (() => {
1919
}
2020
})();
2121

22+
// Workaround: react-native-nitro-image's NitroImagePackage extends
23+
// BaseReactPackage, which @react-native-community/cli@13's autolinking regex
24+
// does not detect. Without this override, autolinking returns android: null
25+
// for nitro-image and vision-camera's gradle build fails with
26+
// "Project with path ':react-native-nitro-image' could not be found".
27+
const path = require("path");
28+
2229
module.exports = {
2330
...(project ? { project } : undefined),
31+
dependencies: {
32+
"react-native-nitro-image": {
33+
platforms: {
34+
android: {
35+
sourceDir: path.join(
36+
__dirname,
37+
"../../node_modules/react-native-nitro-image/android",
38+
),
39+
packageImportPath: "import com.margelo.nitro.image.NitroImagePackage;",
40+
packageInstance: "new NitroImagePackage()",
41+
},
42+
},
43+
},
44+
},
2445
};

apps/example/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { AsyncStarvation } from "./Diagnostics/AsyncStarvation";
3737
import { DeviceLostHang } from "./Diagnostics/DeviceLostHang";
3838
import { StorageBufferVertices } from "./StorageBufferVertices";
3939
import { SharedTextureMemory } from "./SharedTextureMemory";
40+
import { Camera } from "./Camera";
4041

4142
// The two lines below are needed by three.js
4243
import "fast-text-encoding";
@@ -102,6 +103,7 @@ function App() {
102103
name="SharedTextureMemory"
103104
component={SharedTextureMemory}
104105
/>
106+
<Stack.Screen name="Camera" component={Camera} />
105107
</Stack.Navigator>
106108
</NavigationContainer>
107109
</GestureHandlerRootView>

apps/example/src/Camera/Camera.tsx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React, { useEffect } from "react";
2+
import { StyleSheet, Text, View } from "react-native";
3+
import {
4+
Camera as VisionCamera,
5+
useCameraDevice,
6+
useCameraPermission,
7+
} from "react-native-vision-camera";
8+
9+
const styles = StyleSheet.create({
10+
container: {
11+
flex: 1,
12+
backgroundColor: "black",
13+
},
14+
camera: {
15+
flex: 1,
16+
},
17+
centered: {
18+
flex: 1,
19+
alignItems: "center",
20+
justifyContent: "center",
21+
padding: 24,
22+
},
23+
message: {
24+
color: "white",
25+
textAlign: "center",
26+
},
27+
});
28+
29+
export const Camera = () => {
30+
const { hasPermission, requestPermission } = useCameraPermission();
31+
const device = useCameraDevice("back");
32+
33+
useEffect(() => {
34+
if (!hasPermission) {
35+
requestPermission();
36+
}
37+
}, [hasPermission, requestPermission]);
38+
39+
if (!hasPermission) {
40+
return (
41+
<View style={styles.centered}>
42+
<Text style={styles.message}>Requesting camera permission...</Text>
43+
</View>
44+
);
45+
}
46+
47+
if (device == null) {
48+
return (
49+
<View style={styles.centered}>
50+
<Text style={styles.message}>No camera device available.</Text>
51+
</View>
52+
);
53+
}
54+
55+
return (
56+
<View style={styles.container}>
57+
<VisionCamera style={styles.camera} device={device} isActive={true} />
58+
</View>
59+
);
60+
};

apps/example/src/Camera/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { Camera } from "./Camera";

apps/example/src/Home.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export const examples = [
131131
screen: "SharedTextureMemory",
132132
title: "🎞️ Shared Texture Memory",
133133
},
134+
{
135+
screen: "Camera",
136+
title: "📷 Camera",
137+
},
134138
];
135139

136140
const styles = StyleSheet.create({

apps/example/src/Route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ export type Routes = {
3030
DeviceLostHang: undefined;
3131
StorageBufferVertices: undefined;
3232
SharedTextureMemory: undefined;
33+
Camera: undefined;
3334
};

0 commit comments

Comments
 (0)