Skip to content

Commit a2e1e4d

Browse files
authored
fix(newArch): Set correct default values for "true" booleans (react-native-webview#3726)
* Update RNCWebViewNativeComponent.ts * Update RNCWebViewNativeComponent.ts
1 parent a27d53f commit a2e1e4d

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

src/RNCWebViewNativeComponent.ts

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ export interface NativeProps extends ViewProps {
168168
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
169169
overScrollMode?: string;
170170
saveFormDataDisabled?: boolean;
171-
scalesPageToFit?: boolean;
172-
setBuiltInZoomControls?: boolean;
171+
scalesPageToFit?: WithDefault<boolean, true>;
172+
setBuiltInZoomControls?: WithDefault<boolean, true>;
173173
setDisplayZoomControls?: boolean;
174-
setSupportMultipleWindows?: boolean;
174+
setSupportMultipleWindows?: WithDefault<boolean, true>;
175175
textZoom?: Int32;
176-
thirdPartyCookiesEnabled?: boolean;
176+
thirdPartyCookiesEnabled?: WithDefault<boolean, true>;
177177
// Workaround to watch if listener if defined
178178
hasOnScroll?: boolean;
179179
// !Android only
@@ -184,10 +184,10 @@ export interface NativeProps extends ViewProps {
184184
allowsInlineMediaPlayback?: boolean;
185185
allowsPictureInPictureMediaPlayback?: boolean;
186186
allowsAirPlayForMediaPlayback?: boolean;
187-
allowsLinkPreview?: boolean;
188-
automaticallyAdjustContentInsets?: boolean;
189-
autoManageStatusBarEnabled?: boolean;
190-
bounces?: boolean;
187+
allowsLinkPreview?: WithDefault<boolean, true>;
188+
automaticallyAdjustContentInsets?: WithDefault<boolean, true>;
189+
autoManageStatusBarEnabled?: WithDefault<boolean, true>;
190+
bounces?: WithDefault<boolean, true>;
191191
contentInset?: Readonly<{
192192
top?: Double;
193193
left?: Double;
@@ -217,10 +217,10 @@ export interface NativeProps extends ViewProps {
217217
'phoneNumber'
218218
>;
219219
decelerationRate?: Double;
220-
directionalLockEnabled?: boolean;
220+
directionalLockEnabled?: WithDefault<boolean, true>;
221221
enableApplePay?: boolean;
222222
hideKeyboardAccessoryView?: boolean;
223-
keyboardDisplayRequiresUserAction?: boolean;
223+
keyboardDisplayRequiresUserAction?: WithDefault<boolean, true>;
224224
limitsNavigationsToAppBoundDomains?: boolean;
225225
mediaCapturePermissionGrantType?: WithDefault<
226226
| 'prompt'
@@ -233,10 +233,10 @@ export interface NativeProps extends ViewProps {
233233
pagingEnabled?: boolean;
234234
pullToRefreshEnabled?: boolean;
235235
refreshControlLightMode?: boolean;
236-
scrollEnabled?: boolean;
236+
scrollEnabled?: WithDefault<boolean, true>;
237237
sharedCookiesEnabled?: boolean;
238-
textInteractionEnabled?: boolean;
239-
useSharedProcessPool?: boolean;
238+
textInteractionEnabled?: WithDefault<boolean, true>;
239+
useSharedProcessPool?: WithDefault<boolean, true>;
240240
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
241241
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
242242
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
@@ -245,7 +245,7 @@ export interface NativeProps extends ViewProps {
245245
suppressMenuItems?: Readonly<string>[];
246246
// Workaround to watch if listener if defined
247247
hasOnFileDownload?: boolean;
248-
fraudulentWebsiteWarningEnabled?: boolean;
248+
fraudulentWebsiteWarningEnabled?: WithDefault<boolean, true>;
249249
// !iOS only
250250

251251
allowFileAccessFromFileURLs?: boolean;
@@ -255,16 +255,19 @@ export interface NativeProps extends ViewProps {
255255
username: string;
256256
password: string;
257257
}>;
258-
cacheEnabled?: boolean;
258+
cacheEnabled?: WithDefault<boolean, true>;
259259
incognito?: boolean;
260260
injectedJavaScript?: string;
261261
injectedJavaScriptBeforeContentLoaded?: string;
262-
injectedJavaScriptForMainFrameOnly?: boolean;
263-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
262+
injectedJavaScriptForMainFrameOnly?: WithDefault<boolean, true>;
263+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: WithDefault<
264+
boolean,
265+
true
266+
>;
264267
javaScriptCanOpenWindowsAutomatically?: boolean;
265-
javaScriptEnabled?: boolean;
268+
javaScriptEnabled?: WithDefault<boolean, true>;
266269
webviewDebuggingEnabled?: boolean;
267-
mediaPlaybackRequiresUserAction?: boolean;
270+
mediaPlaybackRequiresUserAction?: WithDefault<boolean, true>;
268271
messagingEnabled: boolean;
269272
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
270273
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
@@ -276,8 +279,8 @@ export interface NativeProps extends ViewProps {
276279
hasOnOpenWindowEvent?: boolean;
277280
onScroll?: DirectEventHandler<ScrollEvent>;
278281
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
279-
showsHorizontalScrollIndicator?: boolean;
280-
showsVerticalScrollIndicator?: boolean;
282+
showsHorizontalScrollIndicator?: WithDefault<boolean, true>;
283+
showsVerticalScrollIndicator?: WithDefault<boolean, true>;
281284
newSource: Readonly<{
282285
uri?: string;
283286
method?: string;

0 commit comments

Comments
 (0)