diff --git a/packages/core/.npmignore b/packages/core/.npmignore index 19f604c32..bf5fdefe0 100644 --- a/packages/core/.npmignore +++ b/packages/core/.npmignore @@ -11,7 +11,13 @@ !react-native.config.js !/ios/**/* !/android/**/* -!src/**/* + +# New Architecture Codegen +!src/js/NativeRNSentry.ts +!src/js/RNSentryReplayMaskNativeComponent.ts +!src/js/RNSentryReplayUnmaskNativeComponent.ts + +# Scripts !scripts/collect-modules.sh !scripts/copy-debugid.js !scripts/has-sourcemap-debugid.js diff --git a/packages/core/package.json b/packages/core/package.json index 649ee6c51..e648f81a6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -16,7 +16,6 @@ "typescript": { "definition": "dist/js/index.d.ts" }, - "react-native": "src/js/index.ts", "main": "dist/js/index.js", "scripts": { "build": "npx run-s build:sdk downlevel build:tools build:plugin", diff --git a/packages/core/src/js/replay/CustomMask.tsx b/packages/core/src/js/replay/CustomMask.tsx index 6ebc67db4..962288e40 100644 --- a/packages/core/src/js/replay/CustomMask.tsx +++ b/packages/core/src/js/replay/CustomMask.tsx @@ -3,6 +3,11 @@ import * as React from 'react'; import type { HostComponent, ViewProps } from 'react-native'; import { UIManager, View } from 'react-native'; +const NativeComponentRegistry: { + get>(componentName: string, createViewConfig: () => C): HostComponent; +// eslint-disable-next-line @typescript-eslint/no-var-requires +} = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + const MaskNativeComponentName = 'RNSentryReplayMask'; const UnmaskNativeComponentName = 'RNSentryReplayUnmask'; @@ -35,8 +40,9 @@ const Mask = ((): HostComponent | React.ComponentType => { return MaskFallback; } - // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access - return require('../RNSentryReplayMaskNativeComponent').default; + return NativeComponentRegistry.get(MaskNativeComponentName, () => ({ + uiViewClassName: MaskNativeComponentName, + })); })() const Unmask = ((): HostComponent | React.ComponentType => { @@ -45,8 +51,9 @@ const Unmask = ((): HostComponent | React.ComponentType => return UnmaskFallback; } - // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access - return require('../RNSentryReplayUnmaskNativeComponent').default; + return NativeComponentRegistry.get(UnmaskNativeComponentName, () => ({ + uiViewClassName: UnmaskNativeComponentName, + })); })(); export { Mask, Unmask, MaskFallback, UnmaskFallback };