/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ import type VCTracker, {VisualElement} from './VCTrackerExample'; import * as React from 'react'; import {useEffect, useState} from 'react'; import {Dimensions, StyleSheet, View} from 'react-native'; const OVERLAY_SCALE = 0.25; export default function VCOverlayExample(props: { vcTracker: VCTracker, }): React.Node { const [visualElements, setVisualElements] = useState< $ReadOnlyArray, >([]); useEffect(() => { setVisualElements(props.vcTracker.getVisualElements()); props.vcTracker.onUpdateVisualElements(elements => { setVisualElements(elements); }); }, [props.vcTracker]); return ( {visualElements.map((visualElement, index) => ( ))} ); } const styles = StyleSheet.create({ overlay: { position: 'absolute', bottom: 60, right: 10, width: OVERLAY_SCALE * Dimensions.get('window').width, height: OVERLAY_SCALE * Dimensions.get('window').height, backgroundColor: 'gray', opacity: 0.9, }, overlayElement: { position: 'absolute', borderWidth: 1, borderColor: 'black', }, });