Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
0fc1b42
feat(replay): Add SentryMask and SentryUnmask native components
krystofwoldrich Oct 31, 2024
9933a86
add clang-format
krystofwoldrich Nov 4, 2024
e17ac31
apply the formatter
krystofwoldrich Nov 4, 2024
534cbce
Merge remote-tracking branch 'origin/main' into kw/feat/replay-custom…
krystofwoldrich Nov 4, 2024
ef863a1
Merge remote-tracking branch 'origin/main' into kw/internal/clag-format
krystofwoldrich Nov 4, 2024
d317e1e
Merge branch 'kw/internal/clag-format' into kw/feat/replay-custom-red…
krystofwoldrich Nov 4, 2024
eb9d2de
fix clang format
krystofwoldrich Nov 4, 2024
cbf400a
add native architecture masks for ios
krystofwoldrich Nov 5, 2024
be04dfc
Merge remote-tracking branch 'origin/main' into kw/feat/replay-custom…
krystofwoldrich Nov 5, 2024
77691bd
add js tests
krystofwoldrich Nov 5, 2024
45374be
fix eslint changing the native props interface to type
krystofwoldrich Nov 6, 2024
0a127d2
Fix mask components for non uikit builds
krystofwoldrich Nov 6, 2024
4f5b967
add changelog
krystofwoldrich Nov 6, 2024
eb64e8d
fix typo
krystofwoldrich Nov 6, 2024
32c45e4
fix ts3.8 type check test
krystofwoldrich Nov 6, 2024
691f8f4
Merge branch 'kw/fix/type-check' into kw/feat/replay-custom-redact-an…
krystofwoldrich Nov 6, 2024
02bb913
fix new arch build decoupled replay and replay mask
krystofwoldrich Nov 6, 2024
5315bb2
fix missing react native types
krystofwoldrich Nov 6, 2024
f07f155
Merge branch 'kw/fix/type-check' into kw/feat/replay-custom-redact-co…
krystofwoldrich Nov 6, 2024
1b1c435
Merge branch 'main' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 8, 2024
cdd3da8
Update mask sample
krystofwoldrich Nov 8, 2024
1170838
fix rn unmask class is added to unmask array
krystofwoldrich Nov 8, 2024
3a9e155
fix tests for custom classes
krystofwoldrich Nov 8, 2024
c02d06c
Update samples/react-native/src/App.tsx
krystofwoldrich Nov 11, 2024
9fe9c24
update redact example
krystofwoldrich Nov 11, 2024
845c260
fix changelog and macos sample
krystofwoldrich Nov 11, 2024
2edaeb0
fix rnsentry impl
krystofwoldrich Nov 11, 2024
503c992
Merge branch 'main' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 11, 2024
4f88064
fix class names tests
krystofwoldrich Nov 11, 2024
ddffa75
Merge branch 'kw/feat/replay-custom-redact-components' of github.com:…
krystofwoldrich Nov 11, 2024
e0ccb78
Update samples/react-native-macos/src/Screens/PlaygroundScreen.tsx
krystofwoldrich Nov 11, 2024
711e547
feat(replay): Add Mask and Unmask Android New Arch implementation
krystofwoldrich Nov 11, 2024
ed81fd7
use mask containers
krystofwoldrich Nov 12, 2024
dd2c350
Add backwards compatibility with legacy architecture
krystofwoldrich Nov 12, 2024
30586a3
revert disable profiling
krystofwoldrich Nov 12, 2024
1ebf033
feat(replay): Add Mask and Unmask Wrappers for react-native-web
krystofwoldrich Nov 13, 2024
feedb68
Add implementation explanation
krystofwoldrich Nov 13, 2024
d16bc9a
Merge branch '6.3.0-beta' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 21, 2024
32ddafe
Merge branch 'kw/feat/replay-custom-redact-components' into kw/feat/r…
krystofwoldrich Nov 21, 2024
11876b3
Merge branch 'kw/feat/replay-custom-redact-android' into kw/feat/add-…
krystofwoldrich Nov 21, 2024
d9cc0d9
fix custom fallback tests
krystofwoldrich Nov 21, 2024
e665141
Fix lint and typos
krystofwoldrich Nov 21, 2024
050acad
use mask/unmask classes directly
krystofwoldrich Nov 21, 2024
d50ffe2
fix changelog
krystofwoldrich Nov 21, 2024
414590c
Merge branch '6.3.0-beta' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 22, 2024
fad832e
Merge branch 'kw/feat/replay-custom-redact-components' into kw/feat/r…
krystofwoldrich Nov 22, 2024
eacc487
fix changelog
krystofwoldrich Nov 22, 2024
2783b2e
Merge branch 'kw/feat/replay-custom-redact-android' into kw/feat/add-…
krystofwoldrich Nov 22, 2024
eb457fc
fix old RN builds, remove ts from shipped package
krystofwoldrich Nov 23, 2024
5965c22
Merge branch '6.3.0-beta' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 25, 2024
b41d759
fix custom mask tests
krystofwoldrich Nov 25, 2024
ab42222
Merge branch 'kw/feat/replay-custom-redact-components' into kw/feat/r…
krystofwoldrich Nov 25, 2024
8eaa867
add native component registry access explanation
krystofwoldrich Nov 25, 2024
4e18dc4
Apply suggestions from code review
krystofwoldrich Nov 25, 2024
aef7146
Merge branch 'kw/feat/replay-custom-redact-components' into kw/feat/r…
krystofwoldrich Nov 25, 2024
71664ae
use deprecated ReactModuleInfo constructor
krystofwoldrich Nov 25, 2024
af13626
fix lint
krystofwoldrich Nov 25, 2024
e77e2eb
Merge branch 'kw/feat/replay-custom-redact-components' into kw/feat/r…
krystofwoldrich Nov 25, 2024
2189770
remove unintentional sample text element
krystofwoldrich Nov 25, 2024
ea29667
Merge branch 'kw/feat/replay-custom-redact-android' into kw/feat/add-…
krystofwoldrich Nov 25, 2024
147d175
remove unnecessary div selector
krystofwoldrich Nov 25, 2024
79b3844
fix lint
krystofwoldrich Nov 25, 2024
f509e9d
Merge branch 'main' into kw/feat/add-custom-mask-for-web
krystofwoldrich Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

