react-native-webview-bootpay 11.26.20 → 13.6.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 (335) hide show
  1. package/README.md +9 -31
  2. package/android/build.gradle +70 -112
  3. package/android/gradle.properties +5 -6
  4. package/android/src/main/java/kr/co/bootpay/webview/BPCBasicAuthCredential.java +11 -0
  5. package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +354 -434
  6. package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +350 -259
  7. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +253 -399
  8. package/android/src/main/java/kr/co/bootpay/webview/{WebViewConfig.java → BPCWebViewConfig.java} +3 -4
  9. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewFileProvider.java +1 -1
  10. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManager.java +290 -877
  11. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManagerImpl.kt +664 -0
  12. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModule.java +29 -520
  13. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModuleImpl.java +554 -0
  14. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.java +56 -0
  15. package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +122 -0
  16. package/android/src/main/java/kr/co/bootpay/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
  17. package/android/src/main/java/kr/co/bootpay/webview/events/TopNewWindowEvent.kt +25 -0
  18. package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewManager.java +544 -0
  19. package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewModule.java +57 -0
  20. package/apple/BPCWebView.h +22 -126
  21. package/apple/BPCWebView.mm +528 -0
  22. package/apple/BPCWebViewDecisionManager.h +20 -0
  23. package/apple/BPCWebViewDecisionManager.m +47 -0
  24. package/apple/BPCWebViewImpl.h +150 -0
  25. package/apple/{BPCWebView.m → BPCWebViewImpl.m} +377 -210
  26. package/apple/BPCWebViewManager.h +4 -8
  27. package/apple/{BPCWebViewManager.m → BPCWebViewManager.mm} +93 -149
  28. package/ios/{BPCWebView.xcodeproj → RNCWebView.xcodeproj}/project.pbxproj +18 -18
  29. package/ios/main.jsbundle +457 -0
  30. package/lib/BPCWebViewNativeComponent.d.ts +242 -0
  31. package/lib/BPCWebViewNativeComponent.d.ts.map +1 -0
  32. package/lib/BPCWebViewNativeComponent.js +6 -0
  33. package/lib/NativeBPCWebView.d.ts +10 -0
  34. package/lib/NativeBPCWebView.d.ts.map +1 -0
  35. package/lib/NativeBPCWebView.js +2 -0
  36. package/lib/WebView.android.d.ts.map +1 -1
  37. package/lib/WebView.android.js +53 -29
  38. package/lib/WebView.ios.d.ts.map +1 -1
  39. package/lib/WebView.ios.js +49 -28
  40. package/lib/WebView.macos.d.ts.map +1 -1
  41. package/lib/WebView.macos.js +10 -14
  42. package/lib/WebView.windows.d.ts.map +1 -1
  43. package/lib/WebView.windows.js +4 -6
  44. package/lib/WebViewNativeComponent.macos.d.ts +2 -2
  45. package/lib/WebViewNativeComponent.macos.js +2 -2
  46. package/lib/WebViewShared.d.ts +4 -2
  47. package/lib/WebViewShared.d.ts.map +1 -1
  48. package/lib/WebViewShared.js +8 -2
  49. package/lib/WebViewTypes.d.ts +62 -95
  50. package/lib/WebViewTypes.d.ts.map +1 -1
  51. package/lib/WebViewTypes.js +0 -16
  52. package/macos/RNCWebView.xcodeproj/project.pbxproj +44 -44
  53. package/package.json +38 -20
  54. package/react-native-webview-bootpay.podspec +22 -3
  55. package/react-native.config.js +1 -2
  56. package/src/BPCWebViewNativeComponent.ts +281 -0
  57. package/src/NativeBPCWebView.ts +14 -0
  58. package/src/WebView.android.tsx +229 -0
  59. package/src/WebView.ios.tsx +232 -0
  60. package/src/WebView.macos.tsx +177 -0
  61. package/src/WebView.styles.ts +44 -0
  62. package/src/WebView.tsx +18 -0
  63. package/src/WebView.windows.tsx +156 -0
  64. package/src/WebViewNativeComponent.macos.ts +8 -0
  65. package/src/WebViewNativeComponent.windows.ts +10 -0
  66. package/src/WebViewShared.tsx +235 -0
  67. package/src/WebViewTypes.ts +1287 -0
  68. package/src/__tests__/WebViewShared-test.js +208 -0
  69. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  70. package/src/index.ts +4 -0
  71. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +1 -1
  72. package/windows/ReactNativeWebView/ReactWebView.idl +1 -0
  73. package/windows/ReactNativeWebView/ReactWebView2.cpp +142 -19
  74. package/windows/ReactNativeWebView/ReactWebView2.h +3 -0
  75. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +29 -5
  76. package/windows/ReactNativeWebView/pch.h +1 -0
  77. package/android/.editorconfig +0 -6
  78. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/results.bin +0 -1
  79. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.dex +0 -0
  80. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient.dex +0 -0
  81. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$1.dex +0 -0
  82. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.dex +0 -0
  83. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.dex +0 -0
  84. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView.dex +0 -0
  85. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewClient.dex +0 -0
  86. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.dex +0 -0
  87. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$1.dex +0 -0
  88. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$2.dex +0 -0
  89. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$3.dex +0 -0
  90. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$4.dex +0 -0
  91. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager.dex +0 -0
  92. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$1.dex +0 -0
  93. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$2.dex +0 -0
  94. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.dex +0 -0
  95. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.dex +0 -0
  96. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.dex +0 -0
  97. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule.dex +0 -0
  98. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewPackage.dex +0 -0
  99. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BasicAuthCredential.dex +0 -0
  100. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BuildConfig.dex +0 -0
  101. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/URLUtil.dex +0 -0
  102. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/WebViewConfig.dex +0 -0
  103. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.dex +0 -0
  104. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.dex +0 -0
  105. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.dex +0 -0
  106. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.dex +0 -0
  107. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.dex +0 -0
  108. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.dex +0 -0
  109. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.dex +0 -0
  110. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.dex +0 -0
  111. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.dex +0 -0
  112. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.dex +0 -0
  113. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.dex +0 -0
  114. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent.dex +0 -0
  115. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.dex +0 -0
  116. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.dex +0 -0
  117. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.dex +0 -0
  118. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.dex +0 -0
  119. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/desugar_graph.bin +0 -0
  120. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/results.bin +0 -1
  121. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/transformed/classes/classes.dex +0 -0
  122. package/android/build/.transforms/c0e86b44db04fcaf424a5b7ce79324f4/results.bin +0 -1
  123. package/android/build/generated/source/buildConfig/debug/kr/co/bootpay/webview/BuildConfig.java +0 -10
  124. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -106
  125. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  126. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
  127. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  128. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  129. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  130. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1861
  131. package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
  132. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -2
  133. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  134. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  135. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  136. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  137. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  138. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  139. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  140. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  141. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  142. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
  143. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  144. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  145. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  146. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  147. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  148. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  149. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  150. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  151. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  152. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  153. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  154. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  155. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  156. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  157. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BuildConfig.class +0 -0
  158. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/URLUtil.class +0 -0
  159. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  160. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  161. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -3
  162. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -210
  163. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -106
  164. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  165. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  166. package/android/build/intermediates/packaged_res/debug/xml/file_provider_paths.xml +0 -6
  167. package/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  168. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  169. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  170. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  171. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  172. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  173. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView.class +0 -0
  174. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  175. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  176. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  177. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  178. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  179. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  180. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  181. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  182. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  183. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  184. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  185. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  186. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  187. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  188. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  189. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BuildConfig.class +0 -0
  190. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/URLUtil.class +0 -0
  191. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  192. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  193. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  194. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  195. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  196. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  197. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  198. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  199. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  200. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  201. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  202. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  203. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  204. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  205. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  206. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  207. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  208. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  209. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1381
  210. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  211. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  212. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  213. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  214. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  215. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  216. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  217. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  218. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  219. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  220. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  221. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  222. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  223. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  224. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  225. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  226. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  227. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  228. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  229. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  230. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  231. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  232. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  233. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  234. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  235. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  236. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  237. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  238. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  239. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  240. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  241. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  242. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  243. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  244. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  245. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  246. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  247. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  248. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  249. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  250. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  251. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  252. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  253. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  254. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  255. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  256. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  257. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  258. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  259. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  260. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  261. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  262. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  263. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  264. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  265. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  266. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  267. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  268. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  269. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  270. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  271. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  272. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  273. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  274. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  275. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  276. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  277. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  278. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  279. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  280. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  281. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  282. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  283. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  284. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  285. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  286. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  287. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  288. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  289. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  290. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  291. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  292. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  293. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  294. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  295. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  296. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  297. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  298. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  299. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  300. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  301. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  302. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  303. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  304. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -229
  305. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  306. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  307. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  308. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  309. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  310. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  311. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  312. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  313. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  314. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  315. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  316. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  317. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  318. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  319. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  320. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  321. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  322. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  323. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  324. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.kt +0 -15
  325. package/android/src/main/java/kr/co/bootpay/webview/BasicAuthCredential.java +0 -11
  326. package/ios/BPCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  327. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  328. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcuserdata/ehowlsla.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  329. package/ios/BPCWebView.xcodeproj/xcuserdata/ehowlsla.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  330. package/lib/WebViewNativeComponent.android.d.ts +0 -4
  331. package/lib/WebViewNativeComponent.android.d.ts.map +0 -1
  332. package/lib/WebViewNativeComponent.android.js +0 -3
  333. package/lib/WebViewNativeComponent.ios.d.ts +0 -4
  334. package/lib/WebViewNativeComponent.ios.d.ts.map +0 -1
  335. package/lib/WebViewNativeComponent.ios.js +0 -3
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * Portions copyright for react-native-windows:
8
+ *
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+
13
+ import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
14
+ import {
15
+ View,
16
+ Image,
17
+ ImageSourcePropType,
18
+ NativeModules,
19
+ } from 'react-native';
20
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
21
+ import invariant from 'invariant';
22
+ import {RCTWebView, RCTWebView2} from "./WebViewNativeComponent.windows";
23
+ import { useWebViewLogic, defaultOriginWhitelist, defaultRenderError, defaultRenderLoading, } from './WebViewShared';
24
+ import {
25
+ NativeWebViewWindows,
26
+ WindowsWebViewProps,
27
+ } from './WebViewTypes';
28
+
29
+ import styles from './WebView.styles';
30
+
31
+ const Commands = codegenNativeCommands({
32
+ supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', 'injectJavaScript', 'requestFocus', 'postMessage', 'loadUrl'],
33
+ });
34
+ const { resolveAssetSource } = Image;
35
+
36
+ const WebViewComponent = forwardRef<{}, WindowsWebViewProps>(({
37
+ cacheEnabled = true,
38
+ originWhitelist = defaultOriginWhitelist,
39
+ startInLoadingState,
40
+ onNavigationStateChange,
41
+ onLoadStart,
42
+ onError,
43
+ onLoad,
44
+ onLoadEnd,
45
+ onLoadProgress,
46
+ onHttpError: onHttpErrorProp,
47
+ onMessage: onMessageProp,
48
+ renderLoading,
49
+ renderError,
50
+ style,
51
+ containerStyle,
52
+ source,
53
+ nativeConfig,
54
+ onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
55
+ useWebView2,
56
+ ...otherProps
57
+ }, ref) => {
58
+ const webViewRef = useRef<NativeWebViewWindows | null>(null);
59
+
60
+ const RCTWebViewString = useWebView2 ? 'RCTWebView2' : 'RCTWebView';
61
+
62
+ const onShouldStartLoadWithRequestCallback = useCallback((shouldStart: boolean, url: string, lockIdentifier?: number) => {
63
+ if (lockIdentifier) {
64
+ if (RCTWebViewString === 'RCTWebView'){
65
+ NativeModules.RCTWebView.onShouldStartLoadWithRequestCallback(shouldStart, lockIdentifier);
66
+ }else{
67
+ NativeModules.RCTWebView2.onShouldStartLoadWithRequestCallback(shouldStart, lockIdentifier);
68
+ }
69
+ } else if (shouldStart) {
70
+ Commands.loadUrl(webViewRef, url);
71
+ }
72
+ }, [RCTWebViewString]);
73
+
74
+ const { onLoadingStart, onShouldStartLoadWithRequest, onMessage, viewState, setViewState, lastErrorEvent, onHttpError, onLoadingError, onLoadingFinish, onLoadingProgress } = useWebViewLogic({
75
+ onNavigationStateChange,
76
+ onLoad,
77
+ onError,
78
+ onHttpErrorProp,
79
+ onLoadEnd,
80
+ onLoadProgress,
81
+ onLoadStart,
82
+ onMessageProp,
83
+ startInLoadingState,
84
+ originWhitelist,
85
+ onShouldStartLoadWithRequestProp,
86
+ onShouldStartLoadWithRequestCallback,
87
+ })
88
+
89
+ useImperativeHandle(ref, () => ({
90
+ goForward: () => Commands.goForward(webViewRef.current),
91
+ goBack: () => Commands.goBack(webViewRef.current),
92
+ reload: () => {
93
+ setViewState(
94
+ 'LOADING',
95
+ ); Commands.reload(webViewRef.current)
96
+ },
97
+ stopLoading: () => Commands.stopLoading(webViewRef.current),
98
+ postMessage: (data: string) => Commands.postMessage(webViewRef.current, data),
99
+ injectJavaScript: (data: string) => Commands.injectJavaScript(webViewRef.current, data),
100
+ requestFocus: () => Commands.requestFocus(webViewRef.current),
101
+ }), [setViewState, webViewRef]);
102
+
103
+ let otherView = null;
104
+ if (viewState === 'LOADING') {
105
+ otherView = (renderLoading || defaultRenderLoading)();
106
+ } else if (viewState === 'ERROR') {
107
+ invariant(lastErrorEvent != null, 'lastErrorEvent expected to be non-null');
108
+ otherView = (renderError || defaultRenderError)(
109
+ lastErrorEvent.domain,
110
+ lastErrorEvent.code,
111
+ lastErrorEvent.description,
112
+ );
113
+ } else if (viewState !== 'IDLE') {
114
+ console.error(`BPCWebView invalid state encountered: ${viewState}`);
115
+ }
116
+
117
+ const webViewStyles = [styles.container, styles.webView, style];
118
+ const webViewContainerStyle = [styles.container, containerStyle];
119
+
120
+ const NativeWebView
121
+ = useWebView2? RCTWebView2 : RCTWebView;
122
+
123
+ const webView = <NativeWebView
124
+ key="webViewKey"
125
+ {...otherProps}
126
+ messagingEnabled={typeof onMessageProp === 'function'}
127
+ onLoadingError={onLoadingError}
128
+ onLoadingFinish={onLoadingFinish}
129
+ onLoadingProgress={onLoadingProgress}
130
+ onLoadingStart={onLoadingStart}
131
+ onHttpError={onHttpError}
132
+ onMessage={onMessage}
133
+ onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
134
+ ref={webViewRef}
135
+ // TODO: find a better way to type this.
136
+ source={resolveAssetSource(source as ImageSourcePropType)}
137
+ style={webViewStyles}
138
+ cacheEnabled={cacheEnabled}
139
+ {...nativeConfig?.props}
140
+ />
141
+
142
+ return (
143
+ <View style={webViewContainerStyle}>
144
+ {webView}
145
+ {otherView}
146
+ </View>
147
+ );
148
+ });
149
+
150
+ // native implementation should return "true" only for Android 5+
151
+ const isFileUploadSupported: () => Promise<boolean>
152
+ = async () => false;
153
+
154
+ const WebView = Object.assign(WebViewComponent, {isFileUploadSupported});
155
+
156
+ export default WebView;
@@ -0,0 +1,8 @@
1
+ import { requireNativeComponent } from "react-native";
2
+ import type { NativeWebViewMacOS } from "./WebViewTypes";
3
+
4
+ const BPCWebView: typeof NativeWebViewMacOS = requireNativeComponent(
5
+ 'BPCWebView',
6
+ );
7
+
8
+ export default BPCWebView;
@@ -0,0 +1,10 @@
1
+ import { requireNativeComponent } from "react-native";
2
+ import type { NativeWebViewWindows } from "./WebViewTypes";
3
+
4
+ export const RCTWebView: typeof NativeWebViewWindows = requireNativeComponent(
5
+ 'RCTWebView',
6
+ );
7
+
8
+ export const RCTWebView2: typeof NativeWebViewWindows = requireNativeComponent(
9
+ 'RCTWebView2',
10
+ );
@@ -0,0 +1,235 @@
1
+ import escapeStringRegexp from 'escape-string-regexp';
2
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
3
+ import { Linking, View, ActivityIndicator, Text, Platform } from 'react-native';
4
+ import {
5
+ OnShouldStartLoadWithRequest,
6
+ ShouldStartLoadRequestEvent,
7
+ WebViewError,
8
+ WebViewErrorEvent,
9
+ WebViewHttpErrorEvent,
10
+ WebViewMessageEvent,
11
+ WebViewNavigation,
12
+ WebViewNavigationEvent,
13
+ WebViewOpenWindowEvent,
14
+ WebViewProgressEvent,
15
+ WebViewRenderProcessGoneEvent,
16
+ WebViewTerminatedEvent,
17
+ } from './WebViewTypes';
18
+ import styles from './WebView.styles';
19
+
20
+ const defaultOriginWhitelist = ['http://*', 'https://*'] as const;
21
+
22
+ const extractOrigin = (url: string): string => {
23
+ const result = /^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);
24
+ return result === null ? '' : result[0];
25
+ };
26
+
27
+ const originWhitelistToRegex = (originWhitelist: string): string =>
28
+ `^${escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*')}`;
29
+
30
+ const passesWhitelist = (
31
+ compiledWhitelist: readonly string[],
32
+ url: string,
33
+ ) => {
34
+ const origin = extractOrigin(url);
35
+ return compiledWhitelist.some(x => new RegExp(x).test(origin));
36
+ };
37
+
38
+ const compileWhitelist = (
39
+ originWhitelist: readonly string[],
40
+ ): readonly string[] =>
41
+ ['about:blank', ...(originWhitelist || [])].map(originWhitelistToRegex);
42
+
43
+ const createOnShouldStartLoadWithRequest = (
44
+ loadRequest: (
45
+ shouldStart: boolean,
46
+ url: string,
47
+ lockIdentifier: number,
48
+ ) => void,
49
+ originWhitelist: readonly string[],
50
+ onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
51
+ ) => {
52
+ return ({ nativeEvent }: ShouldStartLoadRequestEvent) => {
53
+ let shouldStart = true;
54
+ const { url, lockIdentifier } = nativeEvent;
55
+
56
+ if (!passesWhitelist(compileWhitelist(originWhitelist), url)) {
57
+ Linking.canOpenURL(url).then((supported) => {
58
+ if (supported) {
59
+ return Linking.openURL(url);
60
+ }
61
+ console.warn(`Can't open url: ${url}`);
62
+ return undefined;
63
+ }).catch(e => {
64
+ console.warn('Error opening URL: ', e);
65
+ });
66
+ shouldStart = false;
67
+ } else if (onShouldStartLoadWithRequest) {
68
+ shouldStart = onShouldStartLoadWithRequest(nativeEvent);
69
+ }
70
+
71
+ loadRequest(shouldStart, url, lockIdentifier);
72
+ };
73
+ };
74
+
75
+ const defaultRenderLoading = () => (
76
+ <View style={styles.loadingOrErrorView}>
77
+ <ActivityIndicator />
78
+ </View>
79
+ );
80
+ const defaultRenderError = (
81
+ errorDomain: string | undefined,
82
+ errorCode: number,
83
+ errorDesc: string,
84
+ ) => (
85
+ <View style={styles.loadingOrErrorView}>
86
+ <Text style={styles.errorTextTitle}>Error loading page</Text>
87
+ <Text style={styles.errorText}>{`Domain: ${errorDomain}`}</Text>
88
+ <Text style={styles.errorText}>{`Error Code: ${errorCode}`}</Text>
89
+ <Text style={styles.errorText}>{`Description: ${errorDesc}`}</Text>
90
+ </View>
91
+ );
92
+
93
+ export {
94
+ defaultOriginWhitelist,
95
+ createOnShouldStartLoadWithRequest,
96
+ defaultRenderLoading,
97
+ defaultRenderError,
98
+ };
99
+
100
+ export const useWebViewLogic = ({
101
+ startInLoadingState,
102
+ onNavigationStateChange,
103
+ onLoadStart,
104
+ onLoad,
105
+ onLoadProgress,
106
+ onLoadEnd,
107
+ onError,
108
+ onHttpErrorProp,
109
+ onMessageProp,
110
+ onOpenWindowProp,
111
+ onRenderProcessGoneProp,
112
+ onContentProcessDidTerminateProp,
113
+ originWhitelist,
114
+ onShouldStartLoadWithRequestProp,
115
+ onShouldStartLoadWithRequestCallback,
116
+ }: {
117
+ startInLoadingState?: boolean
118
+ onNavigationStateChange?: (event: WebViewNavigation) => void;
119
+ onLoadStart?: (event: WebViewNavigationEvent) => void;
120
+ onLoad?: (event: WebViewNavigationEvent) => void;
121
+ onLoadProgress?: (event: WebViewProgressEvent) => void;
122
+ onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
123
+ onError?: (event: WebViewErrorEvent) => void;
124
+ onHttpErrorProp?: (event: WebViewHttpErrorEvent) => void;
125
+ onMessageProp?: (event: WebViewMessageEvent) => void;
126
+ onOpenWindowProp?: (event: WebViewOpenWindowEvent) => void;
127
+ onRenderProcessGoneProp?: (event: WebViewRenderProcessGoneEvent) => void;
128
+ onContentProcessDidTerminateProp?: (event: WebViewTerminatedEvent) => void;
129
+ originWhitelist: readonly string[];
130
+ onShouldStartLoadWithRequestProp?: OnShouldStartLoadWithRequest;
131
+ onShouldStartLoadWithRequestCallback: (shouldStart: boolean, url: string, lockIdentifier?: number | undefined) => void;
132
+ }) => {
133
+
134
+ const [viewState, setViewState] = useState<'IDLE' | 'LOADING' | 'ERROR'>(startInLoadingState ? "LOADING" : "IDLE");
135
+ const [lastErrorEvent, setLastErrorEvent] = useState<WebViewError | null>(null);
136
+ const startUrl = useRef<string | null>(null)
137
+
138
+
139
+ const updateNavigationState = useCallback((event: WebViewNavigationEvent) => {
140
+ onNavigationStateChange?.(event.nativeEvent);
141
+ }, [onNavigationStateChange]);
142
+
143
+ const onLoadingStart = useCallback((event: WebViewNavigationEvent) => {
144
+ // Needed for android
145
+ startUrl.current = event.nativeEvent.url;
146
+ // !Needed for android
147
+
148
+ onLoadStart?.(event);
149
+ updateNavigationState(event);
150
+ }, [onLoadStart, updateNavigationState]);
151
+
152
+ const onLoadingError = useCallback((event: WebViewErrorEvent) => {
153
+ event.persist();
154
+ if (onError) {
155
+ onError(event);
156
+ } else {
157
+ console.warn('Encountered an error loading page', event.nativeEvent);
158
+ }
159
+ onLoadEnd?.(event);
160
+ if (event.isDefaultPrevented()) { return };
161
+ setViewState('ERROR');
162
+ setLastErrorEvent(event.nativeEvent);
163
+ }, [onError, onLoadEnd]);
164
+
165
+ const onHttpError = useCallback((event: WebViewHttpErrorEvent) => {
166
+ onHttpErrorProp?.(event);
167
+ }, [onHttpErrorProp]);
168
+
169
+ // Android Only
170
+ const onRenderProcessGone = useCallback((event: WebViewRenderProcessGoneEvent) => {
171
+ onRenderProcessGoneProp?.(event);
172
+ }, [onRenderProcessGoneProp]);
173
+ // !Android Only
174
+
175
+ // iOS Only
176
+ const onContentProcessDidTerminate = useCallback((event: WebViewTerminatedEvent) => {
177
+ onContentProcessDidTerminateProp?.(event);
178
+ }, [onContentProcessDidTerminateProp]);
179
+ // !iOS Only
180
+
181
+ const onLoadingFinish = useCallback((event: WebViewNavigationEvent) => {
182
+ onLoad?.(event);
183
+ onLoadEnd?.(event);
184
+ const { nativeEvent: { url } } = event;
185
+ // on Android, only if url === startUrl
186
+ if (Platform.OS !== "android" || url === startUrl.current) {
187
+ setViewState('IDLE');
188
+ }
189
+ // !on Android, only if url === startUrl
190
+ updateNavigationState(event);
191
+ }, [onLoad, onLoadEnd, updateNavigationState]);
192
+
193
+ const onMessage = useCallback((event: WebViewMessageEvent) => {
194
+ onMessageProp?.(event);
195
+ }, [onMessageProp]);
196
+
197
+ const onLoadingProgress = useCallback((event: WebViewProgressEvent) => {
198
+ const { nativeEvent: { progress } } = event;
199
+ // patch for Android only
200
+ if (Platform.OS === "android" && progress === 1) {
201
+ setViewState(prevViewState => prevViewState === 'LOADING' ? 'IDLE' : prevViewState);
202
+ }
203
+ // !patch for Android only
204
+ onLoadProgress?.(event);
205
+ }, [onLoadProgress]);
206
+
207
+ const onShouldStartLoadWithRequest = useMemo(() => createOnShouldStartLoadWithRequest(
208
+ onShouldStartLoadWithRequestCallback,
209
+ originWhitelist,
210
+ onShouldStartLoadWithRequestProp,
211
+ )
212
+ , [originWhitelist, onShouldStartLoadWithRequestProp, onShouldStartLoadWithRequestCallback])
213
+
214
+ // Android and iOS Only
215
+ const onOpenWindow = useCallback((event: WebViewOpenWindowEvent) => {
216
+ onOpenWindowProp?.(event);
217
+ }, [onOpenWindowProp]);
218
+ // !Android and iOS Only
219
+
220
+ return {
221
+ onShouldStartLoadWithRequest,
222
+ onLoadingStart,
223
+ onLoadingProgress,
224
+ onLoadingError,
225
+ onLoadingFinish,
226
+ onHttpError,
227
+ onRenderProcessGone,
228
+ onContentProcessDidTerminate,
229
+ onMessage,
230
+ onOpenWindow,
231
+ viewState,
232
+ setViewState,
233
+ lastErrorEvent,
234
+ }
235
+ };