Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sabadie/merge upstream 3 #2

Merged
merged 26 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c4c8e4c
fix: add namespace to build.gradle for gradle 8 compat (required for …
alexhernandez Oct 6, 2023
663f256
chore(release): 13.6.1 [skip ci]
semantic-release-bot Oct 6, 2023
886664d
fix(android): Prevent libhwui crash when WebView is in ScrollView (#2…
Kudo Oct 6, 2023
fd61a32
chore(release): 13.6.2 [skip ci]
semantic-release-bot Oct 6, 2023
ecc1100
fix: Adds field `"react-native"` to `package.json` (#3209)
UNIDY2002 Nov 22, 2023
9386bb7
chore(release): 13.6.3 [skip ci]
semantic-release-bot Nov 22, 2023
b4f047a
fix(iOS): update podspec to use install_modules_dependencies (#3231)
lgaches Jan 2, 2024
3d903fa
chore(readme): fix typos (#3270)
thegreatzeus Jan 2, 2024
f849077
fix(android): add buildFeatures.buildConfig true for AGP8+ compat (#3…
mikehardy Jan 2, 2024
977c18e
chore(release): 13.6.4 [skip ci]
semantic-release-bot Jan 2, 2024
5662f57
chore(docs): update cacheEnabled description (#3260)
wandersonalwes Jan 2, 2024
6960a19
chore(android): Update new architecture config (#3047)
j-piasecki Jan 2, 2024
9e2794e
feat(Windows): Add support for custom headers, POST requests and `onO…
jfkm69 Jan 31, 2024
07cebe3
chore(release): 13.7.0 [skip ci]
semantic-release-bot Jan 31, 2024
f0791d8
fix(Windows): Refactor ReactWebView2.cpp to handle optional 'method' …
jfkm69 Feb 6, 2024
d02f575
chore(release): 13.7.1 [skip ci]
semantic-release-bot Feb 6, 2024
7af398c
fix(ios, macos): Suspend media playback when destroying WebView on iO…
davidsharp Feb 13, 2024
cb9fb9c
fix(iOS): Replace UIKit with RCTUIKit on MacOS for RCT_NEW_ARCH_ENABL…
iSuslov Feb 13, 2024
8f21868
chore(release): 13.7.2 [skip ci]
semantic-release-bot Feb 13, 2024
8013944
feat(ios): ios injectJavaScriptObject (#3157)
gronxb Feb 13, 2024
4389014
chore(release): 13.8.0 [skip ci]
semantic-release-bot Feb 13, 2024
1c3d839
Fix NuGet package reference (#3242)
VMBindraban Feb 13, 2024
ae05226
chore(types): Indentation error (#3292)
dohooo Feb 13, 2024
0068588
fix(android): Fix WebViewManager can no longer be customized (#3315)
deka0106 Feb 13, 2024
4197bb4
chore(release): 13.8.1 [skip ci]
semantic-release-bot Feb 13, 2024
0dc2a0f
Merge tag 'v13.8.1' into sabadie/merge-upstream-3
sylvain-abadie Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
![Npm Downloads](https://img.shields.io/npm/dm/react-native-webview.svg)

**React Native WebView** is a community maintained WebView component for React Native. It is intended to be a replacement for the built-in WebView (which was [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
**React Native WebView** is a community-maintained WebView component for React Native. It is intended to be a replacement for the built-in WebView (which was [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).

### Maintainers

Expand All @@ -24,15 +24,15 @@ Shout-out to [Jamon Holmgren](https://github.com/jamonholmgren) from [Infinite R

### Disclaimer

Maintaining WebView is very complex, because it is often used for many different usecases (rendering svgs, pdfs, login flows, and much more). We also support many platforms and both architecture of react-native.
Maintaining WebView is very complex because it is often used for many different use cases (rendering SVGs, PDFs, login flows, and much more). We also support many platforms and both architectures of react-native.

Since WebView was extracted from React Native core, nearly 500 pull requests have been merged.
Since WebView was extracted from the React Native core, nearly 500 pull requests have been merged.
Considering that we have limited time, issues will mostly serve as a discussion place for the community, while **we will prioritize reviewing and merging pull requests.**

### Platform compatibility

This project is compatible with **iOS**, **Android**, **Windows** and **macOS**.
This project support both **the old** (paper) **and the new architecture** (fabric).
This project supports both **the old** (paper) **and the new architecture** (fabric).
This project is compatible with [expo](https://docs.expo.dev/versions/latest/sdk/webview/).

### Getting Started
Expand Down
3 changes: 2 additions & 1 deletion __tests__/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('Alert Tests', () => {
const showAlertButton = By2.nativeName('Show alert');
await showAlertButton.click();
await By2.nativeName('Hello! I am an alert box!');
// await By2.nativeName('OK').click(); All alerts will be automatically dismissed as Windows Webview does not have support for Alerts https://github.com/MicrosoftDocs/winrt-api/blob/docs/windows.ui.xaml.controls/webview.md#use-of-alert
const okButton = By2.nativeXpath('//Button[@Name="OK"]');
await okButton.click();
const dismissMessage = By2.nativeName('Alert dismissed!');
expect(dismissMessage).not.toBeNull();
await driver.quit();
Expand Down
35 changes: 25 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
if (major == 7 && minor >= 3) {
return true
}

return major >= 8
}

apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
Expand All @@ -44,6 +56,19 @@ if (isNewArchitectureEnabled()) {
apply plugin: 'kotlin-android'

android {
if (supportsNamespace()) {
namespace "com.reactnativecommunity.webview"
buildFeatures {
buildConfig true
}

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}

compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')

defaultConfig {
Expand Down Expand Up @@ -83,13 +108,3 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion')}"
implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion')}"
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "rncwebview"
codegenJavaPackageName = "com.reactnativecommunity.webview"
codegenDir = new File(codegenPath)
reactNativeDir = new File(reactNativePath)
}
}
13 changes: 13 additions & 0 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<provider
android:name=".RNCWebViewFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public boolean shouldOverrideUrlLoading (WebView subview, String url) {

((RNCWebView) view).dispatchEvent(
view,
new TopOpenWindowEvent(view.getId(), event)
new TopOpenWindowEvent(RNCWebViewWrapper.getReactTagFromWebView(view), event)
);

return true;
Expand Down Expand Up @@ -130,15 +130,15 @@ public void onProgressChanged(WebView webView, int newProgress) {
if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
return;
}
int reactTag = RNCWebViewWrapper.getReactTagFromWebView(webView);
WritableMap event = Arguments.createMap();
event.putDouble("target", webView.getId());
event.putDouble("target", reactTag);
event.putString("title", webView.getTitle());
event.putString("url", url);
event.putBoolean("canGoBack", webView.canGoBack());
event.putBoolean("canGoForward", webView.canGoForward());
event.putDouble("progress", (float) newProgress / 100);

int reactTag = webView.getId();
UIManagerHelper.getEventDispatcherForReactTag(this.mWebView.getThemedReactContext(), reactTag).dispatchEvent(new TopLoadingProgressEvent(reactTag, event));
}

Expand Down
Loading
Loading