react-native-webview-bootpay 13.8.42 → 13.13.4-6.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +53 -69
  2. package/android/build.gradle +1 -11
  3. package/android/gradle.properties +0 -42
  4. package/android/src/main/AndroidManifest.xml +3 -1
  5. package/android/src/main/AndroidManifestNew.xml +97 -0
  6. package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +54 -10
  7. package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +101 -68
  8. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +68 -60
  9. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManagerImpl.kt +119 -65
  10. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewMessagingModule.kt +9 -0
  11. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModuleImpl.java +1 -1
  12. package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +4 -12
  13. package/android/src/newarch/{com/reactnativecommunity → kr/co/bootpay}/webview/BPCWebViewManager.java +118 -109
  14. package/android/src/newarch/{com/reactnativecommunity → kr/co/bootpay}/webview/BPCWebViewModule.java +1 -1
  15. package/android/src/{main/java → oldarch}/kr/co/bootpay/webview/BPCWebViewManager.java +63 -58
  16. package/android/src/{main/java → oldarch}/kr/co/bootpay/webview/BPCWebViewModule.java +1 -1
  17. package/apple/BPCWebView.mm +39 -30
  18. package/apple/BPCWebViewImpl.h +10 -0
  19. package/apple/BPCWebViewImpl.m +267 -205
  20. package/apple/BPCWebViewManager.mm +5 -24
  21. package/apple/BPCWebViewModule.h +23 -0
  22. package/apple/BPCWebViewModule.mm +34 -0
  23. package/apple/RCTConvert+WKDataDetectorTypes.h +11 -0
  24. package/apple/RCTConvert+WKDataDetectorTypes.m +27 -0
  25. package/index.d.ts +54 -48
  26. package/ios/RNCWebView.xcodeproj/project.pbxproj +24 -24
  27. package/ios/RNCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  28. package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcuserdata/taesupyoon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  29. package/ios/RNCWebView.xcodeproj/xcuserdata/taesupyoon.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  30. package/lib/BPCWebViewNativeComponent.d.ts +24 -25
  31. package/lib/BPCWebViewNativeComponent.js +1 -1
  32. package/lib/{NativeBPCWebView.d.ts → NativeBPCWebViewModule.d.ts} +2 -5
  33. package/lib/{NativeBPCWebView.js → NativeBPCWebViewModule.js} +1 -1
  34. package/lib/WebView.android.d.ts +0 -1
  35. package/lib/WebView.android.js +1 -1
  36. package/lib/WebView.d.ts +0 -1
  37. package/lib/WebView.ios.d.ts +0 -1
  38. package/lib/WebView.ios.js +1 -1
  39. package/lib/WebView.js +1 -1
  40. package/lib/WebView.macos.d.ts +0 -1
  41. package/lib/WebView.macos.js +1 -1
  42. package/lib/WebView.styles.d.ts +37 -11
  43. package/lib/WebView.styles.js +1 -1
  44. package/lib/WebView.windows.d.ts +0 -1
  45. package/lib/WebView.windows.js +1 -1
  46. package/lib/WebViewNativeComponent.macos.d.ts +1 -2
  47. package/lib/WebViewNativeComponent.windows.d.ts +1 -2
  48. package/lib/WebViewShared.d.ts +0 -1
  49. package/lib/WebViewShared.js +1 -1
  50. package/lib/WebViewTypes.d.ts +51 -3
  51. package/lib/WebViewTypes.js +1 -1
  52. package/lib/index.d.ts +0 -1
  53. package/macos/RNCWebView.xcodeproj/project.pbxproj +36 -36
  54. package/package.json +12 -11
  55. package/react-native-webview-bootpay.podspec +2 -2
  56. package/react-native.config.js +1 -5
  57. package/src/BPCWebViewNativeComponent.ts +143 -79
  58. package/src/NativeBPCWebViewModule.ts +13 -0
  59. package/src/WebView.android.tsx +295 -190
  60. package/src/WebView.ios.tsx +253 -186
  61. package/src/WebView.macos.tsx +220 -152
  62. package/src/WebView.styles.ts +9 -12
  63. package/src/WebView.tsx +14 -7
  64. package/src/WebView.windows.tsx +180 -126
  65. package/src/WebViewNativeComponent.macos.ts +4 -5
  66. package/src/WebViewNativeComponent.windows.ts +6 -8
  67. package/src/WebViewShared.tsx +139 -91
  68. package/src/WebViewTypes.ts +80 -35
  69. package/src/__tests__/WebViewShared-test.js +170 -55
  70. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +8 -17
  71. package/windows/ReactNativeWebView/ReactPackageProvider.cpp +5 -1
  72. package/windows/ReactNativeWebView/ReactWebView.cpp +73 -6
  73. package/windows/ReactNativeWebView/ReactWebView.h +11 -1
  74. package/windows/ReactNativeWebView/ReactWebView.idl +12 -3
  75. package/windows/ReactNativeWebView/ReactWebView2.cpp +294 -129
  76. package/windows/ReactNativeWebView/ReactWebView2.h +42 -5
  77. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +60 -34
  78. package/windows/ReactNativeWebView/ReactWebView2Manager.h +4 -4
  79. package/windows/ReactNativeWebView/ReactWebViewHelpers.cpp +70 -0
  80. package/windows/ReactNativeWebView/ReactWebViewHelpers.h +16 -0
  81. package/windows/ReactNativeWebView/ReactWebViewManager.cpp +22 -3
  82. package/windows/ReactNativeWebView/ReactWebViewManager.h +6 -1
  83. package/windows/ReactNativeWebView/pch.h +11 -7
  84. package/windows/ReactNativeWebView.sln +14 -14
  85. package/ios/main.jsbundle +0 -457
  86. package/lib/BPCWebViewNativeComponent.d.ts.map +0 -1
  87. package/lib/NativeBPCWebView.d.ts.map +0 -1
  88. package/lib/WebView.android.d.ts.map +0 -1
  89. package/lib/WebView.d.ts.map +0 -1
  90. package/lib/WebView.ios.d.ts.map +0 -1
  91. package/lib/WebView.macos.d.ts.map +0 -1
  92. package/lib/WebView.styles.d.ts.map +0 -1
  93. package/lib/WebView.windows.d.ts.map +0 -1
  94. package/lib/WebViewNativeComponent.macos.d.ts.map +0 -1
  95. package/lib/WebViewNativeComponent.windows.d.ts.map +0 -1
  96. package/lib/WebViewShared.d.ts.map +0 -1
  97. package/lib/WebViewTypes.d.ts.map +0 -1
  98. package/lib/index.d.ts.map +0 -1
  99. package/src/NativeBPCWebView.ts +0 -14
  100. package/windows/ReactNativeWebView/packages.config +0 -5
  101. /package/android/src/main/java/kr/co/bootpay/webview/{BPCWebviewWrapper.kt → BPCWebViewWrapper.kt} +0 -0
