@@ -3,6 +3,11 @@ import * as React from 'react';
33import type { HostComponent , ViewProps } from 'react-native' ;
44import { UIManager , View } from 'react-native' ;
55
6+ const NativeComponentRegistry : {
7+ get < T , C extends Record < string , unknown > > ( componentName : string , createViewConfig : ( ) => C ) : HostComponent < T > ;
8+ // eslint-disable-next-line @typescript-eslint/no-var-requires
9+ } = require ( 'react-native/Libraries/NativeComponent/NativeComponentRegistry' ) ;
10+
611const MaskNativeComponentName = 'RNSentryReplayMask' ;
712const UnmaskNativeComponentName = 'RNSentryReplayUnmask' ;
813
@@ -35,8 +40,9 @@ const Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {
3540 return MaskFallback ;
3641 }
3742
38- // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
39- return require ( '../RNSentryReplayMaskNativeComponent' ) . default ;
43+ return NativeComponentRegistry . get ( MaskNativeComponentName , ( ) => ( {
44+ uiViewClassName : MaskNativeComponentName ,
45+ } ) ) ;
4046} ) ( )
4147
4248const Unmask = ( ( ) : HostComponent < ViewProps > | React . ComponentType < ViewProps > => {
@@ -45,8 +51,9 @@ const Unmask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> =>
4551 return UnmaskFallback ;
4652 }
4753
48- // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
49- return require ( '../RNSentryReplayUnmaskNativeComponent' ) . default ;
54+ return NativeComponentRegistry . get ( UnmaskNativeComponentName , ( ) => ( {
55+ uiViewClassName : UnmaskNativeComponentName ,
56+ } ) ) ;
5057} ) ( ) ;
5158
5259export { Mask , Unmask , MaskFallback , UnmaskFallback } ;
0 commit comments