Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f64b0f

Browse files
chore: add ComplexViews to APM screen
1 parent 16050df commit 6f64b0f

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import { type DimensionValue, View } from 'react-native';
3+
4+
// Define the component type with static properties
5+
interface CustomGapComponent extends React.FC<{ height?: DimensionValue; width?: DimensionValue }> {
6+
small: JSX.Element;
7+
smallV: JSX.Element;
8+
smallH: JSX.Element;
9+
large: JSX.Element;
10+
largeV: JSX.Element;
11+
largeH: JSX.Element;
12+
}
13+
14+
const defaultDimensionValue = 16;
15+
16+
// Define the CustomGap component
17+
const CustomGap: CustomGapComponent = ({ height, width }) => {
18+
return (
19+
<View
20+
style={{ width: width ?? defaultDimensionValue, height: height ?? defaultDimensionValue }}
21+
/>
22+
);
23+
};
24+
25+
// Assign static properties for predefined gaps
26+
CustomGap.small = <CustomGap height={8} width={8} />;
27+
CustomGap.large = <CustomGap height={32} width={32} />;
28+
CustomGap.smallV = <CustomGap height={8} />;
29+
CustomGap.largeV = <CustomGap height={32} />;
30+
CustomGap.smallH = <CustomGap width={8} />;
31+
CustomGap.largeH = <CustomGap width={32} />;
32+
33+
export default CustomGap;

examples/default/src/screens/apm/APMScreen.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import type { HomeStackParamList } from '../../navigation/HomeStack';
33
import React, { useState } from 'react';
44
import { ListTile } from '../../components/ListTile';
55
import { Screen } from '../../components/Screen';
6-
import { Text, Switch } from 'react-native';
6+
import { Switch, Text } from 'react-native';
77
import { APM } from 'instabug-reactnative';
88
import { showNotification } from '../../utils/showNotification';
9+
import CustomGap from '../../components/CustomGap';
910

1011
export const APMScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'APM'>> = ({
1112
navigation,
@@ -21,12 +22,15 @@ export const APMScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'APM
2122
return (
2223
<Screen>
2324
<Text>Enable APM:</Text>
25+
{CustomGap.smallV}
2426
<Switch onValueChange={toggleSwitch} value={isEnabled} />
27+
{CustomGap.largeV}
2528
<ListTile title="End App launch" onPress={() => APM.endAppLaunch()} />
2629
<ListTile title="Network Screen" onPress={() => navigation.navigate('NetworkTraces')} />
2730
<ListTile title="Traces" onPress={() => navigation.navigate('ExecutionTraces')} />
2831
<ListTile title="Flows" onPress={() => navigation.navigate('AppFlows')} />
2932
<ListTile title="WebViews" onPress={() => navigation.navigate('WebViews')} />
33+
<ListTile title="Complex Views" onPress={() => navigation.navigate('ComplexViews')} />
3034
</Screen>
3135
);
3236
};

0 commit comments

Comments
 (0)