@@ -1,177 +1,245 @@
1
- import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
2
- import {
3
- Image,
4
- View,
5
- ImageSourcePropType,
6
- } from 'react-native';
1
+ import React, {
2
+ forwardRef,
3
+ useCallback,
4
+ useImperativeHandle,
5
+ useRef,
6
+ } from 'react';
7
+ import { Image, View, ImageSourcePropType, HostComponent } from 'react-native';
7
8
  import invariant from 'invariant';
8
-
9
- import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
10
- import BPCWebView from "./WebViewNativeComponent.macos";
11
- import BPCWebViewModule from "./NativeBPCWebView";
9
+ import BPCWebView, { Commands, NativeProps } from './BPCWebViewNativeComponent';
10
+ import BPCWebViewModule from './NativeBPCWebViewModule';
12
11
  import {
13
12
  defaultOriginWhitelist,
14
13
  defaultRenderError,
15
14
  defaultRenderLoading,
16
15
  useWebViewLogic,
17
16
  } from './WebViewShared';
18
- import {
19
- MacOSWebViewProps,
20
- NativeWebViewMacOS,
21
- } from './WebViewTypes';
17
+ import { MacOSWebViewProps, WebViewSourceUri } from './WebViewTypes';
22
18
 
23
19
  import styles from './WebView.styles';
24
20
 
25
- const Commands = codegenNativeCommands({
26
- supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', 'injectJavaScript', 'requestFocus', 'postMessage', 'loadUrl'],
27
- });
28
-
29
21
  const { resolveAssetSource } = Image;
30
22
 
