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

feat: New arch #2686

Merged
merged 83 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
59ed58b
wip-android
Titozzz Aug 11, 2022
75683a5
build fixes for `new-arch` (#2642)
tido64 Aug 17, 2022
c6d9fe4
wip
Titozzz Aug 17, 2022
a964746
Update build.gradle
Titozzz Aug 17, 2022
c1e31a3
wip
Titozzz Aug 25, 2022
2908c6e
Update android-ci.yml
Titozzz Aug 25, 2022
0942512
Update gradle.properties
Titozzz Aug 25, 2022
c46eb2a
wip
Titozzz Aug 25, 2022
714fb15
wip
Titozzz Aug 26, 2022
217ad6c
wip
Titozzz Aug 26, 2022
f3b27ec
wip
Titozzz Aug 26, 2022
0771eba
wip
Titozzz Aug 29, 2022
b15b5d4
wip
Titozzz Aug 29, 2022
1f2584c
Update RNCWebView.mm
Titozzz Aug 29, 2022
b4e831d
wip
Titozzz Aug 31, 2022
8bbcb9d
fixes
Titozzz Aug 31, 2022
9ba6b39
Update RNCWebView.mm
Titozzz Aug 31, 2022
516175d
Update RNCWebViewImpl.m
Titozzz Aug 31, 2022
1216f19
wip
Titozzz Sep 2, 2022
f7beac4
wip
Titozzz Sep 2, 2022
e221937
Actually use Enums + fix android
Titozzz Sep 6, 2022
2d00ec4
Finally found a syntax for menuItems
Titozzz Sep 6, 2022
c68985b
fix dataDetector types
Titozzz Sep 6, 2022
6b503d1
fix: menuItem + onCustomMenuSelection
Titozzz Sep 7, 2022
8739d5a
wip
Titozzz Sep 27, 2022
e167f84
Merge branch 'master' into new-arch-ios
Titozzz Sep 27, 2022
e0627fe
wip
Titozzz Oct 18, 2022
28665e9
update react-native & fix lint
Titozzz Nov 4, 2022
f82b477
port c14dcc2617429ca53b91de18eac07ed7b119c239
Titozzz Dec 4, 2022
f1d59cc
chore(docs): Add information that custom menu items are only availabl…
Handschrift Nov 23, 2022
a15c071
port 4ac0d746c9420191e4eb7387dadd35a674950f34
Titozzz Dec 4, 2022
4cc9724
port 2711f3a5dc04ba0cdece2fdc3d3473469ad79d55
Titozzz Dec 30, 2022
2ab07a4
port 47c05b0fba21fde471ca6c3aacf7b75756b6a52e
Titozzz Dec 30, 2022
e3dcdd9
port 4c050771757f4f7d92cf816bf0a5bf16c5539c07
Titozzz Dec 30, 2022
b92017b
port 9b7ce574fcc53c635b532bd8c02e8d8e9cf80a08
Titozzz Dec 30, 2022
7a85c56
bump to 0.71
Titozzz Jan 5, 2023
34b5835
wip
Titozzz Jan 5, 2023
5c274a5
Merge branch 'master' into new-arch-ios
Titozzz Jan 5, 2023
4b9d5e1
Update package.json
Titozzz Jan 5, 2023
f2601ee
wip
Titozzz Jan 9, 2023
71428ee
port f74ee7a88adf6d645f2ef80da6657b68f5d6959d
Titozzz Jan 16, 2023
ede1350
chore(docs): Add info/warning about injectedJavaScriptBeforeContentLo…
TheAlmightyBob Jan 16, 2023
9abfc03
bump react-native to 0.71
Titozzz Jan 17, 2023
4412883
bump react-native & react-native windows
Titozzz Jan 26, 2023
8a2e651
Merge branch 'master' into new-arch-ios
Titozzz Jan 26, 2023
da24567
Update config.yml
Titozzz Jan 26, 2023
db73a76
bump windows setup ms
Titozzz Jan 26, 2023
2bba75f
Update windows-ci.yml
Titozzz Jan 26, 2023
f6352a4
Update windows-ci.yml
Titozzz Jan 26, 2023
76f6e51
Update windows-ci.yml
Titozzz Jan 26, 2023
200b942
Update windows-ci.yml
Titozzz Jan 26, 2023
46c77df
Update windows-ci.yml
Titozzz Jan 26, 2023
4fe6bdc
Update windows-ci.yml
Titozzz Jan 26, 2023
23b844b
New Arch: macOS build fixes (#2829)
tido64 Jan 27, 2023
09df909
Implement methods on iOS
Titozzz Jan 29, 2023
07db3b7
fix macOS
Titozzz Jan 30, 2023
7ab1f53
Update
Titozzz Jan 30, 2023
3bbbfc4
fix test on android
Titozzz Jan 30, 2023
6cb9fb7
Merge branch 'master' into new-arch-ios
Titozzz Jan 30, 2023
277d321
Bump jest in hope of fixing windows
Titozzz Jan 30, 2023
14d77cf
Update WebViewShared-test.js.snap
Titozzz Jan 30, 2023
097aba2
android refactor
Titozzz Jan 30, 2023
27357a7
fix new arch command && fix android Context
Titozzz Mar 6, 2023
d2d9ec1
Update package.json
Titozzz Mar 6, 2023
58dcc7a
Update yarn.lock
Titozzz Mar 6, 2023
34e09b2
Update Podfile.lock
Titozzz Mar 6, 2023
cb71831
bump version
Titozzz Mar 6, 2023
4fc07fc
Update RNCWebViewManagerImpl.kt
Titozzz Mar 10, 2023
b80203c
expose manager
Titozzz Mar 10, 2023
571494a
Remove dead prop that wasn't used on native side
Titozzz Mar 12, 2023
9168a69
refactor(android): removed deprecated code
Titozzz Mar 12, 2023
eb27379
delete old iOS files
Titozzz Mar 12, 2023
dbc1221
Remove url / html from docs that were not even implemented anymore
Titozzz Mar 12, 2023
b2c8044
Delete setup
Titozzz Mar 13, 2023
0006454
Update RNCWebViewClient.java
Titozzz Mar 13, 2023
c702889
add fix from @zootek
Titozzz Mar 13, 2023
8ce45c9
fix iOS header
Titozzz Mar 19, 2023
1ecc5f5
Update Contributing doc (#2900)
TheAlmightyBob Mar 29, 2023
d9a50a6
Allow passing a custom RNCWebView subclass to RNCWebViewManager's cre…
TheAlmightyBob Apr 1, 2023
6a41330
chore: update readme (#2898)
Titozzz Apr 1, 2023
5519641
Merge branch 'master' into new-arch-ios
Titozzz Apr 1, 2023
1135ee0
Update package.json
Titozzz Apr 1, 2023
644eb05
Merge branch 'new-arch-ios' of https://github.com/react-native-webvie…
Titozzz Apr 1, 2023
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: ~/code
docker:
- image: cimg/node:14.17.6-browsers
- image: cimg/node:18.13.0-browsers

version: 2
jobs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
- name: Install macos dependencies
run: yarn add:macos
- name: Install Pods
run: pod install
working-directory: example/macos
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@ on: [pull_request]
jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019
runs-on: windows-2022

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

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '^14'
cache: 'yarn'

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

- name: Check node modules cache
uses: actions/cache@v1
id: yarn-cache
uses: microsoft/setup-msbuild@v1.1.3
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
vs-version: '[17.0,)'
msbuild-architecture: x64

- 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
Expand Down
98 changes: 35 additions & 63 deletions README.md

Large diffs are not rendered by default.

178 changes: 66 additions & 112 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,137 +1,91 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
}
import java.nio.file.Paths

// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
mavenCentral()
google()
}

dependencies {
classpath("com.android.tools.build:gradle:3.6.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
buildscript {
ext.safeExtGet = {prop ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['ReactNativeWebView_' + prop]
}
} else {
repositories {
mavenCentral()
google()
gradlePluginPortal()
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}")
classpath("com.android.tools.build:gradle:7.0.4")
}
}
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeWebView_' + name]).toInteger()
def getExtOrIntegerDefault(prop) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : (project.properties['ReactNativeWebView_' + prop]).toInteger()
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
static def findNodeModulePath(baseDir, packageName) {
def basePath = baseDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
}
basePath = basePath.getParent()
}
}
lintOptions {
disable 'GradleCompatible'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
return null
}

repositories {
mavenCentral()
google()

def found = false
def defaultDir = null
def androidSourcesName = 'React Native sources'

if (rootProject.ext.has('reactNativeAndroidRoot')) {
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
} else {
defaultDir = new File(
projectDir,
'/../../../node_modules/react-native/android'
)
}

if (defaultDir.exists()) {
maven {
url defaultDir.toString()
name androidSourcesName
}

logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
found = true
} else {
def parentDir = rootProject.projectDir
def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

1.upto(5, {
if (found) return true
parentDir = parentDir.parentFile

def androidSourcesDir = new File(
parentDir,
'node_modules/react-native'
)
apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
apply plugin: 'com.facebook.react'
}
apply plugin: 'kotlin-android'

def androidPrebuiltBinaryDir = new File(
parentDir,
'node_modules/react-native/android'
)
android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')

if (androidPrebuiltBinaryDir.exists()) {
maven {
url androidPrebuiltBinaryDir.toString()
name androidSourcesName
}
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
found = true
} else if (androidSourcesDir.exists()) {
maven {
url androidSourcesDir.toString()
name androidSourcesName
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch']
} else {
java.srcDirs += ['src/oldarch']
}
}
}
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
found = true
}
})
}
def reactNativePath = findNodeModulePath(projectDir, "react-native")
def codegenPath = findNodeModulePath(projectDir, "react-native-codegen")

if (!found) {
throw new GradleException(
"${project.name}: unable to locate React Native android sources. " +
"Ensure you have you installed React Native as a dependency in your project and try again."
)
}
repositories {
maven {
url "${reactNativePath}/android"
}
mavenCentral()
google()
}

def kotlin_version = getExtOrDefault('kotlinVersion')
def webkit_version = getExtOrDefault('webkitVersion')

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.webkit:webkit:$webkit_version"
implementation 'com.facebook.react:react-native:+'
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)
}
}
5 changes: 2 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ReactNativeWebView_kotlinVersion=1.6.0
ReactNativeWebView_webkitVersion=1.4.0
ReactNativeWebView_compileSdkVersion=29
ReactNativeWebView_buildToolsVersion=29.0.3
ReactNativeWebView_targetSdkVersion=28
ReactNativeWebView_compileSdkVersion=31
ReactNativeWebView_targetSdkVersion=31
ReactNativeWebView_minSdkVersion=21
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.reactnativecommunity.webview;

class RNCBasicAuthCredential {
String username;
String password;

RNCBasicAuthCredential(String username, String password) {
this.username = username;
this.password = password;
}
}
Loading