getExportedCustomDirectEventTypeConstants() {
export.put(TopLoadingStartEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingStart"));
export.put(TopLoadingFinishEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingFinish"));
export.put(TopLoadingErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingError"));
+ export.put(SubResourceErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingSubResourceError"));
export.put(TopMessageEvent.EVENT_NAME, MapBuilder.of("registrationName", "onMessage"));
// !Default events but adding them here explicitly for clarity
diff --git a/apps/expo-go/modules/react-native-webview/apple/RNCWebView.h b/apps/expo-go/modules/react-native-webview/apple/RNCWebView.h
index 659334e215b522..ad0b778d74932a 100644
--- a/apps/expo-go/modules/react-native-webview/apple/RNCWebView.h
+++ b/apps/expo-go/modules/react-native-webview/apple/RNCWebView.h
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
namespace facebook {
namespace react {
- bool operator==(const RNCWebViewMenuItemsStruct& a, const RNCWebViewMenuItemsStruct& b)
+ inline bool operator==(const RNCWebViewMenuItemsStruct& a, const RNCWebViewMenuItemsStruct& b)
{
return b.key == a.key && b.label == a.label;
}
diff --git a/apps/expo-go/modules/react-native-webview/index.d.ts b/apps/expo-go/modules/react-native-webview/index.d.ts
index a85ac85357b412..a3eef1390c51d4 100644
--- a/apps/expo-go/modules/react-native-webview/index.d.ts
+++ b/apps/expo-go/modules/react-native-webview/index.d.ts
@@ -51,7 +51,7 @@ declare class WebView extends Component {
/**
* Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
*/
- clearCache?: (includeDiskFiles: boolean) => void;
+ clearCache: (includeDiskFiles: boolean) => void;
/**
* (Android only)
diff --git a/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.d.ts b/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.d.ts
index d0de585c535380..8dd6cef93c86f3 100644
--- a/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.d.ts
+++ b/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.d.ts
@@ -199,6 +199,7 @@ export interface NativeProps extends ViewProps {
mediaPlaybackRequiresUserAction?: WithDefault;
messagingEnabled: boolean;
onLoadingError: DirectEventHandler;
+ onLoadingSubResourceError: DirectEventHandler;
onLoadingFinish: DirectEventHandler;
onLoadingProgress: DirectEventHandler;
onLoadingStart: DirectEventHandler;
diff --git a/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.js b/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.js
index 5a6606a01363b5..25d09e9e702ce7 100644
--- a/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.js
+++ b/apps/expo-go/modules/react-native-webview/lib/RNCWebViewNativeComponent.js
@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.__INTERNAL_VIEW_CONFIG=exports.Commands=void 0;var _codegenNativeComponent=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var NativeComponentRegistry=require('react-native/Libraries/NativeComponent/NativeComponentRegistry');var _require=require('react-native/Libraries/NativeComponent/ViewConfigIgnore'),ConditionallyIgnoredEventHandlers=_require.ConditionallyIgnoredEventHandlers;var _require2=require("react-native/Libraries/ReactNative/RendererProxy"),dispatchCommand=_require2.dispatchCommand;var nativeComponentName='RNCWebView';var __INTERNAL_VIEW_CONFIG=exports.__INTERNAL_VIEW_CONFIG={uiViewClassName:'RNCWebView',directEventTypes:{topContentSizeChange:{registrationName:'onContentSizeChange'},topRenderProcessGone:{registrationName:'onRenderProcessGone'},topContentProcessDidTerminate:{registrationName:'onContentProcessDidTerminate'},topCustomMenuSelection:{registrationName:'onCustomMenuSelection'},topFileDownload:{registrationName:'onFileDownload'},topLoadingError:{registrationName:'onLoadingError'},topLoadingFinish:{registrationName:'onLoadingFinish'},topLoadingProgress:{registrationName:'onLoadingProgress'},topLoadingStart:{registrationName:'onLoadingStart'},topHttpError:{registrationName:'onHttpError'},topMessage:{registrationName:'onMessage'},topOpenWindow:{registrationName:'onOpenWindow'},topScroll:{registrationName:'onScroll'},topShouldStartLoadWithRequest:{registrationName:'onShouldStartLoadWithRequest'}},validAttributes:Object.assign({allowFileAccess:true,allowsProtectedMedia:true,allowsFullscreenVideo:true,androidLayerType:true,cacheMode:true,domStorageEnabled:true,downloadingMessage:true,forceDarkOn:true,geolocationEnabled:true,lackPermissionToDownloadMessage:true,messagingModuleName:true,minimumFontSize:true,mixedContentMode:true,nestedScrollEnabled:true,overScrollMode:true,saveFormDataDisabled:true,scalesPageToFit:true,setBuiltInZoomControls:true,setDisplayZoomControls:true,setSupportMultipleWindows:true,textZoom:true,thirdPartyCookiesEnabled:true,hasOnScroll:true,allowingReadAccessToURL:true,allowsBackForwardNavigationGestures:true,allowsInlineMediaPlayback:true,allowsPictureInPictureMediaPlayback:true,allowsAirPlayForMediaPlayback:true,allowsLinkPreview:true,automaticallyAdjustContentInsets:true,autoManageStatusBarEnabled:true,bounces:true,contentInset:true,contentInsetAdjustmentBehavior:true,contentMode:true,dataDetectorTypes:true,decelerationRate:true,directionalLockEnabled:true,enableApplePay:true,hideKeyboardAccessoryView:true,keyboardDisplayRequiresUserAction:true,limitsNavigationsToAppBoundDomains:true,mediaCapturePermissionGrantType:true,pagingEnabled:true,pullToRefreshEnabled:true,refreshControlLightMode:true,scrollEnabled:true,sharedCookiesEnabled:true,textInteractionEnabled:true,useSharedProcessPool:true,menuItems:true,suppressMenuItems:true,hasOnFileDownload:true,fraudulentWebsiteWarningEnabled:true,allowFileAccessFromFileURLs:true,allowUniversalAccessFromFileURLs:true,applicationNameForUserAgent:true,basicAuthCredential:true,cacheEnabled:true,incognito:true,injectedJavaScript:true,injectedJavaScriptBeforeContentLoaded:true,injectedJavaScriptForMainFrameOnly:true,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:true,javaScriptCanOpenWindowsAutomatically:true,javaScriptEnabled:true,webviewDebuggingEnabled:true,mediaPlaybackRequiresUserAction:true,messagingEnabled:true,hasOnOpenWindowEvent:true,showsHorizontalScrollIndicator:true,showsVerticalScrollIndicator:true,indicatorStyle:true,newSource:true,userAgent:true,injectedJavaScriptObject:true,paymentRequestEnabled:true},ConditionallyIgnoredEventHandlers({onContentSizeChange:true,onRenderProcessGone:true,onContentProcessDidTerminate:true,onCustomMenuSelection:true,onFileDownload:true,onLoadingError:true,onLoadingFinish:true,onLoadingProgress:true,onLoadingStart:true,onHttpError:true,onMessage:true,onOpenWindow:true,onScroll:true,onShouldStartLoadWithRequest:true}))};var _default=exports.default=NativeComponentRegistry.get(nativeComponentName,function(){return __INTERNAL_VIEW_CONFIG;});var Commands=exports.Commands={goBack:function goBack(ref){dispatchCommand(ref,"goBack",[]);},goForward:function goForward(ref){dispatchCommand(ref,"goForward",[]);},reload:function reload(ref){dispatchCommand(ref,"reload",[]);},stopLoading:function stopLoading(ref){dispatchCommand(ref,"stopLoading",[]);},injectJavaScript:function injectJavaScript(ref,javascript){dispatchCommand(ref,"injectJavaScript",[javascript]);},requestFocus:function requestFocus(ref){dispatchCommand(ref,"requestFocus",[]);},postMessage:function postMessage(ref,data){dispatchCommand(ref,"postMessage",[data]);},loadUrl:function loadUrl(ref,url){dispatchCommand(ref,"loadUrl",[url]);},clearFormData:function clearFormData(ref){dispatchCommand(ref,"clearFormData",[]);},clearCache:function clearCache(ref,includeDiskFiles){dispatchCommand(ref,"clearCache",[includeDiskFiles]);},clearHistory:function clearHistory(ref){dispatchCommand(ref,"clearHistory",[]);}};
\ No newline at end of file
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.__INTERNAL_VIEW_CONFIG=exports.Commands=void 0;var _codegenNativeComponent=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var NativeComponentRegistry=require('react-native/Libraries/NativeComponent/NativeComponentRegistry');var _require=require('react-native/Libraries/NativeComponent/ViewConfigIgnore'),ConditionallyIgnoredEventHandlers=_require.ConditionallyIgnoredEventHandlers;var _require2=require("react-native/Libraries/ReactNative/RendererProxy"),dispatchCommand=_require2.dispatchCommand;var nativeComponentName='RNCWebView';var __INTERNAL_VIEW_CONFIG=exports.__INTERNAL_VIEW_CONFIG={uiViewClassName:'RNCWebView',directEventTypes:{topContentSizeChange:{registrationName:'onContentSizeChange'},topRenderProcessGone:{registrationName:'onRenderProcessGone'},topContentProcessDidTerminate:{registrationName:'onContentProcessDidTerminate'},topCustomMenuSelection:{registrationName:'onCustomMenuSelection'},topFileDownload:{registrationName:'onFileDownload'},topLoadingError:{registrationName:'onLoadingError'},topLoadingSubResourceError:{registrationName:'onLoadingSubResourceError'},topLoadingFinish:{registrationName:'onLoadingFinish'},topLoadingProgress:{registrationName:'onLoadingProgress'},topLoadingStart:{registrationName:'onLoadingStart'},topHttpError:{registrationName:'onHttpError'},topMessage:{registrationName:'onMessage'},topOpenWindow:{registrationName:'onOpenWindow'},topScroll:{registrationName:'onScroll'},topShouldStartLoadWithRequest:{registrationName:'onShouldStartLoadWithRequest'}},validAttributes:Object.assign({allowFileAccess:true,allowsProtectedMedia:true,allowsFullscreenVideo:true,androidLayerType:true,cacheMode:true,domStorageEnabled:true,downloadingMessage:true,forceDarkOn:true,geolocationEnabled:true,lackPermissionToDownloadMessage:true,messagingModuleName:true,minimumFontSize:true,mixedContentMode:true,nestedScrollEnabled:true,overScrollMode:true,saveFormDataDisabled:true,scalesPageToFit:true,setBuiltInZoomControls:true,setDisplayZoomControls:true,setSupportMultipleWindows:true,textZoom:true,thirdPartyCookiesEnabled:true,hasOnScroll:true,allowingReadAccessToURL:true,allowsBackForwardNavigationGestures:true,allowsInlineMediaPlayback:true,allowsPictureInPictureMediaPlayback:true,allowsAirPlayForMediaPlayback:true,allowsLinkPreview:true,automaticallyAdjustContentInsets:true,autoManageStatusBarEnabled:true,bounces:true,contentInset:true,contentInsetAdjustmentBehavior:true,contentMode:true,dataDetectorTypes:true,decelerationRate:true,directionalLockEnabled:true,enableApplePay:true,hideKeyboardAccessoryView:true,keyboardDisplayRequiresUserAction:true,limitsNavigationsToAppBoundDomains:true,mediaCapturePermissionGrantType:true,pagingEnabled:true,pullToRefreshEnabled:true,refreshControlLightMode:true,scrollEnabled:true,sharedCookiesEnabled:true,textInteractionEnabled:true,useSharedProcessPool:true,menuItems:true,suppressMenuItems:true,hasOnFileDownload:true,fraudulentWebsiteWarningEnabled:true,allowFileAccessFromFileURLs:true,allowUniversalAccessFromFileURLs:true,applicationNameForUserAgent:true,basicAuthCredential:true,cacheEnabled:true,incognito:true,injectedJavaScript:true,injectedJavaScriptBeforeContentLoaded:true,injectedJavaScriptForMainFrameOnly:true,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:true,javaScriptCanOpenWindowsAutomatically:true,javaScriptEnabled:true,webviewDebuggingEnabled:true,mediaPlaybackRequiresUserAction:true,messagingEnabled:true,hasOnOpenWindowEvent:true,showsHorizontalScrollIndicator:true,showsVerticalScrollIndicator:true,indicatorStyle:true,newSource:true,userAgent:true,injectedJavaScriptObject:true,paymentRequestEnabled:true},ConditionallyIgnoredEventHandlers({onContentSizeChange:true,onRenderProcessGone:true,onContentProcessDidTerminate:true,onCustomMenuSelection:true,onFileDownload:true,onLoadingError:true,onLoadingSubResourceError:true,onLoadingFinish:true,onLoadingProgress:true,onLoadingStart:true,onHttpError:true,onMessage:true,onOpenWindow:true,onScroll:true,onShouldStartLoadWithRequest:true}))};var _default=exports.default=NativeComponentRegistry.get(nativeComponentName,function(){return __INTERNAL_VIEW_CONFIG;});var Commands=exports.Commands={goBack:function goBack(ref){dispatchCommand(ref,"goBack",[]);},goForward:function goForward(ref){dispatchCommand(ref,"goForward",[]);},reload:function reload(ref){dispatchCommand(ref,"reload",[]);},stopLoading:function stopLoading(ref){dispatchCommand(ref,"stopLoading",[]);},injectJavaScript:function injectJavaScript(ref,javascript){dispatchCommand(ref,"injectJavaScript",[javascript]);},requestFocus:function requestFocus(ref){dispatchCommand(ref,"requestFocus",[]);},postMessage:function postMessage(ref,data){dispatchCommand(ref,"postMessage",[data]);},loadUrl:function loadUrl(ref,url){dispatchCommand(ref,"loadUrl",[url]);},clearFormData:function clearFormData(ref){dispatchCommand(ref,"clearFormData",[]);},clearCache:function clearCache(ref,includeDiskFiles){dispatchCommand(ref,"clearCache",[includeDiskFiles]);},clearHistory:function clearHistory(ref){dispatchCommand(ref,"clearHistory",[]);}};
\ No newline at end of file
diff --git a/apps/expo-go/modules/react-native-webview/lib/WebView.android.js b/apps/expo-go/modules/react-native-webview/lib/WebView.android.js
index 78e69c33f14538..c6cb7a95c15e96 100644
--- a/apps/expo-go/modules/react-native-webview/lib/WebView.android.js
+++ b/apps/expo-go/modules/react-native-webview/lib/WebView.android.js
@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _RNCWebViewNativeComponent=_interopRequireWildcard(require("./RNCWebViewNativeComponent"));var _NativeRNCWebViewModule=_interopRequireDefault(require("./NativeRNCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/home/circleci/code/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('RNCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeRNCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_RNCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_RNCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`RNCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_RNCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeRNCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
\ No newline at end of file
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _RNCWebViewNativeComponent=_interopRequireWildcard(require("./RNCWebViewNativeComponent"));var _NativeRNCWebViewModule=_interopRequireDefault(require("./NativeRNCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadSubResourceError","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/home/circleci/code/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('RNCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadSubResourceError=_ref.onLoadSubResourceError,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeRNCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_RNCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadSubResourceError:onLoadSubResourceError,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingSubResourceError=_useWebViewLogic.onLoadingSubResourceError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_RNCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`RNCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_RNCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingSubResourceError:onLoadingSubResourceError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeRNCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
\ No newline at end of file
diff --git a/apps/expo-go/modules/react-native-webview/lib/WebViewShared.d.ts b/apps/expo-go/modules/react-native-webview/lib/WebViewShared.d.ts
index 37344a794b0cff..8738f30fa18bec 100644
--- a/apps/expo-go/modules/react-native-webview/lib/WebViewShared.d.ts
+++ b/apps/expo-go/modules/react-native-webview/lib/WebViewShared.d.ts
@@ -5,7 +5,7 @@ declare const createOnShouldStartLoadWithRequest: (loadRequest: (shouldStart: bo
declare const defaultRenderLoading: () => React.JSX.Element;
declare const defaultRenderError: (errorDomain: string | undefined, errorCode: number, errorDesc: string) => React.JSX.Element;
export { defaultOriginWhitelist, createOnShouldStartLoadWithRequest, defaultRenderLoading, defaultRenderError, };
-export declare const useWebViewLogic: ({ startInLoadingState, onNavigationStateChange, onLoadStart, onLoad, onLoadProgress, onLoadEnd, onError, onHttpErrorProp, onMessageProp, onOpenWindowProp, onRenderProcessGoneProp, onContentProcessDidTerminateProp, originWhitelist, onShouldStartLoadWithRequestProp, onShouldStartLoadWithRequestCallback, }: {
+export declare const useWebViewLogic: ({ startInLoadingState, onNavigationStateChange, onLoadStart, onLoad, onLoadProgress, onLoadEnd, onError, onLoadSubResourceError, onHttpErrorProp, onMessageProp, onOpenWindowProp, onRenderProcessGoneProp, onContentProcessDidTerminateProp, originWhitelist, onShouldStartLoadWithRequestProp, onShouldStartLoadWithRequestCallback, }: {
startInLoadingState?: boolean | undefined;
onNavigationStateChange?: ((event: WebViewNavigation) => void) | undefined;
onLoadStart?: ((event: WebViewNavigationEvent) => void) | undefined;
@@ -13,6 +13,7 @@ export declare const useWebViewLogic: ({ startInLoadingState, onNavigationStateC
onLoadProgress?: ((event: WebViewProgressEvent) => void) | undefined;
onLoadEnd?: ((event: WebViewNavigationEvent | WebViewErrorEvent) => void) | undefined;
onError?: ((event: WebViewErrorEvent) => void) | undefined;
+ onLoadSubResourceError?: ((event: WebViewErrorEvent) => void) | undefined;
onHttpErrorProp?: ((event: WebViewHttpErrorEvent) => void) | undefined;
onMessageProp?: ((event: WebViewMessageEvent) => void) | undefined;
onOpenWindowProp?: ((event: WebViewOpenWindowEvent) => void) | undefined;
@@ -26,6 +27,7 @@ export declare const useWebViewLogic: ({ startInLoadingState, onNavigationStateC
onLoadingStart: (event: WebViewNavigationEvent) => void;
onLoadingProgress: (event: WebViewProgressEvent) => void;
onLoadingError: (event: WebViewErrorEvent) => void;
+ onLoadingSubResourceError: (event: WebViewErrorEvent) => void;
onLoadingFinish: (event: WebViewNavigationEvent) => void;
onHttpError: (event: WebViewHttpErrorEvent) => void;
onRenderProcessGone: (event: WebViewRenderProcessGoneEvent) => void;
diff --git a/apps/expo-go/modules/react-native-webview/lib/WebViewShared.js b/apps/expo-go/modules/react-native-webview/lib/WebViewShared.js
index da517df30a206a..ff1da3083a969b 100644
--- a/apps/expo-go/modules/react-native-webview/lib/WebViewShared.js
+++ b/apps/expo-go/modules/react-native-webview/lib/WebViewShared.js
@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useWebViewLogic=exports.defaultRenderLoading=exports.defaultRenderError=exports.defaultOriginWhitelist=exports.createOnShouldStartLoadWithRequest=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _escapeStringRegexp=_interopRequireDefault(require("escape-string-regexp"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/circleci/code/src/WebViewShared.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var defaultOriginWhitelist=exports.defaultOriginWhitelist=['http://*','https://*'];var extractOrigin=function extractOrigin(url){var result=/^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);return result===null?'':result[0];};var originWhitelistToRegex=function originWhitelistToRegex(originWhitelist){return`^${(0,_escapeStringRegexp.default)(originWhitelist).replace(/\\\*/g,'.*')}`;};var passesWhitelist=function passesWhitelist(compiledWhitelist,url){var origin=extractOrigin(url);return compiledWhitelist.some(function(x){return new RegExp(x).test(origin);});};var compileWhitelist=function compileWhitelist(originWhitelist){return['about:blank'].concat((0,_toConsumableArray2.default)(originWhitelist||[])).map(originWhitelistToRegex);};var createOnShouldStartLoadWithRequest=exports.createOnShouldStartLoadWithRequest=function createOnShouldStartLoadWithRequest(loadRequest,originWhitelist,onShouldStartLoadWithRequest){return function(_ref){var nativeEvent=_ref.nativeEvent;var shouldStart=true;var url=nativeEvent.url,lockIdentifier=nativeEvent.lockIdentifier;if(!passesWhitelist(compileWhitelist(originWhitelist),url)){_reactNative.Linking.canOpenURL(url).then(function(supported){if(supported){return _reactNative.Linking.openURL(url);}console.warn(`Can't open url: ${url}`);return undefined;}).catch(function(e){console.warn('Error opening URL: ',e);});shouldStart=false;}else if(onShouldStartLoadWithRequest){shouldStart=onShouldStartLoadWithRequest(nativeEvent);}loadRequest(shouldStart,url,lockIdentifier);};};var defaultRenderLoading=exports.defaultRenderLoading=function defaultRenderLoading(){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{})});};var defaultRenderError=exports.defaultRenderError=function defaultRenderError(errorDomain,errorCode,errorDesc){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorTextTitle,children:"Error loading page"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Domain: ${errorDomain}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Error Code: ${errorCode}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Description: ${errorDesc}`})]});};var useWebViewLogic=exports.useWebViewLogic=function useWebViewLogic(_ref2){var startInLoadingState=_ref2.startInLoadingState,onNavigationStateChange=_ref2.onNavigationStateChange,onLoadStart=_ref2.onLoadStart,onLoad=_ref2.onLoad,onLoadProgress=_ref2.onLoadProgress,onLoadEnd=_ref2.onLoadEnd,onError=_ref2.onError,onHttpErrorProp=_ref2.onHttpErrorProp,onMessageProp=_ref2.onMessageProp,onOpenWindowProp=_ref2.onOpenWindowProp,onRenderProcessGoneProp=_ref2.onRenderProcessGoneProp,onContentProcessDidTerminateProp=_ref2.onContentProcessDidTerminateProp,originWhitelist=_ref2.originWhitelist,onShouldStartLoadWithRequestProp=_ref2.onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback=_ref2.onShouldStartLoadWithRequestCallback;var _useState=(0,_react.useState)(startInLoadingState?'LOADING':'IDLE'),_useState2=(0,_slicedToArray2.default)(_useState,2),viewState=_useState2[0],setViewState=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),lastErrorEvent=_useState4[0],setLastErrorEvent=_useState4[1];var startUrl=(0,_react.useRef)(null);var updateNavigationState=(0,_react.useCallback)(function(event){onNavigationStateChange==null?void 0:onNavigationStateChange(event.nativeEvent);},[onNavigationStateChange]);var onLoadingStart=(0,_react.useCallback)(function(event){startUrl.current=event.nativeEvent.url;onLoadStart==null?void 0:onLoadStart(event);updateNavigationState(event);},[onLoadStart,updateNavigationState]);var onLoadingError=(0,_react.useCallback)(function(event){event.persist();if(onError){onError(event);}else{console.warn('Encountered an error loading page',event.nativeEvent);}onLoadEnd==null?void 0:onLoadEnd(event);if(event.isDefaultPrevented()){return;}setViewState('ERROR');setLastErrorEvent(event.nativeEvent);},[onError,onLoadEnd]);var onHttpError=(0,_react.useCallback)(function(event){onHttpErrorProp==null?void 0:onHttpErrorProp(event);},[onHttpErrorProp]);var onRenderProcessGone=(0,_react.useCallback)(function(event){onRenderProcessGoneProp==null?void 0:onRenderProcessGoneProp(event);},[onRenderProcessGoneProp]);var onContentProcessDidTerminate=(0,_react.useCallback)(function(event){onContentProcessDidTerminateProp==null?void 0:onContentProcessDidTerminateProp(event);},[onContentProcessDidTerminateProp]);var onLoadingFinish=(0,_react.useCallback)(function(event){onLoad==null?void 0:onLoad(event);onLoadEnd==null?void 0:onLoadEnd(event);var url=event.nativeEvent.url;if(_reactNative.Platform.OS!=='android'||url===startUrl.current){setViewState('IDLE');}updateNavigationState(event);},[onLoad,onLoadEnd,updateNavigationState]);var onMessage=(0,_react.useCallback)(function(event){onMessageProp==null?void 0:onMessageProp(event);},[onMessageProp]);var onLoadingProgress=(0,_react.useCallback)(function(event){var progress=event.nativeEvent.progress;if(_reactNative.Platform.OS==='android'&&progress===1){setViewState(function(prevViewState){return prevViewState==='LOADING'?'IDLE':prevViewState;});}onLoadProgress==null?void 0:onLoadProgress(event);},[onLoadProgress]);var onShouldStartLoadWithRequest=(0,_react.useMemo)(function(){return createOnShouldStartLoadWithRequest(onShouldStartLoadWithRequestCallback,originWhitelist,onShouldStartLoadWithRequestProp);},[originWhitelist,onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback]);var onOpenWindow=(0,_react.useCallback)(function(event){onOpenWindowProp==null?void 0:onOpenWindowProp(event);},[onOpenWindowProp]);return{onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onLoadingStart:onLoadingStart,onLoadingProgress:onLoadingProgress,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onContentProcessDidTerminate:onContentProcessDidTerminate,onMessage:onMessage,onOpenWindow:onOpenWindow,viewState:viewState,setViewState:setViewState,lastErrorEvent:lastErrorEvent};};
\ No newline at end of file
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useWebViewLogic=exports.defaultRenderLoading=exports.defaultRenderError=exports.defaultOriginWhitelist=exports.createOnShouldStartLoadWithRequest=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _escapeStringRegexp=_interopRequireDefault(require("escape-string-regexp"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/circleci/code/src/WebViewShared.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var defaultOriginWhitelist=exports.defaultOriginWhitelist=['http://*','https://*'];var extractOrigin=function extractOrigin(url){var result=/^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);return result===null?'':result[0];};var originWhitelistToRegex=function originWhitelistToRegex(originWhitelist){return`^${(0,_escapeStringRegexp.default)(originWhitelist).replace(/\\\*/g,'.*')}`;};var passesWhitelist=function passesWhitelist(compiledWhitelist,url){var origin=extractOrigin(url);return compiledWhitelist.some(function(x){return new RegExp(x).test(origin);});};var compileWhitelist=function compileWhitelist(originWhitelist){return['about:blank'].concat((0,_toConsumableArray2.default)(originWhitelist||[])).map(originWhitelistToRegex);};var createOnShouldStartLoadWithRequest=exports.createOnShouldStartLoadWithRequest=function createOnShouldStartLoadWithRequest(loadRequest,originWhitelist,onShouldStartLoadWithRequest){return function(_ref){var nativeEvent=_ref.nativeEvent;var shouldStart=true;var url=nativeEvent.url,lockIdentifier=nativeEvent.lockIdentifier;if(!passesWhitelist(compileWhitelist(originWhitelist),url)){_reactNative.Linking.canOpenURL(url).then(function(supported){if(supported){return _reactNative.Linking.openURL(url);}console.warn(`Can't open url: ${url}`);return undefined;}).catch(function(e){console.warn('Error opening URL: ',e);});shouldStart=false;}else if(onShouldStartLoadWithRequest){shouldStart=onShouldStartLoadWithRequest(nativeEvent);}loadRequest(shouldStart,url,lockIdentifier);};};var defaultRenderLoading=exports.defaultRenderLoading=function defaultRenderLoading(){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{})});};var defaultRenderError=exports.defaultRenderError=function defaultRenderError(errorDomain,errorCode,errorDesc){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorTextTitle,children:"Error loading page"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Domain: ${errorDomain}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Error Code: ${errorCode}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Description: ${errorDesc}`})]});};var useWebViewLogic=exports.useWebViewLogic=function useWebViewLogic(_ref2){var startInLoadingState=_ref2.startInLoadingState,onNavigationStateChange=_ref2.onNavigationStateChange,onLoadStart=_ref2.onLoadStart,onLoad=_ref2.onLoad,onLoadProgress=_ref2.onLoadProgress,onLoadEnd=_ref2.onLoadEnd,onError=_ref2.onError,onLoadSubResourceError=_ref2.onLoadSubResourceError,onHttpErrorProp=_ref2.onHttpErrorProp,onMessageProp=_ref2.onMessageProp,onOpenWindowProp=_ref2.onOpenWindowProp,onRenderProcessGoneProp=_ref2.onRenderProcessGoneProp,onContentProcessDidTerminateProp=_ref2.onContentProcessDidTerminateProp,originWhitelist=_ref2.originWhitelist,onShouldStartLoadWithRequestProp=_ref2.onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback=_ref2.onShouldStartLoadWithRequestCallback;var _useState=(0,_react.useState)(startInLoadingState?'LOADING':'IDLE'),_useState2=(0,_slicedToArray2.default)(_useState,2),viewState=_useState2[0],setViewState=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),lastErrorEvent=_useState4[0],setLastErrorEvent=_useState4[1];var startUrl=(0,_react.useRef)(null);var updateNavigationState=(0,_react.useCallback)(function(event){onNavigationStateChange==null?void 0:onNavigationStateChange(event.nativeEvent);},[onNavigationStateChange]);var onLoadingStart=(0,_react.useCallback)(function(event){startUrl.current=event.nativeEvent.url;onLoadStart==null?void 0:onLoadStart(event);updateNavigationState(event);},[onLoadStart,updateNavigationState]);var onLoadingError=(0,_react.useCallback)(function(event){event.persist();if(onError){onError(event);}else{console.warn('Encountered an error loading page',event.nativeEvent);}onLoadEnd==null?void 0:onLoadEnd(event);if(event.isDefaultPrevented()){return;}setViewState('ERROR');setLastErrorEvent(event.nativeEvent);},[onError,onLoadEnd]);var onLoadingSubResourceError=(0,_react.useCallback)(function(event){onLoadSubResourceError==null?void 0:onLoadSubResourceError(event);},[onLoadSubResourceError]);var onHttpError=(0,_react.useCallback)(function(event){onHttpErrorProp==null?void 0:onHttpErrorProp(event);},[onHttpErrorProp]);var onRenderProcessGone=(0,_react.useCallback)(function(event){onRenderProcessGoneProp==null?void 0:onRenderProcessGoneProp(event);},[onRenderProcessGoneProp]);var onContentProcessDidTerminate=(0,_react.useCallback)(function(event){onContentProcessDidTerminateProp==null?void 0:onContentProcessDidTerminateProp(event);},[onContentProcessDidTerminateProp]);var onLoadingFinish=(0,_react.useCallback)(function(event){onLoad==null?void 0:onLoad(event);onLoadEnd==null?void 0:onLoadEnd(event);var url=event.nativeEvent.url;if(_reactNative.Platform.OS!=='android'||url===startUrl.current){setViewState('IDLE');}updateNavigationState(event);},[onLoad,onLoadEnd,updateNavigationState]);var onMessage=(0,_react.useCallback)(function(event){onMessageProp==null?void 0:onMessageProp(event);},[onMessageProp]);var onLoadingProgress=(0,_react.useCallback)(function(event){var progress=event.nativeEvent.progress;if(_reactNative.Platform.OS==='android'&&progress===1){setViewState(function(prevViewState){return prevViewState==='LOADING'?'IDLE':prevViewState;});}onLoadProgress==null?void 0:onLoadProgress(event);},[onLoadProgress]);var onShouldStartLoadWithRequest=(0,_react.useMemo)(function(){return createOnShouldStartLoadWithRequest(onShouldStartLoadWithRequestCallback,originWhitelist,onShouldStartLoadWithRequestProp);},[originWhitelist,onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback]);var onOpenWindow=(0,_react.useCallback)(function(event){onOpenWindowProp==null?void 0:onOpenWindowProp(event);},[onOpenWindowProp]);return{onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onLoadingStart:onLoadingStart,onLoadingProgress:onLoadingProgress,onLoadingError:onLoadingError,onLoadingSubResourceError:onLoadingSubResourceError,onLoadingFinish:onLoadingFinish,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onContentProcessDidTerminate:onContentProcessDidTerminate,onMessage:onMessage,onOpenWindow:onOpenWindow,viewState:viewState,setViewState:setViewState,lastErrorEvent:lastErrorEvent};};
\ No newline at end of file
diff --git a/apps/expo-go/modules/react-native-webview/lib/WebViewTypes.d.ts b/apps/expo-go/modules/react-native-webview/lib/WebViewTypes.d.ts
index 8cbc89feca8c77..998cc88f03f3fb 100644
--- a/apps/expo-go/modules/react-native-webview/lib/WebViewTypes.d.ts
+++ b/apps/expo-go/modules/react-native-webview/lib/WebViewTypes.d.ts
@@ -953,6 +953,13 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
* @platform android
*/
allowsProtectedMedia?: boolean;
+ /**
+ * Function that is invoked when the `WebView` receives an SSL error for a sub-resource.
+ *
+ * @param event
+ * @platform android
+ */
+ onLoadSubResourceError?: (event: WebViewErrorEvent) => void;
}
export interface WebViewSharedProps extends ViewProps {
/**
diff --git a/apps/expo-go/modules/react-native-webview/package.json b/apps/expo-go/modules/react-native-webview/package.json
index 9d2bd0acc12995..9162fc31acd358 100644
--- a/apps/expo-go/modules/react-native-webview/package.json
+++ b/apps/expo-go/modules/react-native-webview/package.json
@@ -10,7 +10,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "13.15.0",
+ "version": "13.16.0",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"android": "react-native run-android",
diff --git a/apps/expo-go/modules/react-native-webview/src/RNCWebViewNativeComponent.ts b/apps/expo-go/modules/react-native-webview/src/RNCWebViewNativeComponent.ts
index 16b65ace4aaaba..7f4e6c4f73506e 100644
--- a/apps/expo-go/modules/react-native-webview/src/RNCWebViewNativeComponent.ts
+++ b/apps/expo-go/modules/react-native-webview/src/RNCWebViewNativeComponent.ts
@@ -270,6 +270,7 @@ export interface NativeProps extends ViewProps {
mediaPlaybackRequiresUserAction?: WithDefault;
messagingEnabled: boolean;
onLoadingError: DirectEventHandler;
+ onLoadingSubResourceError: DirectEventHandler;
onLoadingFinish: DirectEventHandler;
onLoadingProgress: DirectEventHandler;
onLoadingStart: DirectEventHandler;
diff --git a/apps/expo-go/modules/react-native-webview/src/WebView.android.tsx b/apps/expo-go/modules/react-native-webview/src/WebView.android.tsx
index edf06fafd1c52d..6497a8b1e547c6 100644
--- a/apps/expo-go/modules/react-native-webview/src/WebView.android.tsx
+++ b/apps/expo-go/modules/react-native-webview/src/WebView.android.tsx
@@ -83,6 +83,7 @@ const WebViewComponent = forwardRef<{}, AndroidWebViewProps>(
onError,
onLoad,
onLoadEnd,
+ onLoadSubResourceError,
onLoadProgress,
onHttpError: onHttpErrorProp,
onRenderProcessGone: onRenderProcessGoneProp,
@@ -130,6 +131,7 @@ const WebViewComponent = forwardRef<{}, AndroidWebViewProps>(
lastErrorEvent,
onHttpError,
onLoadingError,
+ onLoadingSubResourceError,
onLoadingFinish,
onLoadingProgress,
onOpenWindow,
@@ -139,6 +141,7 @@ const WebViewComponent = forwardRef<{}, AndroidWebViewProps>(
onLoad,
onError,
onHttpErrorProp,
+ onLoadSubResourceError,
onLoadEnd,
onLoadProgress,
onLoadStart,
@@ -284,6 +287,7 @@ const WebViewComponent = forwardRef<{}, AndroidWebViewProps>(
messagingModuleName={messagingModuleName}
hasOnScroll={!!otherProps.onScroll}
onLoadingError={onLoadingError}
+ onLoadingSubResourceError={onLoadingSubResourceError}
onLoadingFinish={onLoadingFinish}
onLoadingProgress={onLoadingProgress}
onLoadingStart={onLoadingStart}
diff --git a/apps/expo-go/modules/react-native-webview/src/WebViewShared.tsx b/apps/expo-go/modules/react-native-webview/src/WebViewShared.tsx
index 08905ea61669ae..3b0a38b1cc99ce 100644
--- a/apps/expo-go/modules/react-native-webview/src/WebViewShared.tsx
+++ b/apps/expo-go/modules/react-native-webview/src/WebViewShared.tsx
@@ -104,6 +104,7 @@ export const useWebViewLogic = ({
onLoadProgress,
onLoadEnd,
onError,
+ onLoadSubResourceError,
onHttpErrorProp,
onMessageProp,
onOpenWindowProp,
@@ -120,6 +121,7 @@ export const useWebViewLogic = ({
onLoadProgress?: (event: WebViewProgressEvent) => void;
onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
onError?: (event: WebViewErrorEvent) => void;
+ onLoadSubResourceError?: (event: WebViewErrorEvent) => void;
onHttpErrorProp?: (event: WebViewHttpErrorEvent) => void;
onMessageProp?: (event: WebViewMessageEvent) => void;
onOpenWindowProp?: (event: WebViewOpenWindowEvent) => void;
@@ -178,6 +180,13 @@ export const useWebViewLogic = ({
[onError, onLoadEnd]
);
+ const onLoadingSubResourceError = useCallback(
+ (event: WebViewErrorEvent) => {
+ onLoadSubResourceError?.(event);
+ },
+ [onLoadSubResourceError]
+ );
+
const onHttpError = useCallback(
(event: WebViewHttpErrorEvent) => {
onHttpErrorProp?.(event);
@@ -270,6 +279,7 @@ export const useWebViewLogic = ({
onLoadingStart,
onLoadingProgress,
onLoadingError,
+ onLoadingSubResourceError,
onLoadingFinish,
onHttpError,
onRenderProcessGone,
diff --git a/apps/expo-go/modules/react-native-webview/src/WebViewTypes.ts b/apps/expo-go/modules/react-native-webview/src/WebViewTypes.ts
index c534d17f02c8f5..eca81415ab4867 100644
--- a/apps/expo-go/modules/react-native-webview/src/WebViewTypes.ts
+++ b/apps/expo-go/modules/react-native-webview/src/WebViewTypes.ts
@@ -1160,6 +1160,14 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
* @platform android
*/
allowsProtectedMedia?: boolean;
+
+ /**
+ * Function that is invoked when the `WebView` receives an SSL error for a sub-resource.
+ *
+ * @param event
+ * @platform android
+ */
+ onLoadSubResourceError?: (event: WebViewErrorEvent) => void;
}
export interface WebViewSharedProps extends ViewProps {
diff --git a/apps/expo-go/package.json b/apps/expo-go/package.json
index d4a6a4303b0b82..f17c703fd2f8a0 100644
--- a/apps/expo-go/package.json
+++ b/apps/expo-go/package.json
@@ -28,25 +28,24 @@
"@gorhom/bottom-sheet": "5.1.8",
"@graphql-codegen/introspection": "^2.1.1",
"@react-native-async-storage/async-storage": "2.2.0",
- "@react-native-community/datetimepicker": "^8.4.4",
+ "@react-native-community/datetimepicker": "^8.6.0",
"@react-native-community/netinfo": "11.4.1",
- "@react-native-community/slider": "5.0.1",
+ "@react-native-community/slider": "5.1.1",
"@react-native-masked-view/masked-view": "0.3.2",
- "@react-native-picker/picker": "2.11.2",
+ "@react-native-picker/picker": "2.11.4",
"@react-native-segmented-control/segmented-control": "2.5.7",
"@react-navigation/bottom-tabs": "^7.7.3",
"@react-navigation/elements": "^2.8.1",
"@react-navigation/native": "^7.1.21",
"@react-navigation/stack": "^7.6.7",
- "@shopify/react-native-skia": "2.2.12",
- "@stripe/stripe-react-native": "0.50.3",
+ "@shopify/react-native-skia": "2.4.14",
+ "@stripe/stripe-react-native": "0.57.2",
"date-fns": "^2.28.0",
"dedent": "^0.7.0",
"es6-error": "^4.1.1",
"expo": "~54.0.8",
"expo-application": "~7.0.7",
"expo-asset": "~12.0.8",
- "expo-av": "~16.0.7",
"expo-blur": "~15.0.7",
"expo-camera": "~17.0.8",
"expo-constants": "~18.0.9",
@@ -69,19 +68,19 @@
"react-native": "0.83.1",
"react-native-edge-to-edge": "1.6.0",
"react-native-fade-in-image": "^1.6.1",
- "react-native-gesture-handler": "~2.28.0",
+ "react-native-gesture-handler": "~2.30.0",
"react-native-infinite-scroll-view": "^0.4.5",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
- "react-native-keyboard-controller": "^1.18.5",
- "react-native-maps": "1.20.1",
- "react-native-pager-view": "6.9.1",
+ "react-native-keyboard-controller": "^1.20.4",
+ "react-native-maps": "1.26.20",
+ "react-native-pager-view": "8.0.0",
"react-native-paper": "^5.12.5",
- "react-native-reanimated": "4.2.0",
- "react-native-safe-area-context": "5.6.0",
+ "react-native-reanimated": "4.2.1",
+ "react-native-safe-area-context": "5.6.2",
"react-native-screens": "4.19.0",
- "react-native-svg": "15.12.1",
+ "react-native-svg": "15.15.1",
"react-native-view-shot": "4.0.3",
- "react-native-webview": "13.15.0",
+ "react-native-webview": "13.16.0",
"react-native-worklets": "0.7.1",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
diff --git a/apps/expo-go/src/FeatureFlags.ts b/apps/expo-go/src/FeatureFlags.ts
deleted file mode 100644
index 5c0d21f93fd824..00000000000000
--- a/apps/expo-go/src/FeatureFlags.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { isDevice } from 'expo-device';
-
-import Environment from './utils/Environment';
-
-export default {
- // Disable all project tools in the App Store client.
- ENABLE_PROJECT_TOOLS: !Environment.IsIOSRestrictedBuild,
- ENABLE_QR_CODE_BUTTON: isDevice && !Environment.IsIOSRestrictedBuild,
- // Disable the clipboard button in the App Store client.
- ENABLE_CLIPBOARD_BUTTON: !Environment.IsIOSRestrictedBuild,
-};
diff --git a/apps/expo-go/src/HomeApp.tsx b/apps/expo-go/src/HomeApp.tsx
deleted file mode 100644
index 27612089814ba7..00000000000000
--- a/apps/expo-go/src/HomeApp.tsx
+++ /dev/null
@@ -1,235 +0,0 @@
-import { darkTheme, lightTheme } from '@expo/styleguide-native';
-import Ionicons from '@expo/vector-icons/build/Ionicons';
-import MaterialIcons from '@expo/vector-icons/build/MaterialIcons';
-import AsyncStorage from '@react-native-async-storage/async-storage';
-import { Assets as StackAssets } from '@react-navigation/elements';
-import { Asset } from 'expo-asset';
-import { ThemePreference, ThemeProvider } from 'expo-dev-client-components';
-import * as Font from 'expo-font';
-import * as SplashScreen from 'expo-splash-screen';
-import * as React from 'react';
-import { Linking, Platform, StyleSheet, View, useColorScheme } from 'react-native';
-import url from 'url';
-
-import ApolloClient from './api/ApolloClient';
-import { ColorTheme } from './constants/Colors';
-import {
- AppPlatform,
- HomeScreenDataDocument,
- HomeScreenDataQuery,
- HomeScreenDataQueryVariables,
- Home_CurrentUserActorDocument,
- Home_CurrentUserActorQuery,
- Home_CurrentUserActorQueryVariables,
-} from './graphql/types';
-import Navigation from './navigation/Navigation';
-import HistoryActions from './redux/HistoryActions';
-import { useDispatch, useSelector } from './redux/Hooks';
-import SessionActions from './redux/SessionActions';
-import SettingsActions from './redux/SettingsActions';
-import LocalStorage from './storage/LocalStorage';
-import { useAccountName } from './utils/AccountNameContext';
-import { useInitialData } from './utils/InitialDataContext';
-import * as UrlUtils from './utils/UrlUtils';
-import addListenerWithNativeCallback from './utils/addListenerWithNativeCallback';
-
-// Download and cache stack assets, don't block loading on this though
-Asset.loadAsync(StackAssets);
-
-function useSplashScreenWhileLoadingResources(loadResources: () => Promise) {
- const [isSplashScreenShown, setSplashScreenShown] = React.useState(true);
- React.useEffect(() => {
- (async () => {
- // await SplashScreen.preventAutoHideAsync(); // this is called in App (main component of the application)
- await loadResources();
- setSplashScreenShown(false);
- })();
- }, []);
- React.useEffect(() => {
- (async () => {
- if (!isSplashScreenShown) {
- await SplashScreen.hideAsync();
- }
- })();
- }, [isSplashScreenShown]);
-
- return isSplashScreenShown;
-}
-
-export default function HomeApp() {
- const colorScheme = useColorScheme();
- const preferredAppearance = useSelector((data) => data.settings.preferredAppearance);
- const dispatch = useDispatch();
- const { setAccountName } = useAccountName();
- const isShowingSplashScreen = useSplashScreenWhileLoadingResources(async () => {
- await initStateAsync();
- });
-
- const { setCurrentUserData, setHomeScreenData } = useInitialData();
-
- React.useEffect(() => {
- addProjectHistoryListener();
- }, []);
-
- React.useEffect(() => {
- if (!isShowingSplashScreen && Platform.OS === 'ios') {
- // If Expo Go is opened via deep linking, we'll get the URL here
- Linking.getInitialURL().then((initialUrl) => {
- if (initialUrl && shouldOpenUrl(initialUrl)) {
- Linking.openURL(UrlUtils.toExp(initialUrl));
- }
- });
- }
- }, [isShowingSplashScreen]);
-
- const addProjectHistoryListener = () => {
- addListenerWithNativeCallback('ExponentKernel.addHistoryItem', async (event) => {
- let { manifestUrl, manifest, manifestString } = event;
- if (!manifest && manifestString) {
- manifest = JSON.parse(manifestString);
- }
- dispatch(HistoryActions.addHistoryItem(manifestUrl, manifest));
- });
- };
-
- const loadFontsAsync = async () => {
- try {
- await Promise.all([
- Font.loadAsync(Ionicons.font),
- Platform.OS === 'android'
- ? Font.loadAsync(MaterialIcons.font)
- : new Promise((resolve) => setTimeout(resolve, 0)),
- Font.loadAsync({
- 'Inter-Black': require('./assets/Inter/Inter-Black.otf'),
- 'Inter-BlackItalic': require('./assets/Inter/Inter-BlackItalic.otf'),
- 'Inter-Bold': require('./assets/Inter/Inter-Bold.otf'),
- 'Inter-BoldItalic': require('./assets/Inter/Inter-BoldItalic.otf'),
- 'Inter-ExtraBold': require('./assets/Inter/Inter-ExtraBold.otf'),
- 'Inter-ExtraBoldItalic': require('./assets/Inter/Inter-ExtraBoldItalic.otf'),
- 'Inter-ExtraLight': require('./assets/Inter/Inter-ExtraLight.otf'),
- 'Inter-ExtraLightItalic': require('./assets/Inter/Inter-ExtraLightItalic.otf'),
- 'Inter-Regular': require('./assets/Inter/Inter-Regular.otf'),
- 'Inter-Italic': require('./assets/Inter/Inter-Italic.otf'),
- 'Inter-Light': require('./assets/Inter/Inter-Light.otf'),
- 'Inter-LightItalic': require('./assets/Inter/Inter-LightItalic.otf'),
- 'Inter-Medium': require('./assets/Inter/Inter-Medium.otf'),
- 'Inter-MediumItalic': require('./assets/Inter/Inter-MediumItalic.otf'),
- 'Inter-SemiBold': require('./assets/Inter/Inter-SemiBold.otf'),
- 'Inter-SemiBoldItalic': require('./assets/Inter/Inter-SemiBoldItalic.otf'),
- 'Inter-Thin': require('./assets/Inter/Inter-Thin.otf'),
- 'Inter-ThinItalic': require('./assets/Inter/Inter-ThinItalic.otf'),
- }),
- ]);
- } finally {
- return;
- }
- };
-
- const initStateAsync = async () => {
- try {
- dispatch(SettingsActions.loadSettings());
- dispatch(HistoryActions.loadHistory());
-
- const storedSession = await LocalStorage.getSessionAsync();
-
- if (storedSession) {
- dispatch(SessionActions.setSession(storedSession));
- }
-
- const [currentUserQueryResult, persistedCurrentAccount] = await Promise.all([
- ApolloClient.query({
- query: Home_CurrentUserActorDocument,
- context: { headers: { 'expo-session': storedSession?.sessionSecret } },
- }),
- AsyncStorage.getItem('currentAccount'),
- loadFontsAsync(),
- ]);
-
- if (currentUserQueryResult.data && currentUserQueryResult.data.meUserActor) {
- let firstLoadAccountName = persistedCurrentAccount;
- if (firstLoadAccountName) {
- // if there was a persisted account, and it matches the accounts available to the current user, use it
- if (
- [
- currentUserQueryResult.data.meUserActor.username,
- ...currentUserQueryResult.data.meUserActor.accounts.map((account) => account.name),
- ].includes(firstLoadAccountName)
- ) {
- setAccountName(firstLoadAccountName);
- } else {
- // if this persisted account is stale, clear it
- await AsyncStorage.removeItem('currentAccount');
- }
- } else {
- // if there was no persisted account, use the current user's personal account
- firstLoadAccountName = currentUserQueryResult.data.meUserActor.username;
- setAccountName(firstLoadAccountName);
- }
-
- // set initial data for home screen
-
- setCurrentUserData(currentUserQueryResult.data);
-
- if (firstLoadAccountName) {
- const homeScreenData = await ApolloClient.query<
- HomeScreenDataQuery,
- HomeScreenDataQueryVariables
- >({
- query: HomeScreenDataDocument,
- variables: {
- accountName: firstLoadAccountName,
- platform: Platform.OS === 'ios' ? AppPlatform.Ios : AppPlatform.Android,
- },
- context: { headers: { 'expo-session': storedSession?.sessionSecret } },
- });
-
- setHomeScreenData(homeScreenData.data);
- }
- } else {
- // if there is no current user data, clear the accountName
- setAccountName(undefined);
- }
- } finally {
- return;
- }
- };
-
- if (isShowingSplashScreen) {
- return null;
- }
-
- let theme = !preferredAppearance ? colorScheme : preferredAppearance;
- if (theme === undefined || theme === null || (theme !== 'dark' && theme !== 'light')) {
- theme = 'light';
- }
-
- const backgroundColor =
- theme === 'dark' ? darkTheme.background.default : lightTheme.background.default;
-
- return (
-
-
-
-
-
- );
-}
-
-// Certain links (i.e. 'expo.dev/expo-go') should just open the HomeScreen
-function shouldOpenUrl(urlString: string) {
- const parsedUrl = url.parse(urlString);
- return !(
- (parsedUrl.hostname === 'expo.io' || parsedUrl.hostname === 'expo.dev') &&
- parsedUrl.pathname === '/expo-go'
- );
-}
-
-const styles = StyleSheet.create({
- container: { flex: 1 },
-});
diff --git a/apps/expo-go/src/api/APIV2Client.ts b/apps/expo-go/src/api/APIV2Client.ts
deleted file mode 100644
index 005863f869306d..00000000000000
--- a/apps/expo-go/src/api/APIV2Client.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-import { Platform } from 'react-native';
-
-import { ApiError } from './ApiError';
-import Config from './Config';
-import { GenericError } from './GenericError';
-import * as Kernel from '../kernel/Kernel';
-import Store from '../redux/Store';
-
-type SendOptions = {
- method?: string;
- headers?: Record;
- body?: object;
- searchParams?: Record;
-};
-export class APIV2Client {
- private async sendApiV2Request(route: string, options: SendOptions): Promise {
- const url = new URL(`${Config.api.origin}/--/api/v2/${route}`);
- if (options.searchParams) {
- url.search = new URLSearchParams(options?.searchParams).toString();
- }
-
- let response: Response;
- try {
- response = await fetch(url.toString(), {
- method: options.method ?? 'POST',
- body: options.body ? JSON.stringify(options.body) : null,
- headers: {
- ...options.headers,
- accept: 'application/json',
- ...(options.body ? { 'content-type': 'application/json' } : null),
- },
- });
- } catch (error) {
- throw new GenericError(
- `Something went wrong when connecting to Expo: ${(error as Error).message}.`
- );
- }
-
- let text: string;
- try {
- text = await response.text();
- } catch (error) {
- throw new GenericError(
- `Something went wrong when reading the response (HTTP ${response.status}) from Expo: ${
- (error as Error).message
- }.`
- );
- }
-
- let body: any;
- try {
- body = JSON.parse(text);
- } catch {
- throw new GenericError(`The Expo server responded in an unexpected way: ${text}`);
- }
-
- if (Array.isArray(body.errors) && body.errors.length > 0) {
- const responseError = body.errors[0];
- const errorMessage = responseError.details
- ? responseError.details.message
- : responseError.message;
- const error = new ApiError(errorMessage, responseError.code);
- error.serverStack = responseError.stack;
- error.metadata = responseError.metadata;
- throw error;
- }
-
- if (!response.ok) {
- throw new GenericError(`The Expo server responded with a ${response.status} error.`);
- }
-
- return body.data;
- }
-
- public async sendAuthenticatedApiV2Request(
- route: string,
- options: SendOptions = {}
- ): Promise {
- const { session } = Store.getState();
-
- const sessionSecret = session.sessionSecret;
-
- if (!sessionSecret) {
- throw new ApiError('Must be logged in to perform request');
- }
-
- const newOptions = {
- ...options,
- headers: {
- ...options.headers,
- ...(sessionSecret
- ? {
- 'Expo-SDK-Version': Kernel.sdkVersions,
- 'Expo-Platform': Platform.OS,
- 'Expo-Session': sessionSecret,
- }
- : {}),
- },
- };
- return await this.sendApiV2Request(route, newOptions);
- }
-
- public async sendOptionallyAuthenticatedApiV2Request(
- route: string,
- options: SendOptions = {}
- ): Promise {
- const { session } = Store.getState();
-
- const sessionSecret = session.sessionSecret;
- const newOptions = {
- ...options,
- headers: {
- ...options.headers,
- ...(sessionSecret
- ? {
- 'Expo-SDK-Version': Kernel.sdkVersions,
- 'Expo-Platform': Platform.OS,
- 'Expo-Session': sessionSecret,
- }
- : {}),
- },
- };
- return await this.sendApiV2Request(route, newOptions);
- }
-
- public async sendUnauthenticatedApiV2Request(
- route: string,
- options: SendOptions = {}
- ): Promise {
- return await this.sendApiV2Request(route, options);
- }
-}
diff --git a/apps/expo-go/src/api/ApiError.ts b/apps/expo-go/src/api/ApiError.ts
deleted file mode 100644
index 6c89c8e45b65b4..00000000000000
--- a/apps/expo-go/src/api/ApiError.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import ExtendableError from 'es6-error';
-
-export class ApiError extends ExtendableError {
- code: string;
- serverStack?: string;
- metadata?: object;
-
- constructor(message: string, code: string = 'UNKNOWN') {
- super(message);
- this.code = code;
- }
-}
diff --git a/apps/expo-go/src/api/ApiV2Error.ts b/apps/expo-go/src/api/ApiV2Error.ts
deleted file mode 100644
index e007c447848277..00000000000000
--- a/apps/expo-go/src/api/ApiV2Error.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import ExtendableError from 'es6-error';
-
-export default class ApiV2Error extends ExtendableError {
- code: string;
- serverStack?: string;
- metadata?: object;
-
- constructor(message: string, code: string = 'UNKNOWN') {
- super(message);
- this.code = code;
- }
-}
diff --git a/apps/expo-go/src/api/ApolloClient.ts b/apps/expo-go/src/api/ApolloClient.ts
deleted file mode 100644
index a5727da7b90f56..00000000000000
--- a/apps/expo-go/src/api/ApolloClient.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { ApolloClient, InMemoryCache, from } from '@apollo/client';
-import { setContext } from '@apollo/client/link/context';
-import { HttpLink } from '@apollo/client/link/http';
-import { offsetLimitPagination } from '@apollo/client/utilities';
-
-import Config from './Config';
-import Connectivity from './Connectivity';
-import Store from '../redux/Store';
-
-const httpLink = new HttpLink({
- uri: `${Config.api.origin}/--/graphql`,
-});
-
-const connectivityLink = setContext(async (): Promise => {
- const isConnected = await Connectivity.isAvailableAsync();
- if (!isConnected) {
- throw new Error('No connection available');
- }
-});
-
-const authMiddlewareLink = setContext((_request, previousContext): any => {
- const { sessionSecret } = Store.getState().session;
-
- if (sessionSecret) {
- return {
- ...previousContext,
- headers: {
- 'expo-session': sessionSecret,
- ...previousContext.headers,
- },
- };
- }
-
- return previousContext;
-});
-
-const link = from([connectivityLink, authMiddlewareLink, httpLink]);
-
-const cache = new InMemoryCache({
- possibleTypes: {
- AccountUsageMetadata: ['AccountUsageEASBuildMetadata'],
- ActivityTimelineProjectActivity: ['Build', 'BuildJob', 'Submission', 'Update'],
- Actor: ['Robot', 'SSOUser', 'User'],
- BuildOrBuildJob: ['Build', 'BuildJob'],
- EASBuildOrClassicBuildJob: ['Build', 'BuildJob'],
- FcmSnippet: ['FcmSnippetLegacy', 'FcmSnippetV1'],
- PlanEnablement: ['Concurrencies', 'EASTotalPlanEnablement'],
- Project: ['App', 'Snack'],
- UserActor: ['SSOUser', 'User'],
- },
- addTypename: true,
- typePolicies: {
- Query: {
- fields: {
- account: {
- merge: false,
- },
- app: {
- merge: false,
- },
- },
- },
- Account: {
- fields: {
- apps: offsetLimitPagination(),
- snacks: offsetLimitPagination(),
- },
- },
- App: {
- fields: {
- updateBranches: offsetLimitPagination(),
- },
- },
- },
-});
-
-export default new ApolloClient({
- link,
- cache,
-});
diff --git a/apps/expo-go/src/api/AuthApi.ts b/apps/expo-go/src/api/AuthApi.ts
deleted file mode 100644
index 41482a96d6fe9d..00000000000000
--- a/apps/expo-go/src/api/AuthApi.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { APIV2Client } from './APIV2Client';
-
-async function signOutAsync(sessionSecret: string | null): Promise {
- if (!sessionSecret) {
- return;
- }
- const api = new APIV2Client();
- await api.sendAuthenticatedApiV2Request('auth/logout');
-}
-
-export default {
- signOutAsync,
-};
diff --git a/apps/expo-go/src/api/Config.ts b/apps/expo-go/src/api/Config.ts
deleted file mode 100644
index 54568c423285fb..00000000000000
--- a/apps/expo-go/src/api/Config.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-const host = 'exp.host';
-// const host = 'staging.exp.host';
-// const host = 'localhost:3000';
-//const host = 'ed56a018.ngrok.io';
-const origin = `https://${host}`;
-// const origin = 'http://localhost:3000';
-const websiteOrigin = 'https://expo.dev';
-// const websiteOrigin = 'http://localhost:3001';
-
-export default {
- api: {
- host,
- origin,
- },
- website: {
- origin: websiteOrigin,
- },
-};
diff --git a/apps/expo-go/src/api/Connectivity.ts b/apps/expo-go/src/api/Connectivity.ts
deleted file mode 100644
index 289cbb2376103b..00000000000000
--- a/apps/expo-go/src/api/Connectivity.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import NetInfo, { NetInfoState } from '@react-native-community/netinfo';
-
-type ConnectivityListener = (available: boolean) => void;
-
-class Connectivity {
- _isAvailable = true;
- _listeners = new Set