### Features

- Add Replay Custom Masking for iOS and Android ([#4224](https://github.com/getsentry/sentry-react-native/pull/4224), [#4265](https://github.com/getsentry/sentry-react-native/pull/4265))
- Add Replay Custom Masking for iOS, Android and Web ([#4224](https://github.com/getsentry/sentry-react-native/pull/4224), [#4265](https://github.com/getsentry/sentry-react-native/pull/4265), [#4272](https://github.com/getsentry/sentry-react-native/pull/4272))

```jsx
import * as Sentry from '@sentry/react-native';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { viewHierarchyIntegration } from './viewhierarchy';
export { expoContextIntegration } from './expocontext';
export { spotlightIntegration } from './spotlight';
export { mobileReplayIntegration } from '../replay/mobilereplay';
export { browserReplayIntegration } from '../replay/browserReplay';
export { appStartIntegration } from '../tracing/integrations/appStart';
export { nativeFramesIntegration, createNativeFramesIntegrations } from '../tracing/integrations/nativeFrames';
export { stallTrackingIntegration } from '../tracing/integrations/stalltracking';
Expand All @@ -30,5 +31,4 @@ export {
inboundFiltersIntegration,
linkedErrorsIntegration as browserLinkedErrorsIntegration,
rewriteFramesIntegration,
replayIntegration as browserReplayIntegration,
} from '@sentry/react';
34 changes: 26 additions & 8 deletions packages/core/src/js/replay/CustomMask.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,35 @@ import * as React from 'react';
import type { ViewProps } from 'react-native';
import { View } from 'react-native';

// Wrapping children in a View and div can cause styling issues
// but with the current implementation of react-native-web
// we can't avoid it.
//
// <View unknown-prop /> the prop is dropped by react-native-web
// https://github.com/necolas/react-native-web/blob/a5ba27c6226aa182979a9cff8cc23c0f5caa4d88/packages/react-native-web/src/exports/View/index.js#L47
//
// So we need to wrap the children in a react-dom div.
// We are using className instead of data-attribute to
// allow for easier CSS styling adjustments.

const Mask = (props: ViewProps): React.ReactElement => {
// We have to ensure that the warning is visible even if the app is running without debug
// eslint-disable-next-line no-console
console.warn('[SentrySessionReplay] Mask component is not supported on web.');
return <View {...props} />;
return (
<View {...props}>
<div className='sentry-react-native-mask'>
{props.children}
</div>
</View>
);
};

const Unmask = (props: ViewProps): React.ReactElement => {
// We have to ensure that the warning is visible even if the app is running without debug
// eslint-disable-next-line no-console
console.warn('[SentrySessionReplay] Unmask component is not supported on web.');
return <View {...props} />;
return (
<View {...props}>
<div className='sentry-react-native-unmask'>
{props.children}
</div>
</View>
);
};

export { Mask, Unmask };
13 changes: 13 additions & 0 deletions packages/core/src/js/replay/browserReplay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { replayIntegration } from '@sentry/react';

const browserReplayIntegration = (
options: Parameters<typeof replayIntegration>[0] = {},
): ReturnType<typeof replayIntegration> => {
return replayIntegration({
...options,
mask: ['.sentry-react-native-mask', ...(options.mask || [])],
unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],
});
};

export { browserReplayIntegration };
2 changes: 2 additions & 0 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"extends": "./node_modules/@sentry-internal/typescript/tsconfig.json",
"include": [
"./src/js/*.ts",
"./src/js/*.tsx",
"./src/js/**/*.web.ts",
"./src/js/**/*.web.tsx",
"./typings/react-native.d.ts"
],
"exclude": ["node_modules"],
Expand Down
11 changes: 11 additions & 0 deletions samples/expo/app/(tabs)/two.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StyleSheet } from 'react-native';
import * as Sentry from '@sentry/react-native';

import EditScreenInfo from '@/components/EditScreenInfo';
import { Text, View } from '@/components/Themed';
Expand All @@ -8,6 +9,16 @@ export default function TabTwoScreen() {
<View style={styles.container}>
<Text style={styles.title}>Tab Two</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<Sentry.Unmask>
<Text>This is unmasked because it's direct child of Sentry.Unmask (can be masked if Sentry.Masked is used higher in the hierarchy)</Text>
<Sentry.Mask>
<Text>This is masked always because it's a child of a Sentry.Mask</Text>
<Sentry.Unmask>
{/* Sentry.Unmask does not override the Sentry.Mask from above in the hierarchy */}
<Text>This is masked always because it's a child of Sentry.Mask</Text>
</Sentry.Unmask>
</Sentry.Mask>
</Sentry.Unmask>
<EditScreenInfo path="app/(tabs)/two.tsx" />
</View>
);
Expand Down
1 change: 1 addition & 0 deletions samples/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ process.env.EXPO_SKIP_DURING_EXPORT !== 'true' && Sentry.init({
}),
navigationIntegration,
Sentry.reactNativeTracingIntegration(),
Sentry.browserReplayIntegration(),
);
return integrations.filter(i => i.name !== 'Dedupe');
},
Expand Down
Loading