Skip to content

Commit

Permalink
Merge branch 'master' into proj-davinci-dev
Browse files Browse the repository at this point in the history
* master: (186 commits)
  chore(release): 11.3.1 [skip ci]
  fix(windows): Check UAP contract version before calling FrameworkElement.IsLoaded (react-native-webview#1858)
  fix(android:) enable DRM protected content (react-native-webview#1862)
  chore(release): 11.3.0 [skip ci]
  feat(ios): Add support for `limitsNavigationsToAppBoundDomains` (react-native-webview#1662)
  chore(release): 11.2.6 [skip ci]
  fix(ios): Add missing nullability specifiers; fix if block warning (react-native-webview#1898)
  chore(release): 11.2.5 [skip ci]
  chore(docs): Clarify that navigationType and isTopFrame is iOS only (react-native-webview#1880)
  chore(docs): fixed "postMessage" url in Reference.md (react-native-webview#1913)
  fix(iOS): webview retain cycle (react-native-webview#1916)
  chore(release): 11.2.4 [skip ci]
  fix(iOS): Send cookies with resource requests (react-native-webview#1803)
  chore(release): 11.2.3 [skip ci]
  fix(android): Fix full=screen video when in modals (react-native-webview#1748 by @cristianoccazinsp)
  chore(release): 11.2.2 [skip ci]
  fix(windows): Resolve Deploy Issue (react-native-webview#1850)
  chore(ci): Upgrade react-native-windows to 0.62.17 (react-native-webview#1768)
  chore(release): 11.2.1 [skip ci]
  fix(ios): error on iOS < 13(react-native-webview#1843)
  ...

# Conflicts:
#	android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
#	apple/RNCWebView.h
#	apple/RNCWebView.m
#	docs/Reference.md
#	index.d.ts
#	yarn.lock
  • Loading branch information
uspython committed Mar 17, 2021
2 parents 5e1a99b + a529e9a commit b45505f
Show file tree
Hide file tree
Showing 195 changed files with 18,587 additions and 2,723 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
@@ -1,6 +1,6 @@
{
"projectName": "react-native-webview",
"projectOwner": "react-native-community",
"projectOwner": "react-native-webview",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -34,7 +34,7 @@ jobs:
- node_modules-{{ arch }}-{{ checksum "yarn.lock" }}

- run:
name: Run Tests
name: Lint checks
command: yarn ci

publish:
Expand Down
12 changes: 12 additions & 0 deletions .gitattributes
@@ -0,0 +1,12 @@
* text=auto

*.bat text eol=crlf
*.def text eol=crlf
*.filters text eol=crlf
*.idl text eol=crlf
*.props text eol=crlf
*.ps1 text eol=crlf
*.sln text eol=crlf
*.vcxproj text eol=crlf
*.xaml text eol=crlf

2 changes: 1 addition & 1 deletion .github/workflows/detox.yml
@@ -1,5 +1,5 @@
name: 'Detox CI Tests'
on: [push]
on: [pull_request]

jobs:
tests:
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/scripts/install-vs-features.ps1
@@ -0,0 +1,108 @@
param (
[Parameter(Mandatory=$true)]
[string[]] $Components,

[uri] $InstallerUri = "https://download.visualstudio.microsoft.com/download/pr/c4fef23e-cc45-4836-9544-70e213134bc8/1ee5717e9a1e05015756dff77eb27d554a79a6db91f2716d836df368381af9a1/vs_Enterprise.exe",

[string] $VsInstaller = "${env:System_DefaultWorkingDirectory}\vs_Enterprise.exe",

[string] $VsInstallOutputDir = "${env:System_DefaultWorkingDirectory}\vs",

[System.IO.FileInfo] $VsInstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise",

[System.IO.FileInfo] $VsInstallerPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer",

[switch] $Collect = $false,

[switch] $Cleanup = $false,

[switch] $UseWebInstaller = $false
)

$Components | ForEach-Object {
$componentList += '--add', $_
}

$LocalVsInstaller = "$VsInstallerPath\vs_installershell.exe"

$UseWebInstaller = $UseWebInstaller -or -not (Test-Path -Path "$LocalVsInstaller")

if ($UseWebInstaller) {
Write-Host "Downloading web installer..."

Invoke-WebRequest -Method Get `
-Uri $InstallerUri `
-OutFile $VsInstaller

New-Item -ItemType directory -Path $VsInstallOutputDir

Write-Host "Running web installer to download requested components..."

Start-Process `
-FilePath "$VsInstaller" `
-ArgumentList ( `
'--layout', "$VsInstallOutputDir",
'--wait',
'--norestart',
'--quiet' + `
$componentList
) `
-Wait `
-PassThru

Write-Host "Running downloaded VS installer to add requested components..."

Start-Process `
-FilePath "$VsInstallOutputDir\vs_Enterprise.exe" `
-ArgumentList (
'modify',
'--installPath', "`"$VsInstallPath`"" ,
'--wait',
'--norestart',
'--quiet' + `
$componentList
) `
-Wait `
-PassThru `
-OutVariable returnCode

if ($Cleanup) {
Write-Host "Cleaning up..."

Remove-Item -Path $VsInstaller
Remove-Item -Path $VsInstallOutputDir -Recurse
}

} else {
Write-Host "Running local installer to add requested components..."

Start-Process `
-FilePath "$LocalVsInstaller" `
-ArgumentList (
'modify',
'--installPath', "`"$VsInstallPath`"" ,
'--norestart',
'--quiet' + `
$componentList
) `
-Wait `
-OutVariable returnCode
}

if ($Collect) {
Invoke-WebRequest -Method Get `
-Uri 'https://download.microsoft.com/download/8/3/4/834E83F6-C377-4DCE-A757-69A418B6C6DF/Collect.exe' `
-OutFile ${env:System_DefaultWorkingDirectory}\Collect.exe

# Should generate ${env:Temp}\vslogs.zip
Start-Process `
-FilePath "${env:System_DefaultWorkingDirectory}\Collect.exe" `
-Wait `
-PassThru

New-Item -ItemType Directory -Force ${env:System_DefaultWorkingDirectory}\vslogs
Expand-Archive -Path ${env:TEMP}\vslogs.zip -DestinationPath ${env:System_DefaultWorkingDirectory}\vslogs\

Write-Host "VC versions after installation:"
Get-ChildItem -Name "$VsInstallPath\VC\Tools\MSVC\"
}
3 changes: 2 additions & 1 deletion .github/workflows/stale.yml
Expand Up @@ -7,10 +7,11 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
- uses: actions/stale@v3.0.14
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically'
stale-pr-message: 'Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically'
exempt-issue-label: 'Keep opened'
exempt-pr-label: 'Keep opened'
remove-stale-when-updated: true
59 changes: 59 additions & 0 deletions .github/workflows/windows-ci.yml
@@ -0,0 +1,59 @@
name: Windows CI
on: [pull_request]

jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
name: Checkout Code

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12.9.1'

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2

- name: Check node modules cache
uses: actions/cache@v1
id: yarn-cache
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node modules
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --pure-lockfile

- name: yarn build
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn build
yarn tsc
- name: Build x64 release
shell: powershell
run: npx react-native run-windows --root example --arch x64 --release --no-packager --no-deploy --logging

# Workaround for a bug in package searching during deploy.
# The deploy script only searches windows/{*/bin/x64/Release,Release/*}, but the build step above placed the pakcages at windows/x64/Release.
# Copy the packages to Windows/Release before deploying.
- name: Deploy
shell: powershell
run: |
cd example
Copy-Item -Path windows\x64\Release -Recurse -Destination windows\
npx react-native run-windows --arch x64 --release --no-build --no-packager
- name: Start Appium server
shell: powershell
run: Start-Process PowerShell -ArgumentList "yarn appium"

- name: Run tests
run: yarn test:windows
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -53,4 +53,9 @@ android/gradle
android/gradlew
android/gradlew.bat

lib/
lib/
.classpath
.project
.settings/
msbuild.binlog
example/msbuild.binlog
39 changes: 22 additions & 17 deletions README.md
@@ -1,10 +1,11 @@
# React Native WebView - a Modern, Cross-Platform WebView for React Native

[![star this repo](http://githubbadges.com/star.svg?user=react-native-community&repo=react-native-webview&style=flat)](https://github.com/react-native-community/react-native-webview)
[![star this repo](http://githubbadges.com/star.svg?user=react-native-webview&repo=react-native-webview&style=flat)](https://github.com/react-native-webview/react-native-webview)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)
[![Known Vulnerabilities](https://snyk.io/test/github/react-native-community/react-native-webview/badge.svg?style=flat-square)](https://snyk.io/test/github/react-native-community/react-native-webview)
<a href="https://www.npmjs.com/package/react-native-webview"><img src="https://img.shields.io/npm/v/react-native-webview.svg"></a>
[![Known Vulnerabilities](https://snyk.io/test/github/react-native-webview/react-native-webview/badge.svg?style=flat-square)](https://snyk.io/test/github/react-native-webview/react-native-webview)
[![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
[![Lean Core Extracted](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square)][lean-core-issue]

**React Native WebView** is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).

Expand All @@ -19,6 +20,8 @@ _This project is maintained for free by these people using both their free time

- [x] iOS
- [x] Android
- [x] macOS
- [x] Windows

_Note: Expo support for React Native WebView started with [Expo SDK v33.0.0](https://blog.expo.io/expo-sdk-v33-0-0-is-now-available-52d1c99dfe4c)._

Expand All @@ -34,18 +37,20 @@ This project follows [semantic versioning](https://semver.org/). We do not hesit

Current Version: ![version](https://img.shields.io/npm/v/react-native-webview.svg)

- [7.0.1](https://github.com/react-native-community/react-native-webview/releases/tag/v7.0.1) - Removed UIWebView

- [6.0.**2**](https://github.com/react-native-community/react-native-webview/releases/tag/v6.0.2) - Update to AndroidX. Make sure to enable it in your project's `android/gradle.properties`. See [Getting Started Guide](docs/Getting-Started.md).

- [5.0.**1**](https://github.com/react-native-community/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
- [4.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
- [3.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
- [2.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v2.0.0) - First release this is a replica of the core webview component
- [11.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v11.0.0) - Android setSupportMultipleWindows.
- [10.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v10.0.0) - Android Gradle plugin is only required when opening the project stand-alone
- [9.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v9.0.0) - props updates to injectedJavaScript are no longer immutable.
- [8.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v8.0.0) - onNavigationStateChange now triggers with hash url changes
- [7.0.1](https://github.com/react-native-webview/react-native-webview/releases/tag/v7.0.1) - Removed UIWebView
- [6.0.**2**](https://github.com/react-native-webview/react-native-webview/releases/tag/v6.0.2) - Update to AndroidX. Make sure to enable it in your project's `android/gradle.properties`. See [Getting Started Guide](docs/Getting-Started.md).
- [5.0.**1**](https://github.com/react-native-webview/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
- [4.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
- [3.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
- [2.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v2.0.0) - First release this is a replica of the core webview component

**Upcoming:**

- this.webView.postMessage() removal (never documented and less flexible than injectJavascript) -> [how to migrate](https://github.com/react-native-community/react-native-webview/issues/809)
- this.webView.postMessage() removal (never documented and less flexible than injectJavascript) -> [how to migrate](https://github.com/react-native-webview/react-native-webview/issues/809)
- Kotlin rewrite
- Maybe Swift rewrite

Expand All @@ -61,9 +66,7 @@ import { WebView } from 'react-native-webview';
// ...
class MyWebComponent extends Component {
render() {
return (
<WebView source={{ uri: 'https://facebook.github.io/react-native/' }} />
);
return <WebView source={{ uri: 'https://reactnative.dev/' }} />;
}
}
```
Expand All @@ -76,7 +79,7 @@ For more, read the [API Reference](./docs/Reference.md) and [Guide](./docs/Guide

## Contributing

See [Contributing.md](https://github.com/react-native-community/react-native-webview/blob/master/docs/Contributing.md)
See [Contributing.md](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Contributing.md)

## Contributors

Expand All @@ -94,8 +97,10 @@ This project follows the [all-contributors](https://github.com/all-contributors/

MIT

## Traduções
## Translations

This readme is available in:

- [Brazilian portuguese](docs/README.portuguese.md)

[lean-core-issue]: https://github.com/facebook/react-native/issues/23313
31 changes: 31 additions & 0 deletions __tests__/Alert.test.js
@@ -0,0 +1,31 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

import { driver, By2 } from 'selenium-appium'
import { until } from 'selenium-webdriver';

const setup = require('../jest-setups/jest.setup');
jest.setTimeout(50000);

beforeAll(() => {
return driver.startWithCapabilities(setup.capabilites);
});

afterAll(() => {
return driver.quit();
});

describe('Alert Tests', () => {

test('Show Alert', async () => {
const showAlertButton = await driver.wait(until.elementLocated(By2.nativeName('Show alert')));
await showAlertButton.click();
await driver.wait(until.elementLocated(By2.nativeName('Hello! I am an alert box!')));
await By2.nativeName('OK').click();
const dismissMessage = await driver.wait(until.elementLocated(By2.nativeName('Alert dismissed!')));
expect(dismissMessage).not.toBeNull();
});

});

0 comments on commit b45505f

Please sign in to comment.