Skip to content

Commit 0a37f7f

Browse files
committed
Merge branch 'antonis/4358-Feedback-Form-Autoinject-Button' into antonis/feedback-theme
# Conflicts: # CHANGELOG.md
2 parents 6e7b61b + b3fe27c commit 0a37f7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+580
-183
lines changed

CHANGELOG.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010

1111
### Features
1212

13-
- Add the `FeedbackButton` component that shows the Feedback Widget ([#4378](https://github.com/getsentry/sentry-react-native/pull/4378))
13+
- Adds the `FeedbackButton` component that shows the Feedback Widget ([#4378](https://github.com/getsentry/sentry-react-native/pull/4378))
1414
- Add Feedback Widget theming ([#4677](https://github.com/getsentry/sentry-react-native/pull/4677))
15-
- Improve Warm App Start reporting on Android ([#4641](https://github.com/getsentry/sentry-react-native/pull/4641))
15+
16+
## 6.11.0-beta.0
17+
18+
### Features
19+
20+
- Improve Warm App Start reporting on Android ([#4641](https://github.com/getsentry/sentry-react-native/pull/4641), [#4695](https://github.com/getsentry/sentry-react-native/pull/4695))
21+
- Add `createTimeToInitialDisplay({useFocusEffect})` and `createTimeToFullDisplay({useFocusEffect})` to allow record full display on screen focus ([#4665](https://github.com/getsentry/sentry-react-native/pull/4665))
1622
- Add support for measuring Time to Initial Display for already seen routes ([#4661](https://github.com/getsentry/sentry-react-native/pull/4661))
1723
- Introduce `enableTimeToInitialDisplayForPreloadedRoutes` option to the React Navigation integration.
1824

@@ -22,17 +28,25 @@
2228
});
2329
```
2430

25-
- Add `createTimeToInitialDisplay({useFocusEffect})` and `createTimeToFullDisplay({useFocusEffect})` to allow record full display on screen focus ([#4665](https://github.com/getsentry/sentry-react-native/pull/4665))
31+
- Add `useDispatchedActionData` option to the React Navigation integration to filter out navigation actions that should not create spans ([#4684](https://github.com/getsentry/sentry-react-native/pull/4684))
32+
- For example `PRELOAD`, `SET_PARAMS`, `TOGGLE_DRAWER` and others.
33+
34+
```js
35+
Sentry.reactNavigationIntegration({
36+
useDispatchedActionData: true,
37+
});
38+
```
2639

2740
### Fixes
2841

2942
- Equalize TTID and TTFD duration when TTFD manual API is called and resolved before auto TTID ([#4680](https://github.com/getsentry/sentry-react-native/pull/4680))
43+
- Avoid loading Sentry native components in Expo Go ([#4696](https://github.com/getsentry/sentry-react-native/pull/4696))
3044

3145
### Changes
3246

3347
- Change `gradle.projectsEvaluated` to `project.afterEvaluate` in the Sentry Gradle Plugin to fix tasks not being created when using `--configure-on-demand` ([#4687](https://github.com/getsentry/sentry-react-native/pull/4687))
3448
- Remove `SENTRY_FORCE_FOREGROUND` from Xcode Scripts as the underlying `--force-foreground` Sentry CLI is no-op since v2.37.0 ([#4689](https://github.com/getsentry/sentry-react-native/pull/4689))
35-
- TTID and TTFD use native getters instead of events to pass timestamps to the JS layer ([#4669](https://github.com/getsentry/sentry-react-native/pull/4669))
49+
- TTID and TTFD use native getters instead od events to pass timestamps to the JS layer ([#4669](https://github.com/getsentry/sentry-react-native/pull/4669), [#4681](https://github.com/getsentry/sentry-react-native/pull/4681))
3650

3751
## 6.10.0
3852

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-e2e-tests",
3-
"version": "6.10.0",
3+
"version": "6.11.0-beta.0",
44
"private": true,
55
"description": "Sentry React Native End to End Tests Library",
66
"main": "dist/index.js",
@@ -14,7 +14,7 @@
1414
"@babel/preset-env": "^7.25.3",
1515
"@babel/preset-typescript": "^7.18.6",
1616
"@sentry/core": "8.54.0",
17-
"@sentry/react-native": "6.10.0",
17+
"@sentry/react-native": "6.11.0-beta.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",
2020
"appium": "2.4.1",

dev-packages/type-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sentry-react-native-type-check",
33
"private": true,
4-
"version": "6.10.0",
4+
"version": "6.11.0-beta.0",
55
"scripts": {
66
"type-check": "./run-type-check.sh"
77
}

dev-packages/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-samples-utils",
3-
"version": "6.10.0",
3+
"version": "6.11.0-beta.0",
44
"description": "Internal Samples Utils",
55
"main": "index.js",
66
"license": "MIT",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "6.10.0",
3+
"version": "6.11.0-beta.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.facebook.react.bridge.WritableNativeArray;
3030
import com.facebook.react.bridge.WritableNativeMap;
3131
import com.facebook.react.common.JavascriptException;
32-
import com.facebook.react.modules.core.DeviceEventManagerModule;
3332
import io.sentry.Breadcrumb;
3433
import io.sentry.HubAdapter;
3534
import io.sentry.ILogger;
@@ -154,11 +153,7 @@ private ReactApplicationContext getReactApplicationContext() {
154153
private @NotNull Runnable createEmitNewFrameEvent() {
155154
return () -> {
156155
final SentryDate endDate = dateProvider.now();
157-
WritableMap event = Arguments.createMap();
158-
event.putDouble("newFrameTimestampInSeconds", endDate.nanoTimestamp() / 1e9);
159-
getReactApplicationContext()
160-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
161-
.emit("rn_sentry_new_frame", event);
156+
RNSentryTimeToDisplay.putTimeToInitialDisplayForActiveSpan(endDate.nanoTimestamp() / 1e9);
162157
};
163158
}
164159

@@ -725,6 +720,11 @@ public void popTimeToDisplayFor(String screenId, Promise promise) {
725720
}
726721
}
727722

723+
public boolean setActiveSpanId(@Nullable String spanId) {
724+
RNSentryTimeToDisplay.setActiveSpanId(spanId);
725+
return true; // The return ensure RN executes the code synchronously
726+
}
727+
728728
public void setExtra(String key, String extra) {
729729
if (key == null || extra == null) {
730730
logger.log(

packages/core/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io.sentry.SentryDateProvider;
99
import java.util.LinkedHashMap;
1010
import java.util.Map;
11+
import org.jetbrains.annotations.Nullable;
1112

1213
public final class RNSentryTimeToDisplay {
1314

@@ -22,10 +23,27 @@ protected boolean removeEldestEntry(Map.Entry<String, Double> eldest) {
2223
}
2324
};
2425

26+
/**
27+
* The active span id that is used to attribute the time to display to the active span in case of
28+
* a screen navigation where native time to display is not available to assign the span id
29+
* received from JS.
30+
*/
31+
private static @Nullable String activeSpanId = null;
32+
33+
public static void setActiveSpanId(@Nullable String spanId) {
34+
activeSpanId = spanId;
35+
}
36+
2537
public static Double popTimeToDisplayFor(String screenId) {
2638
return screenIdToRenderDuration.remove(screenId);
2739
}
2840

41+
public static void putTimeToInitialDisplayForActiveSpan(Double value) {
42+
if (activeSpanId != null) {
43+
putTimeToDisplayFor("ttid-navigation-" + activeSpanId, value);
44+
}
45+
}
46+
2947
public static void putTimeToDisplayFor(String screenId, Double value) {
3048
screenIdToRenderDuration.put(screenId, value);
3149
}

packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class RNSentryVersion {
44
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.10.0";
5+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.11.0-beta.0";
66
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
77
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
88
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";

packages/core/android/src/newarch/java/io/sentry/react/RNSentryModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,9 @@ public void getDataFromUri(String uri, Promise promise) {
187187
public void popTimeToDisplayFor(String key, Promise promise) {
188188
this.impl.popTimeToDisplayFor(key, promise);
189189
}
190+
191+
@Override
192+
public boolean setActiveSpanId(String spanId) {
193+
return this.impl.setActiveSpanId(spanId);
194+
}
190195
}

packages/core/android/src/oldarch/java/io/sentry/react/RNSentryModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,9 @@ public void crashedLastRun(Promise promise) {
182182
public void getNewScreenTimeToDisplay(Promise promise) {
183183
this.impl.getNewScreenTimeToDisplay(promise);
184184
}
185+
186+
@ReactMethod
187+
public boolean setActiveSpanId(String spanId) {
188+
return this.impl.setActiveSpanId(spanId);
189+
}
185190
}

packages/core/ios/RNSentry.mm

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,8 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event
288288
- (void)initFramesTracking
289289
{
290290
#if SENTRY_HAS_UIKIT
291-
292291
RNSentryEmitNewFrameEvent emitNewFrameEvent = ^(NSNumber *newFrameTimestampInSeconds) {
293-
if (self->hasListeners) {
294-
[self
295-
sendEventWithName:RNSentryNewFrameEvent
296-
body:@{ @"newFrameTimestampInSeconds" : newFrameTimestampInSeconds }];
297-
}
292+
[RNSentryTimeToDisplay putTimeToInitialDisplayForActiveSpan:newFrameTimestampInSeconds];
298293
};
299294
[[RNSentryDependencyContainer sharedInstance]
300295
initializeFramesTrackerListenerWith:emitNewFrameEvent];
@@ -969,4 +964,10 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
969964
resolve([RNSentryTimeToDisplay popTimeToDisplayFor:key]);
970965
}
971966

967+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, setActiveSpanId : (NSString *)spanId)
968+
{
969+
[RNSentryTimeToDisplay setActiveSpanId:spanId];
970+
return @YES; // The return ensures that the method is synchronous
971+
}
972+
972973
@end

packages/core/ios/RNSentryTimeToDisplay.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ static const int TIME_TO_DISPLAY_ENTRIES_MAX_SIZE = 50;
66

77
+ (NSNumber *)popTimeToDisplayFor:(NSString *)screenId;
88
+ (void)putTimeToDisplayFor:(NSString *)screenId value:(NSNumber *)value;
9+
+ (void)setActiveSpanId:(NSString *)spanId;
10+
+ (void)putTimeToInitialDisplayForActiveSpan:(NSNumber *)timestampSeconds;
911

1012
- (void)getTimeToDisplay:(RCTResponseSenderBlock)callback;
1113

packages/core/ios/RNSentryTimeToDisplay.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,40 @@ @implementation RNSentryTimeToDisplay {
1111
static NSMutableArray<NSString *> *screenIdAge;
1212
static NSUInteger screenIdCurrentIndex;
1313

14+
static NSString *activeSpanId;
15+
1416
+ (void)initialize
1517
{
1618
if (self == [RNSentryTimeToDisplay class]) {
1719
screenIdToRenderDuration =
1820
[[NSMutableDictionary alloc] initWithCapacity:TIME_TO_DISPLAY_ENTRIES_MAX_SIZE];
1921
screenIdAge = [[NSMutableArray alloc] initWithCapacity:TIME_TO_DISPLAY_ENTRIES_MAX_SIZE];
2022
screenIdCurrentIndex = 0;
23+
24+
activeSpanId = nil;
2125
}
2226
}
2327

28+
+ (void)setActiveSpanId:(NSString *)spanId
29+
{
30+
activeSpanId = spanId;
31+
}
32+
2433
+ (NSNumber *)popTimeToDisplayFor:(NSString *)screenId
2534
{
2635
NSNumber *value = screenIdToRenderDuration[screenId];
2736
[screenIdToRenderDuration removeObjectForKey:screenId];
2837
return value;
2938
}
3039

40+
+ (void)putTimeToInitialDisplayForActiveSpan:(NSNumber *)value
41+
{
42+
if (activeSpanId != nil) {
43+
NSString *prefixedSpanId = [@"ttid-navigation-" stringByAppendingString:activeSpanId];
44+
[self putTimeToDisplayFor:prefixedSpanId value:value];
45+
}
46+
}
47+
3148
+ (void)putTimeToDisplayFor:(NSString *)screenId value:(NSNumber *)value
3249
{
3350
if (!screenId)
@@ -77,8 +94,7 @@ - (void)getTimeToDisplay:(RCTResponseSenderBlock)callback
7794
- (void)handleDisplayLink:(CADisplayLink *)link
7895
{
7996
// Get the current time
80-
NSTimeInterval currentTime =
81-
[[NSDate date] timeIntervalSince1970] * 1000.0; // Convert to milliseconds
97+
NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970];
8298

8399
// Ensure the callback is valid and pass the current time back
84100
if (resolveBlock) {

packages/core/ios/RNSentryVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
44
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
55
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6-
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.10.0";
6+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.11.0-beta.0";

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@sentry/react-native",
33
"homepage": "https://github.com/getsentry/sentry-react-native",
44
"repository": "https://github.com/getsentry/sentry-react-native",
5-
"version": "6.10.0",
5+
"version": "6.11.0-beta.0",
66
"description": "Official Sentry SDK for react-native",
77
"typings": "dist/js/index.d.ts",
88
"types": "dist/js/index.d.ts",

packages/core/src/js/NativeRNSentry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface Spec extends TurboModule {
5050
crashedLastRun(): Promise<boolean | undefined | null>;
5151
getDataFromUri(uri: string): Promise<number[]>;
5252
popTimeToDisplayFor(key: string): Promise<number | undefined | null>;
53+
setActiveSpanId(spanId: string): boolean;
5354
}
5455

5556
export type NativeStackFrame = {

packages/core/src/js/integrations/appRegistry.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Client, Integration } from '@sentry/core';
22
import { getClient, logger } from '@sentry/core';
33

4+
import { isWeb } from '../utils/environment';
45
import { fillTyped } from '../utils/fill';
56
import { ReactNativeLibraries } from '../utils/rnlibraries';
67

@@ -14,6 +15,10 @@ export const appRegistryIntegration = (): Integration & {
1415
return {
1516
name: INTEGRATION_NAME,
1617
setupOnce: () => {
18+
if (isWeb()) {
19+
return;
20+
}
21+
1722
patchAppRegistryRunApplication(callbacks);
1823
},
1924
onRunApplication: (callback: () => void) => {
@@ -28,6 +33,9 @@ export const appRegistryIntegration = (): Integration & {
2833

2934
export const patchAppRegistryRunApplication = (callbacks: (() => void)[]): void => {
3035
const { AppRegistry } = ReactNativeLibraries;
36+
if (!AppRegistry) {
37+
return;
38+
}
3139

3240
fillTyped(AppRegistry, 'runApplication', originalRunApplication => {
3341
return (...args) => {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import * as React from 'react';
33
import type { HostComponent, ViewProps } from 'react-native';
44
import { UIManager, View } from 'react-native';
55

6+
import { isExpoGo } from '../utils/environment';
7+
68
const NativeComponentRegistry: {
79
get<T, C extends Record<string, unknown>>(componentName: string, createViewConfig: () => C): HostComponent<T>;
810
// eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -35,7 +37,7 @@ const UnmaskFallback = (viewProps: ViewProps): React.ReactElement => {
3537
const hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager.hasViewManagerConfig && UIManager.hasViewManagerConfig(nativeComponentName);
3638

3739
const Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {
38-
if (!hasViewManagerConfig(MaskNativeComponentName)) {
40+
if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) {
3941
logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`);
4042
return MaskFallback;
4143
}
@@ -48,7 +50,7 @@ const Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {
4850
})()
4951

5052
const Unmask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {
51-
if (!hasViewManagerConfig(UnmaskNativeComponentName)) {
53+
if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) {
5254
logger.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`);
5355
return UnmaskFallback;
5456
}

0 commit comments

Comments
 (0)