31
23
  const useWarnIfChanges = <T extends unknown>(value: T, name: string) => {
32
24
  const ref = useRef(value);
33
25
  if (ref.current !== value) {
34
- console.warn(`Changes to property ${name} do nothing after the initial render.`);
26
+ console.warn(
27
+ `Changes to property ${name} do nothing after the initial render.`
28
+ );
35
29
  ref.current = value;
36
30
  }
37
- }
38
-
39
- const WebViewComponent = forwardRef<{}, MacOSWebViewProps>(({
40
- javaScriptEnabled = true,
41
- cacheEnabled = true,
42
- originWhitelist = defaultOriginWhitelist,
43
- useSharedProcessPool= true,
44
- injectedJavaScript,
45
- injectedJavaScriptBeforeContentLoaded,
46
- startInLoadingState,
47
- onNavigationStateChange,
48
- onLoadStart,
49
- onError,
50
- onLoad,
51
- onLoadEnd,
52
- onLoadProgress,
53
- onHttpError: onHttpErrorProp,
54
- onMessage: onMessageProp,
55
- renderLoading,
56
- renderError,
57
- style,
58
- containerStyle,
59
- source,
60
- nativeConfig,
61
- allowsInlineMediaPlayback,
62
- allowsAirPlayForMediaPlayback,
63
- mediaPlaybackRequiresUserAction,
64
- incognito,
65
- onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
66
- ...otherProps
67
- }, ref) => {
68
- const webViewRef = useRef<NativeWebViewMacOS | null>(null);
69
-
70
- const onShouldStartLoadWithRequestCallback = useCallback((
71
- shouldStart: boolean,
72
- _url: string,
73
- lockIdentifier = 0,
74
- ) => {
75
- BPCWebViewModule.shouldStartLoadWithLockIdentifier(!!shouldStart, lockIdentifier);
76
- }, []);
77
-
78
- const { onLoadingStart, onShouldStartLoadWithRequest, onMessage, viewState, setViewState, lastErrorEvent, onHttpError, onLoadingError, onLoadingFinish, onLoadingProgress, onContentProcessDidTerminate } = useWebViewLogic({
79
- onNavigationStateChange,
80
- onLoad,
81
- onError,
82
- onHttpErrorProp,
83
- onLoadEnd,
84
- onLoadProgress,
85
- onLoadStart,
86
- onMessageProp,
87
- startInLoadingState,
88
- originWhitelist,
89
- onShouldStartLoadWithRequestProp,
90
- onShouldStartLoadWithRequestCallback,
91
- });
92
-
93
- useImperativeHandle(ref, () => ({
94
- goForward: () => Commands.goForward(webViewRef.current),
95
- goBack: () => Commands.goBack(webViewRef.current),
96
- reload: () => {
97
- setViewState(
98
- 'LOADING',
99
- ); Commands.reload(webViewRef.current)
31
+ };
32
+
33
+ const WebViewComponent = forwardRef<{}, MacOSWebViewProps>(
34
+ (
35
+ {
36
+ javaScriptEnabled = true,
37
+ cacheEnabled = true,
38
+ originWhitelist = defaultOriginWhitelist,
39
+ useSharedProcessPool = true,
40
+ injectedJavaScript,
41
+ injectedJavaScriptBeforeContentLoaded,
42
+ startInLoadingState,
43
+ onNavigationStateChange,
44
+ onLoadStart,
45
+ onError,
46
+ onLoad,
47
+ onLoadEnd,
48
+ onLoadProgress,
49
+ onHttpError: onHttpErrorProp,
50
+ onMessage: onMessageProp,
51
+ renderLoading,
52
+ renderError,
53
+ style,
54
+ containerStyle,
55
+ source,
56
+ nativeConfig,
57
+ allowsInlineMediaPlayback,
58
+ allowsPictureInPictureMediaPlayback = true,
59
+ allowsAirPlayForMediaPlayback,
60
+ mediaPlaybackRequiresUserAction,
61
+ incognito,
62
+ onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
63
+ ...otherProps
100
64
  },
101
- stopLoading: () => Commands.stopLoading(webViewRef.current),
102
- postMessage: (data: string) => Commands.postMessage(webViewRef.current, data),
103
- injectJavaScript: (data: string) => Commands.injectJavaScript(webViewRef.current, data),
104
- requestFocus: () => Commands.requestFocus(webViewRef.current),
105
- }), [setViewState, webViewRef]);
106
-
107
-
108
- useWarnIfChanges(allowsInlineMediaPlayback, 'allowsInlineMediaPlayback');
109
- useWarnIfChanges(allowsAirPlayForMediaPlayback, 'allowsAirPlayForMediaPlayback');
110
- useWarnIfChanges(incognito, 'incognito');
111
- useWarnIfChanges(mediaPlaybackRequiresUserAction, 'mediaPlaybackRequiresUserAction');
112
-
113
- let otherView = null;
114
- if (viewState === 'LOADING') {
115
- otherView = (renderLoading || defaultRenderLoading)();
116
- } else if (viewState === 'ERROR') {
117
- invariant(lastErrorEvent != null, 'lastErrorEvent expected to be non-null');
118
- otherView = (renderError || defaultRenderError)(
119
- lastErrorEvent.domain,
120
- lastErrorEvent.code,
121
- lastErrorEvent.description,
65
+ ref
66
+ ) => {
67
+ const webViewRef = useRef<React.ComponentRef<
68
+ HostComponent<NativeProps>
69
+ > | null>(null);
70
+
71
+ const onShouldStartLoadWithRequestCallback = useCallback(
72
+ (shouldStart: boolean, _url: string, lockIdentifier = 0) => {
73
+ BPCWebViewModule.shouldStartLoadWithLockIdentifier(
74
+ !!shouldStart,
75
+ lockIdentifier
76
+ );
77
+ },
78
+ []
79
+ );
80
+
81
+ const {
82
+ onLoadingStart,
83
+ onShouldStartLoadWithRequest,
84
+ onMessage,
85
+ viewState,
86
+ setViewState,
87
+ lastErrorEvent,
88
+ onHttpError,
89
+ onLoadingError,
90
+ onLoadingFinish,
91
+ onLoadingProgress,
92
+ onContentProcessDidTerminate,
93
+ } = useWebViewLogic({
94
+ onNavigationStateChange,
95
+ onLoad,
96
+ onError,
97
+ onHttpErrorProp,
98
+ onLoadEnd,
99
+ onLoadProgress,
100
+ onLoadStart,
101
+ onMessageProp,
102
+ startInLoadingState,
103
+ originWhitelist,
104
+ onShouldStartLoadWithRequestProp,
105
+ onShouldStartLoadWithRequestCallback,
106
+ });
107
+
108
+ useImperativeHandle(
109
+ ref,
110
+ () => ({
111
+ goForward: () =>
112
+ webViewRef.current && Commands.goForward(webViewRef.current),
113
+ goBack: () => webViewRef.current && Commands.goBack(webViewRef.current),
114
+ reload: () => {
115
+ setViewState('LOADING');
116
+ if (webViewRef.current) {
117
+ Commands.reload(webViewRef.current);
118
+ }
119
+ },
120
+ stopLoading: () =>
121
+ webViewRef.current && Commands.stopLoading(webViewRef.current),
122
+ postMessage: (data: string) =>
123
+ webViewRef.current && Commands.postMessage(webViewRef.current, data),
124
+ injectJavaScript: (data: string) =>
125
+ webViewRef.current &&
126
+ Commands.injectJavaScript(webViewRef.current, data),
127
+ requestFocus: () =>
128
+ webViewRef.current && Commands.requestFocus(webViewRef.current),
129
+ }),
130
+ [setViewState, webViewRef]
131
+ );
132
+
133
+ useWarnIfChanges(allowsInlineMediaPlayback, 'allowsInlineMediaPlayback');
134
+ useWarnIfChanges(
135
+ allowsPictureInPictureMediaPlayback,
136
+ 'allowsPictureInPictureMediaPlayback'
137
+ );
138
+ useWarnIfChanges(
139
+ allowsAirPlayForMediaPlayback,
140
+ 'allowsAirPlayForMediaPlayback'
141
+ );
142
+ useWarnIfChanges(incognito, 'incognito');
143
+ useWarnIfChanges(
144
+ mediaPlaybackRequiresUserAction,
145
+ 'mediaPlaybackRequiresUserAction'
122
146
  );
123
- } else if (viewState !== 'IDLE') {
124
- console.error(`BPCWebView invalid state encountered: ${viewState}`);
125
- }
126
147
 
127
- const webViewStyles = [styles.container, styles.webView, style];
128
- const webViewContainerStyle = [styles.container, containerStyle];
129
-
130
- const NativeWebView
131
- = (nativeConfig?.component as typeof NativeWebViewMacOS | undefined)
132
- || BPCWebView;
133
-
134
- const webView = (
135
- <NativeWebView
136
- key="webViewKey"
137
- {...otherProps}
138
- javaScriptEnabled={javaScriptEnabled}
139
- cacheEnabled={cacheEnabled}
140
- useSharedProcessPool={useSharedProcessPool}
141
- messagingEnabled={typeof onMessageProp === 'function'}
142
- onLoadingError={onLoadingError}
143
- onLoadingFinish={onLoadingFinish}
144
- onLoadingProgress={onLoadingProgress}
145
- onLoadingStart={onLoadingStart}
146
- onHttpError={onHttpError}
147
- onMessage={onMessage}
148
- onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
149
- onContentProcessDidTerminate={onContentProcessDidTerminate}
150
- injectedJavaScript={injectedJavaScript}
151
- injectedJavaScriptBeforeContentLoaded={injectedJavaScriptBeforeContentLoaded}
152
- allowsAirPlayForMediaPlayback={allowsAirPlayForMediaPlayback}
153
- allowsInlineMediaPlayback={allowsInlineMediaPlayback}
154
- incognito={incognito}
155
- mediaPlaybackRequiresUserAction={mediaPlaybackRequiresUserAction}
156
- ref={webViewRef}
157
- // TODO: find a better way to type this.
158
- source={resolveAssetSource(source as ImageSourcePropType)}
159
- style={webViewStyles}
160
- {...nativeConfig?.props}
161
- />
162
- );
163
-
164
- return (
165
- <View style={webViewContainerStyle}>
166
- {webView}
167
- {otherView}
168
- </View>
169
- );})
148
+ let otherView = null;
149
+ if (viewState === 'LOADING') {
150
+ otherView = (renderLoading || defaultRenderLoading)();
151
+ } else if (viewState === 'ERROR') {
152
+ invariant(
153
+ lastErrorEvent != null,
154
+ 'lastErrorEvent expected to be non-null'
155
+ );
156
+ otherView = (renderError || defaultRenderError)(
157
+ lastErrorEvent?.domain,
158
+ lastErrorEvent?.code || 0,
159
+ lastErrorEvent?.description ?? ''
160
+ );
161
+ } else if (viewState !== 'IDLE') {
162
+ console.error(`BPCWebView invalid state encountered: ${viewState}`);
163
+ }
164
+
165
+ const webViewStyles = [styles.container, styles.webView, style];
166
+ const webViewContainerStyle = [styles.container, containerStyle];
167
+
168
+ const NativeWebView =
169
+ (nativeConfig?.component as typeof BPCWebView | undefined) || BPCWebView;
170
+
171
+ const sourceResolved = resolveAssetSource(source as ImageSourcePropType);
172
+ const newSource =
173
+ typeof sourceResolved === 'object'
174
+ ? Object.entries(sourceResolved as WebViewSourceUri).reduce(
175
+ (prev, [currKey, currValue]) => {
176
+ return {
177
+ ...prev,
178
+ [currKey]:
179
+ currKey === 'headers' &&
180
+ currValue &&
181
+ typeof currValue === 'object'
182
+ ? Object.entries(currValue).map(([key, value]) => {
183
+ return {
184
+ name: key,
185
+ value,
186
+ };
187
+ })
188
+ : currValue,
189
+ };
190
+ },
191
+ {}
192
+ )
193
+ : sourceResolved;
194
+
195
+ const webView = (
196
+ <NativeWebView
197
+ key="webViewKey"
198
+ {...otherProps}
199
+ javaScriptEnabled={javaScriptEnabled}
200
+ cacheEnabled={cacheEnabled}
201
+ useSharedProcessPool={useSharedProcessPool}
202
+ messagingEnabled={typeof onMessageProp === 'function'}
203
+ newSource={newSource}
204
+ onLoadingError={onLoadingError}
205
+ onLoadingFinish={onLoadingFinish}
206
+ onLoadingProgress={onLoadingProgress}
207
+ onLoadingStart={onLoadingStart}
208
+ onHttpError={onHttpError}
209
+ onMessage={onMessage}
210
+ onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
211
+ onContentProcessDidTerminate={onContentProcessDidTerminate}
212
+ injectedJavaScript={injectedJavaScript}
213
+ injectedJavaScriptBeforeContentLoaded={
214
+ injectedJavaScriptBeforeContentLoaded
215
+ }
216
+ allowsAirPlayForMediaPlayback={allowsAirPlayForMediaPlayback}
217
+ allowsInlineMediaPlayback={allowsInlineMediaPlayback}
218
+ allowsPictureInPictureMediaPlayback={
219
+ allowsPictureInPictureMediaPlayback
220
+ }
221
+ incognito={incognito}
222
+ mediaPlaybackRequiresUserAction={mediaPlaybackRequiresUserAction}
223
+ ref={webViewRef}
224
+ // @ts-expect-error old arch only
225
+ source={sourceResolved}
226
+ style={webViewStyles}
227
+ {...nativeConfig?.props}
228
+ />
229
+ );
230
+
231
+ return (
232
+ <View style={webViewContainerStyle}>
233
+ {webView}
234
+ {otherView}
235
+ </View>
236
+ );
237
+ }
238
+ );
170
239
 
171
240
  // no native implementation for macOS, depends only on permissions
172
- const isFileUploadSupported: () => Promise<boolean>
173
- = async () => true;
241
+ const isFileUploadSupported: () => Promise<boolean> = async () => true;
174
242
 
175
- const WebView = Object.assign(WebViewComponent, {isFileUploadSupported});
243
+ const WebView = Object.assign(WebViewComponent, { isFileUploadSupported });
176
244
 
177
245
  export default WebView;
@@ -1,15 +1,6 @@
1
- import { StyleSheet, ViewStyle, TextStyle } from 'react-native';
1
+ import { StyleSheet } from 'react-native';
2
2
 
3
- interface Styles {
4
- container: ViewStyle;
5
- errorText: TextStyle;
6
- errorTextTitle: TextStyle;
7
- loadingOrErrorView: ViewStyle;
8
- webView: ViewStyle;
9
- loadingProgressBar: ViewStyle;
10
- }
11
-
12
- const styles = StyleSheet.create<Styles>({
3
+ const styles = StyleSheet.create({
13
4
  container: {
14
5
  flex: 1,
15
6
  overflow: 'hidden',
@@ -21,7 +12,7 @@ const styles = StyleSheet.create<Styles>({
21
12
  alignItems: 'center',
22
13
  height: '100%',
23
14
  width: '100%',
24
- backgroundColor: 'white'
15
+ backgroundColor: 'white',
25
16
  },
26
17
  loadingProgressBar: {
27
18
  height: 20,
@@ -39,6 +30,12 @@ const styles = StyleSheet.create<Styles>({
39
30
  webView: {
40
31
  backgroundColor: '#ffffff',
41
32
  },
33
+ flexStart: {
34
+ alignSelf: 'flex-start',
35
+ },
36
+ colorRed: {
37
+ color: 'red',
38
+ },
42
39
  });
43
40
 
44
41
  export default styles;
package/src/WebView.tsx CHANGED
@@ -1,17 +1,24 @@
1
1
  import React from 'react';
2
2
  import { Text, View } from 'react-native';
3
- import { IOSWebViewProps, AndroidWebViewProps, WindowsWebViewProps } from './WebViewTypes';
3
+ import {
4
+ IOSWebViewProps,
5
+ AndroidWebViewProps,
6
+ WindowsWebViewProps,
7
+ } from './WebViewTypes';
8
+ import styles from './WebView.styles';
4
9
 
5
- export type WebViewProps = IOSWebViewProps & AndroidWebViewProps & WindowsWebViewProps;
10
+ export type WebViewProps = IOSWebViewProps &
11
+ AndroidWebViewProps &
12
+ WindowsWebViewProps;
6
13
 
7
14
  // This "dummy" WebView is to render something for unsupported platforms,
8
15
  // like for example Expo SDK "web" platform.
9
16
  const WebView: React.FunctionComponent<WebViewProps> = () => (
10
- <View style={{ alignSelf: 'flex-start' }}>
11
- <Text style={{ color: 'red' }}>
12
- React Native WebView does not support this platform.
13
- </Text>
14
- </View>
17
+ <View style={styles.flexStart}>
18
+ <Text style={styles.colorRed}>
19
+ React Native WebView does not support this platform.
20
+ </Text>
21
+ </View>
15
22
  );
16
23
 
17
24
  export { WebView };