Skip to content

Commit eb457fc

Browse files
fix old RN builds, remove ts from shipped package
1 parent 414590c commit eb457fc

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

packages/core/.npmignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
!react-native.config.js
1212
!/ios/**/*
1313
!/android/**/*
14-
!src/**/*
14+
15+
# New Architecture Codegen
16+
!src/js/NativeRNSentry.ts
17+
!src/js/RNSentryReplayMaskNativeComponent.ts
18+
!src/js/RNSentryReplayUnmaskNativeComponent.ts
19+
20+
# Scripts
1521
!scripts/collect-modules.sh
1622
!scripts/copy-debugid.js
1723
!scripts/has-sourcemap-debugid.js

packages/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"typescript": {
1717
"definition": "dist/js/index.d.ts"
1818
},
19-
"react-native": "src/js/index.ts",
2019
"main": "dist/js/index.js",
2120
"scripts": {
2221
"build": "npx run-s build:sdk downlevel build:tools build:plugin",

packages/core/src/js/replay/CustomMask.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import * as React from 'react';
33
import type { HostComponent, ViewProps } from 'react-native';
44
import { 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+
611
const MaskNativeComponentName = 'RNSentryReplayMask';
712
const 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

4248
const 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

5259
export { Mask, Unmask, MaskFallback, UnmaskFallback };

0 commit comments

Comments
 (0)