Skip to content

Commit 067ccbb

Browse files
feat(example): add webviews to the sample app (#1310)
* Adding WebViews to sample app * Fixing Pods issue * Fixing CI
1 parent ab4c700 commit 067ccbb

File tree

8 files changed

+115
-1
lines changed

8 files changed

+115
-1
lines changed

examples/default/ios/Podfile.lock

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,27 @@ PODS:
13191319
- ReactCommon/turbomodule/bridging
13201320
- ReactCommon/turbomodule/core
13211321
- Yoga
1322+
- react-native-webview (13.12.3):
1323+
- DoubleConversion
1324+
- glog
1325+
- hermes-engine
1326+
- RCT-Folly (= 2024.01.01.00)
1327+
- RCTRequired
1328+
- RCTTypeSafety
1329+
- React-Core
1330+
- React-debug
1331+
- React-Fabric
1332+
- React-featureflags
1333+
- React-graphics
1334+
- React-ImageManager
1335+
- React-NativeModulesApple
1336+
- React-RCTFabric
1337+
- React-rendererdebug
1338+
- React-utils
1339+
- ReactCodegen
1340+
- ReactCommon/turbomodule/bridging
1341+
- ReactCommon/turbomodule/core
1342+
- Yoga
13221343
- React-nativeconfig (0.75.4)
13231344
- React-NativeModulesApple (0.75.4):
13241345
- glog
@@ -1786,6 +1807,7 @@ DEPENDENCIES:
17861807
- react-native-maps (from `../node_modules/react-native-maps`)
17871808
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
17881809
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
1810+
- react-native-webview (from `../node_modules/react-native-webview`)
17891811
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
17901812
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
17911813
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
@@ -1915,6 +1937,8 @@ EXTERNAL SOURCES:
19151937
:path: "../node_modules/react-native-safe-area-context"
19161938
react-native-slider:
19171939
:path: "../node_modules/@react-native-community/slider"
1940+
react-native-webview:
1941+
:path: "../node_modules/react-native-webview"
19181942
React-nativeconfig:
19191943
:path: "../node_modules/react-native/ReactCommon"
19201944
React-NativeModulesApple:
@@ -2031,6 +2055,7 @@ SPEC CHECKSUMS:
20312055
react-native-maps: 72a8a903f8a1b53e2c777ba79102078ab502e0bf
20322056
react-native-safe-area-context: 142fade490cbebbe428640b8cbdb09daf17e8191
20332057
react-native-slider: 4a0f3386a38fc3d2d955efc515aef7096f7d1ee4
2058+
react-native-webview: 926d2665cf3196e39c4449a72d136d0a53b9df8a
20342059
React-nativeconfig: 8c83d992b9cc7d75b5abe262069eaeea4349f794
20352060
React-NativeModulesApple: 9f7920224a3b0c7d04d77990067ded14cee3c614
20362061
React-perflogger: 59e1a3182dca2cee7b9f1f7aab204018d46d1914

examples/default/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"react-native-screens": "^3.35.0",
3333
"react-native-svg": "^15.8.0",
3434
"react-native-vector-icons": "^10.2.0",
35+
"react-native-webview": "^13.12.3",
3536
"react-query": "^3.39.3"
3637
},
3738
"devDependencies": {

examples/default/src/navigation/HomeStack.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import { FlowsScreen } from '../screens/apm/FlowsScreen';
2828
import { SessionReplayScreen } from '../screens/SessionReplayScreen';
2929
import { LegacyModeScreen } from '../screens/LegacyModeScreen';
3030
import { HttpScreen } from '../screens/apm/HttpScreen';
31+
import { WebViewsScreen } from '../screens/apm/webViews/WebViewsScreen';
32+
import { FullWebViewsScreen } from '../screens/apm/webViews/FullWebViewsScreen';
33+
import { PartialWebViewsScreen } from '../screens/apm/webViews/PartialWebViewsScreen';
3134

3235
export type HomeStackParamList = {
3336
Home: undefined;
@@ -55,6 +58,9 @@ export type HomeStackParamList = {
5558
NetworkTraces: undefined;
5659
ExecutionTraces: undefined;
5760
AppFlows: undefined;
61+
WebViews: undefined;
62+
FullWebViews: undefined;
63+
PartialWebViews: undefined;
5864
};
5965

6066
const HomeStack = createNativeStackNavigator<HomeStackParamList>();
@@ -142,6 +148,21 @@ export const HomeStackNavigator: React.FC = () => {
142148
options={{ title: 'LegacyMode' }}
143149
/>
144150
<HomeStack.Screen name="HttpScreen" component={HttpScreen} options={{ title: 'HTTP' }} />
151+
<HomeStack.Screen
152+
name="WebViews"
153+
component={WebViewsScreen}
154+
options={{ title: 'WebViews' }}
155+
/>
156+
<HomeStack.Screen
157+
name="FullWebViews"
158+
component={FullWebViewsScreen}
159+
options={{ title: 'FullWebViews' }}
160+
/>
161+
<HomeStack.Screen
162+
name="PartialWebViews"
163+
component={PartialWebViewsScreen}
164+
options={{ title: 'PartialWebViews' }}
165+
/>
145166
</HomeStack.Navigator>
146167
);
147168
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const APMScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'APM
2626
<ListTile title="Network Screen" onPress={() => navigation.navigate('NetworkTraces')} />
2727
<ListTile title="Traces" onPress={() => navigation.navigate('ExecutionTraces')} />
2828
<ListTile title="Flows" onPress={() => navigation.navigate('AppFlows')} />
29+
<ListTile title="WebViews" onPress={() => navigation.navigate('WebViews')} />
2930
</Screen>
3031
);
3132
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import { Screen } from '../../../components/Screen';
3+
import { WebView } from 'react-native-webview';
4+
5+
export const FullWebViewsScreen: React.FC = () => {
6+
return (
7+
<Screen>
8+
<WebView
9+
source={{ uri: 'https://www.instabug.com' }}
10+
javaScriptEnabled={true}
11+
domStorageEnabled={true}
12+
/>
13+
</Screen>
14+
);
15+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { Screen } from '../../../components/Screen';
3+
import { WebView } from 'react-native-webview';
4+
import { StyleSheet } from 'react-native';
5+
6+
export const PartialWebViewsScreen: React.FC = () => {
7+
return (
8+
<Screen>
9+
<WebView
10+
style={styles.webView}
11+
source={{ uri: 'https://www.instabug.com' }}
12+
javaScriptEnabled={true}
13+
domStorageEnabled={true}
14+
/>
15+
<WebView
16+
source={{ uri: 'https://www.google.com' }}
17+
javaScriptEnabled={true}
18+
domStorageEnabled={true}
19+
/>
20+
</Screen>
21+
);
22+
};
23+
const styles = StyleSheet.create({
24+
webView: {
25+
marginBottom: 20,
26+
},
27+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
2+
import type { HomeStackParamList } from '../../../navigation/HomeStack';
3+
import React from 'react';
4+
import { Screen } from '../../../components/Screen';
5+
import { ListTile } from '../../../components/ListTile';
6+
7+
export const WebViewsScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'WebViews'>> = ({
8+
navigation,
9+
}) => {
10+
return (
11+
<Screen>
12+
<ListTile title="Full Web View" onPress={() => navigation.navigate('FullWebViews')} />
13+
<ListTile title="Partial Web View" onPress={() => navigation.navigate('PartialWebViews')} />
14+
</Screen>
15+
);
16+
};

examples/default/yarn.lock

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4427,7 +4427,7 @@ intl-messageformat@^10.1.0:
44274427
"@formatjs/icu-messageformat-parser" "2.9.1"
44284428
tslib "2"
44294429

4430-
invariant@^2.2.4:
4430+
invariant@2.2.4, invariant@^2.2.4:
44314431
version "2.2.4"
44324432
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
44334433
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
@@ -6329,6 +6329,14 @@ react-native-vector-icons@^10.2.0:
63296329
prop-types "^15.7.2"
63306330
yargs "^16.1.1"
63316331

6332+
react-native-webview@^13.12.3:
6333+
version "13.12.3"
6334+
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-13.12.3.tgz#3aa9d2fc982ba2681e56d3e96e22b63a0d929270"
6335+
integrity sha512-Y1I5YyDYyE7NC96RHLhd2nxh7ymLYOYLTefgx5ixxw2OToQK0ow3OJ+o77QcI1Tuevj5PCxwqC/14ceS/7yPJQ==
6336+
dependencies:
6337+
escape-string-regexp "^4.0.0"
6338+
invariant "2.2.4"
6339+
63326340
63336341
version "0.75.4"
63346342
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.75.4.tgz#40fc337b9c005521b5b7e039481bc4d444b009a9"

0 commit comments

Comments
 (0)