Skip to content

Commit d46a941

Browse files
committed
feat: add crash reporting screens and enhance navigation
- Introduced `CrashReportingStateScreen`, `NDKCrashesStateScreen`, `NonFatalCrashesScreen`, and `FatalCrashesScreen` for managing crash reporting states and handling different crash types. - Updated `HomeStack` to include new screens for crash reporting. - Enhanced `CrashReportingScreen` to navigate to the new state management screens and improved UI interactions. - Added test IDs for better integration with testing frameworks.
1 parent b7b951a commit d46a941

File tree

10 files changed

+517
-288
lines changed

10 files changed

+517
-288
lines changed

examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleCrashReportingModule.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public void sendNativeNonFatal() {
3232
final IBGNonFatalException exception = new IBGNonFatalException.Builder(new IllegalStateException("Test exception"))
3333
.build();
3434
CrashReporting.report(exception);
35-
3635
}
3736

3837
@ReactMethod

examples/default/src/components/InputField.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const InputField = forwardRef<TextInput, InputFieldProps>(
4545
<TextInput
4646
ref={ref}
4747
placeholder={placeholder}
48+
placeholderTextColor={'gray'}
4849
style={[styles.textInput, style]}
4950
maxLength={maxLength}
5051
accessible={true}
@@ -67,9 +68,10 @@ const styles = StyleSheet.create({
6768
borderWidth: 1,
6869
borderColor: '#ccc',
6970
paddingVertical: 10,
70-
paddingHorizontal: 24,
71-
fontSize: 16,
71+
paddingHorizontal: 16,
72+
fontSize: 12,
7273
borderRadius: 5,
74+
color: 'black',
7375
},
7476
errorText: {
7577
color: '#ff0000',

examples/default/src/components/PlatformListTile.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ interface PlatformListTileProps extends PropsWithChildren {
77
title: string;
88
onPress?: () => void;
99
platform?: 'ios' | 'android';
10+
testID?: string;
1011
}
1112

1213
export const PlatformListTile: React.FC<PlatformListTileProps> = ({
1314
title,
1415
onPress,
1516
platform,
1617
children,
18+
testID,
1719
}) => {
1820
if (Platform.OS === platform || !platform) {
1921
return (
@@ -25,7 +27,8 @@ export const PlatformListTile: React.FC<PlatformListTileProps> = ({
2527
borderBottomWidth="1"
2628
borderColor="coolGray.300"
2729
bg="coolGray.100"
28-
_pressed={{ bg: 'coolGray.200' }}>
30+
_pressed={{ bg: 'coolGray.200' }}
31+
testID={testID}>
2932
<HStack justifyContent="space-between" alignItems="center">
3033
<Text>{title}</Text>
3134
<Box width={160}>{children}</Box>

examples/default/src/components/Select.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ interface SelectItem<T> {
66
label: string;
77
value: T;
88
isInitial?: boolean;
9+
testID?: string;
910
}
1011

1112
interface SelectProps<T> {
1213
label: string;
1314
items: SelectItem<T>[];
1415
onValueChange: (value: T) => void;
16+
testID?: string;
1517
}
1618

17-
export function Select<T>({ label, items, onValueChange }: SelectProps<T>) {
19+
export function Select<T>({ label, items, onValueChange, testID }: SelectProps<T>) {
1820
const initialItem = items.find((i) => i.isInitial) ?? items[0];
1921
const [selectedItem, setSelectedItem] = useState(initialItem);
2022

@@ -35,7 +37,7 @@ export function Select<T>({ label, items, onValueChange }: SelectProps<T>) {
3537
endIcon: <CheckIcon size="4" />,
3638
}}>
3739
{items.map((item) => (
38-
<NativeBaseSelect.Item key={item.label} label={item.label} value={item.label} />
40+
<NativeBaseSelect.Item key={item.label} label={item.label} value={item.label} testID={testID} />
3941
))}
4042
</NativeBaseSelect>
4143
);

examples/default/src/navigation/HomeStack.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ import {
3232
type RepliesStateScreenProp,
3333
} from '../screens/bug-reporting/RepliesStateScreen';
3434
import { CrashReportingScreen } from '../screens/CrashReportingScreen';
35+
import {
36+
CrashReportingStateScreen,
37+
type CrashReportingStateScreenProp,
38+
} from '../screens/crash-reporting/CrashReportingStateScreen';
3539
import { FeatureRequestsScreen } from '../screens/FeatureRequestsScreen';
3640
import { HomeScreen } from '../screens/HomeScreen';
3741
import { RepliesScreen } from '../screens/RepliesScreen';
@@ -67,6 +71,12 @@ import {
6771
SessionProfilerScreen,
6872
type SessionProfilerScreenProp,
6973
} from '../screens/bug-reporting/SessionProfilerScreen';
74+
import {
75+
NDKCrashesStateScreen,
76+
type NDKCrashesStateScreenProp,
77+
} from '../screens/crash-reporting/NDKCrashesStateScreen';
78+
import { NonFatalCrashesScreen } from '../screens/crash-reporting/NonFatalCrashesScreen';
79+
import { FatalCrashesScreen } from '../screens/crash-reporting/FatalCrashesScreen';
7080

7181
export type HomeStackParamList = {
7282
Home: undefined;
@@ -83,7 +93,13 @@ export type HomeStackParamList = {
8393
ViewHierarchy: ViewHierarchyScreenProp;
8494
RepliesState: RepliesStateScreenProp;
8595

96+
// Crash Reporting //
8697
CrashReporting: undefined;
98+
CrashReportingState: CrashReportingStateScreenProp;
99+
NDKCrashesState: NDKCrashesStateScreenProp;
100+
NonFatalCrashes: undefined;
101+
FatalCrashes: undefined;
102+
87103
FeatureRequests: undefined;
88104
Replies: undefined;
89105
Surveys: undefined;
@@ -170,11 +186,33 @@ export const HomeStackNavigator: React.FC = () => {
170186
options={{ title: 'Replies State' }}
171187
/>
172188

189+
{/* Crash Reporting */}
173190
<HomeStack.Screen
174191
name="CrashReporting"
175192
component={CrashReportingScreen}
176193
options={{ title: 'Crash Reporting' }}
177194
/>
195+
<HomeStack.Screen
196+
name="CrashReportingState"
197+
component={CrashReportingStateScreen}
198+
options={{ title: 'Crash Reporting State' }}
199+
/>
200+
<HomeStack.Screen
201+
name="NDKCrashesState"
202+
component={NDKCrashesStateScreen}
203+
options={{ title: 'NDK Crashes State' }}
204+
/>
205+
<HomeStack.Screen
206+
name="NonFatalCrashes"
207+
component={NonFatalCrashesScreen}
208+
options={{ title: 'Non-Fatal Crashes' }}
209+
/>
210+
<HomeStack.Screen
211+
name="FatalCrashes"
212+
component={FatalCrashesScreen}
213+
options={{ title: 'Fatal Crashes' }}
214+
/>
215+
178216
<HomeStack.Screen
179217
name="FeatureRequests"
180218
component={FeatureRequestsScreen}

0 commit comments

Comments
 (0)