Skip to content

feat: update sample app #1400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ public String getName() {
}

@ReactMethod
public void sendNativeNonFatal(final String exceptionObject) {
public void sendNativeNonFatal() {
final IBGNonFatalException exception = new IBGNonFatalException.Builder(new IllegalStateException("Test exception"))
.build();
CrashReporting.report(exception);

}

@ReactMethod
Expand Down
10 changes: 8 additions & 2 deletions examples/default/src/components/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface InputFieldProps {
maxLength?: number;
accessibilityLabel?: string;
flex?: number;
testID?: string;
}

export const InputField = forwardRef<TextInput, InputFieldProps>(
Expand All @@ -34,6 +35,7 @@ export const InputField = forwardRef<TextInput, InputFieldProps>(
maxLength,
keyboardType,
errorText,
testID,
...restProps
},
ref,
Expand All @@ -43,11 +45,14 @@ export const InputField = forwardRef<TextInput, InputFieldProps>(
<TextInput
ref={ref}
placeholder={placeholder}
placeholderTextColor={'gray'}
style={[styles.textInput, style]}
maxLength={maxLength}
accessible={true}
accessibilityLabel={accessibilityLabel}
keyboardType={keyboardType}
value={value}
testID={testID}
onChangeText={onChangeText}
{...restProps}
/>
Expand All @@ -63,9 +68,10 @@ const styles = StyleSheet.create({
borderWidth: 1,
borderColor: '#ccc',
paddingVertical: 10,
paddingHorizontal: 24,
fontSize: 16,
paddingHorizontal: 16,
fontSize: 12,
borderRadius: 5,
color: 'black',
},
errorText: {
color: '#ff0000',
Expand Down
29 changes: 26 additions & 3 deletions examples/default/src/components/ListTile.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
import React, { PropsWithChildren } from 'react';

import { Box, HStack, Pressable, Text } from 'native-base';
import { Box, HStack, Pressable, Text, VStack } from 'native-base';

interface ListTileProps extends PropsWithChildren {
title: string;
subtitle?: string;
onPress?: () => void;
testID?: string;
truncateSubtitle?: boolean;
}

export const ListTile: React.FC<ListTileProps> = ({ title, onPress, children }) => {
export const ListTile: React.FC<ListTileProps> = ({
title,
subtitle,
onPress,
children,
testID,
truncateSubtitle = false,
}) => {
return (
<Pressable
onPress={onPress}
p="4"
rounded="2"
testID={testID}
shadow="1"
accessible={true}
borderBottomWidth="1"
borderColor="coolGray.300"
bg="coolGray.100"
_pressed={{ bg: 'coolGray.200' }}>
<HStack justifyContent="space-between" alignItems="center">
<Text>{title}</Text>
<VStack space={2}>
<Text>{title}</Text>
{subtitle && (
<Text
fontSize="xs"
color="coolGray.500"
numberOfLines={truncateSubtitle ? 1 : undefined}
ellipsizeMode={truncateSubtitle ? 'tail' : undefined}>
{subtitle}
</Text>
)}
</VStack>
<Box width={160}>{children}</Box>
</HStack>
</Pressable>
Expand Down
5 changes: 4 additions & 1 deletion examples/default/src/components/PlatformListTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ interface PlatformListTileProps extends PropsWithChildren {
title: string;
onPress?: () => void;
platform?: 'ios' | 'android';
testID?: string;
}

export const PlatformListTile: React.FC<PlatformListTileProps> = ({
title,
onPress,
platform,
children,
testID,
}) => {
if (Platform.OS === platform || !platform) {
return (
Expand All @@ -25,7 +27,8 @@ export const PlatformListTile: React.FC<PlatformListTileProps> = ({
borderBottomWidth="1"
borderColor="coolGray.300"
bg="coolGray.100"
_pressed={{ bg: 'coolGray.200' }}>
_pressed={{ bg: 'coolGray.200' }}
testID={testID}>
<HStack justifyContent="space-between" alignItems="center">
<Text>{title}</Text>
<Box width={160}>{children}</Box>
Expand Down
11 changes: 9 additions & 2 deletions examples/default/src/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ interface SelectItem<T> {
label: string;
value: T;
isInitial?: boolean;
testID?: string;
}

interface SelectProps<T> {
label: string;
items: SelectItem<T>[];
onValueChange: (value: T) => void;
testID?: string;
}

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

Expand All @@ -35,7 +37,12 @@ export function Select<T>({ label, items, onValueChange }: SelectProps<T>) {
endIcon: <CheckIcon size="4" />,
}}>
{items.map((item) => (
<NativeBaseSelect.Item key={item.label} label={item.label} value={item.label} />
<NativeBaseSelect.Item
key={item.label}
label={item.label}
value={item.label}
testID={testID}
/>
))}
</NativeBaseSelect>
);
Expand Down
143 changes: 142 additions & 1 deletion examples/default/src/navigation/HomeStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,41 @@ import React from 'react';

import { createNativeStackNavigator } from '@react-navigation/native-stack';

import { BugReportingScreen } from '../screens/BugReportingScreen';
import { BugReportingScreen } from '../screens/bug-reporting/BugReportingScreen';
import {
BugReportingStateScreen,
type BugReportingStateScreenProp,
} from '../screens/bug-reporting/BugReportingStateScreen';
import {
ExtendedBugReportStateScreen,
type ExtendedBugReportStateScreenProp,
} from '../screens/bug-reporting/ExtendedBugReportStateScreen';
import {
BugReportingTypesScreen,
type BugReportingTypesScreenProp,
} from '../screens/bug-reporting/BugReportingTypesScreen';
import {
DisclaimerTextScreen,
type DisclaimerTextScreenProp,
} from '../screens/bug-reporting/DisclaimerTextScreen';
import {
InvocationOptionsScreen,
type InvocationOptionsScreenProp,
} from '../screens/bug-reporting/InvocationOptionsScreen';
import {
ViewHierarchyScreen,
type ViewHierarchyScreenProp,
} from '../screens/bug-reporting/ViewHierarchyScreen';
import {
RepliesStateScreen,
type RepliesStateScreenProp,
} from '../screens/bug-reporting/RepliesStateScreen';
import { UserConsentScreen } from '../screens/bug-reporting/UserConsentScreen';
import { CrashReportingScreen } from '../screens/CrashReportingScreen';
import {
CrashReportingStateScreen,
type CrashReportingStateScreenProp,
} from '../screens/crash-reporting/CrashReportingStateScreen';
import { FeatureRequestsScreen } from '../screens/FeatureRequestsScreen';
import { HomeScreen } from '../screens/HomeScreen';
import { RepliesScreen } from '../screens/RepliesScreen';
Expand Down Expand Up @@ -31,11 +64,44 @@ import { HttpScreen } from '../screens/apm/HttpScreen';
import { WebViewsScreen } from '../screens/apm/webViews/WebViewsScreen';
import { FullWebViewsScreen } from '../screens/apm/webViews/FullWebViewsScreen';
import { PartialWebViewsScreen } from '../screens/apm/webViews/PartialWebViewsScreen';
import {
InvocationEventsScreen,
type InvocationEventsScreenProp,
} from '../screens/bug-reporting/InvocationEventsScreen';
import {
SessionProfilerScreen,
type SessionProfilerScreenProp,
} from '../screens/bug-reporting/SessionProfilerScreen';
import {
NDKCrashesStateScreen,
type NDKCrashesStateScreenProp,
} from '../screens/crash-reporting/NDKCrashesStateScreen';
import { NonFatalCrashesScreen } from '../screens/crash-reporting/NonFatalCrashesScreen';
import { FatalCrashesScreen } from '../screens/crash-reporting/FatalCrashesScreen';

export type HomeStackParamList = {
Home: undefined;

// Bug Reporting //
BugReporting: undefined;
BugReportingState: BugReportingStateScreenProp;
ExtendedBugReportState: ExtendedBugReportStateScreenProp;
BugReportingTypes: BugReportingTypesScreenProp;
DisclaimerText: DisclaimerTextScreenProp;
InvocationEvents: InvocationEventsScreenProp;
SessionProfiler: SessionProfilerScreenProp;
InvocationOptions: InvocationOptionsScreenProp;
ViewHierarchy: ViewHierarchyScreenProp;
RepliesState: RepliesStateScreenProp;
UserConsent: undefined;

// Crash Reporting //
CrashReporting: undefined;
CrashReportingState: CrashReportingStateScreenProp;
NDKCrashesState: NDKCrashesStateScreenProp;
NonFatalCrashes: undefined;
FatalCrashes: undefined;

FeatureRequests: undefined;
Replies: undefined;
Surveys: undefined;
Expand Down Expand Up @@ -69,16 +135,91 @@ export const HomeStackNavigator: React.FC = () => {
return (
<HomeStack.Navigator>
<HomeStack.Screen name="Home" component={HomeScreen} />

{/* Bug Reporting */}
<HomeStack.Screen
name="BugReporting"
component={BugReportingScreen}
options={{ title: 'Bug Reporting' }}
/>
<HomeStack.Screen
name="BugReportingState"
component={BugReportingStateScreen}
options={{ title: 'Bug Reporting State' }}
/>
<HomeStack.Screen
name="ExtendedBugReportState"
component={ExtendedBugReportStateScreen}
options={{ title: 'Extended Bug Report State' }}
/>
<HomeStack.Screen
name="BugReportingTypes"
component={BugReportingTypesScreen}
options={{ title: 'Bug Reporting Types' }}
/>
<HomeStack.Screen
name="DisclaimerText"
component={DisclaimerTextScreen}
options={{ title: 'Disclaimer Text' }}
/>
<HomeStack.Screen
name="InvocationEvents"
component={InvocationEventsScreen}
options={{ title: 'Invocation Events' }}
/>
<HomeStack.Screen
name="SessionProfiler"
component={SessionProfilerScreen}
options={{ title: 'Session Profiler' }}
/>
<HomeStack.Screen
name="InvocationOptions"
component={InvocationOptionsScreen}
options={{ title: 'Invocation Options' }}
/>
<HomeStack.Screen
name="ViewHierarchy"
component={ViewHierarchyScreen}
options={{ title: 'View Hierarchy' }}
/>
<HomeStack.Screen
name="RepliesState"
component={RepliesStateScreen}
options={{ title: 'Replies State' }}
/>
<HomeStack.Screen
name="UserConsent"
component={UserConsentScreen}
options={{ title: 'User Consent' }}
/>

{/* Crash Reporting */}
<HomeStack.Screen
name="CrashReporting"
component={CrashReportingScreen}
options={{ title: 'Crash Reporting' }}
/>
<HomeStack.Screen
name="CrashReportingState"
component={CrashReportingStateScreen}
options={{ title: 'Crash Reporting State' }}
/>
<HomeStack.Screen
name="NDKCrashesState"
component={NDKCrashesStateScreen}
options={{ title: 'NDK Crashes State' }}
/>
<HomeStack.Screen
name="NonFatalCrashes"
component={NonFatalCrashesScreen}
options={{ title: 'Non-Fatal Crashes' }}
/>
<HomeStack.Screen
name="FatalCrashes"
component={FatalCrashesScreen}
options={{ title: 'Fatal Crashes' }}
/>

<HomeStack.Screen
name="FeatureRequests"
component={FeatureRequestsScreen}
Expand Down
Loading