-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwithMediapipePosedetection.ts
More file actions
60 lines (52 loc) Β· 1.36 KB
/
withMediapipePosedetection.ts
File metadata and controls
60 lines (52 loc) Β· 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { type ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins';
import type { MediapipePluginProps } from './PluginProps';
import { android } from './android';
import { ios } from './ios';
let pkg: { name: string; version?: string } = {
name: 'react-native-mediapipe-posedetection',
};
try {
pkg = require('react-native-mediapipe-posedetection/package.json');
} catch {
// empty catch block
}
/**
* Main config plugin entry point for react-native-mediapipe-posedetection
*
* Copies model assets to:
* - Android: android/app/src/main/assets/
* - iOS: ios/ (root folder with Xcode project references)
*
* Usage in app.json:
* ```json
* [
* "react-native-mediapipe-posedetection",
* {
* "assetsPaths": ["./models/"],
* "ignoredPattern": "\\.txt$" // optional regex pattern
* }
* ]
* ```
*/
const withMediapipePosedetection: ConfigPlugin<MediapipePluginProps> = (
config,
props
) => {
const { assetsPaths = [] } = props || {};
if (assetsPaths.length === 0) {
console.warn(
'β οΈ [react-native-mediapipe-posedetection] No assetsPaths provided to config plugin'
);
return config;
}
// Android
config = android.withAssets(config, props);
// iOS
config = ios.withAssets(config, props);
return config;
};
export default createRunOncePlugin(
withMediapipePosedetection,
pkg.name,
pkg.version
);