UNPKG

bitmovin-player-react-native

Version:

Official React Native bindings for Bitmovin's mobile Player SDKs.

16 lines 566 B
import { useCallback } from 'react'; import { findNodeHandle } from 'react-native'; /** * Create a proxy function that unwraps native events. */ export function useProxy(viewRef) { return useCallback((callback) => (event) => { const eventTargetNodeHandle = event.nativeEvent.target; if (eventTargetNodeHandle !== findNodeHandle(viewRef.current)) { return; } const { target, ...eventWithoutTarget } = event.nativeEvent; callback?.(eventWithoutTarget); }, [viewRef]); } //# sourceMappingURL=useProxy.js.map