import { getHostComponent } from "react-native-nitro-modules"; import type { NitroVtoViewProps, NitroVtoViewMethods, } from "./specs/NitroVtoView.nitro"; import NitroVtoViewConfig from "../nitrogen/generated/shared/json/NitroVtoViewConfig.json"; import { version } from "../package.json"; // Re-export types export type { NitroVtoViewProps, NitroVtoViewMethods }; // Export the HybridRef type for use with hybridRef prop export type { HybridRef } from "react-native-nitro-modules"; export const nitroVtoVersion = version; /** * NitroVtoView is a React Native component for virtual try-on of glasses. * It uses ARCore/ARKit for face tracking and Filament for 3D rendering. * * **Important**: Camera permissions must be granted before using this component. * The consuming app is responsible for requesting camera permissions. * * @example * ```tsx * import { NitroVtoView, type NitroVtoViewProps, type NitroVtoViewMethods, type HybridRef } from '@alaneu/react-native-nitro-vto' * import { useRef } from 'react' * import { callback } from 'react-native-nitro-modules' * * type NitroVtoRef = HybridRef * * function App() { * const vtoRef = useRef(null) * * const handleModelLoaded = (url: string) => { * console.log("Model loaded:", url) * } * * // To switch glasses, update the `modelUrl` prop from state. * // To hide the glasses (keeping the AR session running), call * // `vtoRef.current?.hideGlasses()`. * * return ( * { * vtoRef.current = ref * }} * /> * ) * } * ``` */ export const NitroVtoView = getHostComponent< NitroVtoViewProps, NitroVtoViewMethods >("NitroVtoView", () => NitroVtoViewConfig);