Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 9 additions & 3 deletions samples/react-native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { LogBox, Platform } from 'react-native';
import * as ImagePicker from 'react-native-image-picker';

import RunningIndicator from './components/RunningIndicator';
import BundledPlaygroundScreen from './Screens/BundledPlaygroundScreen';
import WebviewScreen from './Screens/WebviewScreen';
import getErrorsTab from './tabs/ErrorsTab';
import getPerformanceTab from './tabs/PerformanceTab';
Expand Down Expand Up @@ -69,7 +70,7 @@ Sentry.init({
},
logsOrigin: 'all',
enableLogs: true,
beforeSendLog: (log) => {
beforeSendLog: log => {
return log;
},
enableUserInteractionTracing: true,
Expand Down Expand Up @@ -105,7 +106,7 @@ Sentry.init({
Platform.OS === 'ios' && isTurboModuleEnabled()
? // The global patch doesn't work on iOS with the New Architecture in this Sample app
// In
false
false
: true,
}),
Sentry.feedbackIntegration({
Expand Down Expand Up @@ -211,7 +212,7 @@ function BottomTabsNavigator() {
/>
<BottomTabNavigator.Screen
name="PlaygroundTab"
component={getPlaygroundTab()}
component={getPlaygroundTab(StackNavigator)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argument passed to getPlaygroundTab is silently ignored

Low Severity

getPlaygroundTab(StackNavigator) passes StackNavigator as an argument, but getPlaygroundTab is defined with no parameters — so the argument is silently ignored. The other two tab factories (getErrorsTab, getPerformanceTab) accept a Navigator: TypedNavigator<any, any> parameter and use it to create nested navigators, but getPlaygroundTab was never updated to match. This looks like an incomplete refactoring step and could mislead future developers.

Additional Locations (1)

Fix in Cursor Fix in Web

options={{
tabBarLabel: 'Playground',
// eslint-disable-next-line react/no-unstable-nested-components
Expand Down Expand Up @@ -251,6 +252,11 @@ function RootNavigationContainer() {
component={WebviewScreen}
options={{ headerShown: true }}
/>
<StackNavigator.Screen
name="BundledPlayground"
component={BundledPlaygroundScreen}
options={{ headerShown: true }}
/>
</StackNavigator.Navigator>
</NavigationContainer>
);
Expand Down
16 changes: 16 additions & 0 deletions samples/react-native/src/Screens/BundledPlaygroundScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { StackNavigationProp } from '@react-navigation/stack';
import * as Sentry from '@sentry/react-native';
import { withSentryPlayground } from '@sentry/react-native/playground';
import { SafeAreaView } from 'react-native';

interface Props {
navigation: StackNavigationProp<any, 'SDKPlaygroundScreen'>;
}

const BundledPlaygroundScreen = withSentryPlayground(
Sentry.withProfiler((_: Props) => {
return <SafeAreaView />;
}),
);

export default BundledPlaygroundScreen;
13 changes: 13 additions & 0 deletions samples/react-native/src/tabs/PlaygroundTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const styles = StyleSheet.create({
padding: 5,
flex: 1,
},
separator: {
marginVertical: 8,
},
image: {
width: 200,
height: 200,
Expand All @@ -56,6 +59,8 @@ const styles = StyleSheet.create({
},
});

const Separator = () => <View style={styles.separator} />;

export default function getPlaygroundTab() {
return Sentry.withProfiler(
(props: Props) => {
Expand All @@ -72,6 +77,14 @@ export default function getPlaygroundTab() {
props.navigation.navigate('Webview');
}}
/>
<Separator />
<Button
title="Playground Integration"
onPress={() => {
props.navigation.navigate('BundledPlayground');
}}
/>
<Separator />
<Text>Custom Mask:</Text>
<View>
<Sentry.Unmask>
Expand Down
Loading