import React, { memo, useCallback } from "react"; import { requireNativeComponent, View } from "react-native"; import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils"; const TrackedViewComponent: any = requireNativeComponent("TrackedView"); type TrackedViewNativeProps = { nativeEvent: { rect?: Record }; }; type TrackedViewProps = { children?: React.ReactNode; onPositionUpdated: (props: { rect?: Record }) => void; testId?: string | undefined; groupId?: string; clipThreshold?: number; }; export const TrackedView = memo(function TrackedView(props: TrackedViewProps) { const children = props.children; const onPositionUpdated = useCallback( (event: TrackedViewNativeProps) => { props.onPositionUpdated(event.nativeEvent); }, [props.onPositionUpdated] ); if (isTV()) { return {children}; } return ( {children} ); });