Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true},
{ ignoreRestSiblings: true, argsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-definitions': [
'error',
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,31 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v7
with:
node-version: 16
node-version: 22
- name: Set up JDK
uses: actions/setup-java@v2.5.0
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 11
# setup-gradle validates every Gradle wrapper JAR in the workspace. Running it
# before node_modules exists keeps it to our own wrapper, since some packages
# ship wrapper JARs that aren't on Gradle's list of known checksums.
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Cache /node_modules
uses: actions/cache@v2
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
shell: bash
- name: Build Android test app
uses: gradle/gradle-build-action@v2.1.3
with:
gradle-version: wrapper
arguments: --no-daemon clean build check test
build-root-directory: example/android
run: ./gradlew --no-daemon clean build check test
shell: bash
working-directory: example/android
timeout-minutes: 60
8 changes: 4 additions & 4 deletions .github/workflows/detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on: [pull_request]
jobs:
tests:
name: 'Running tests'
runs-on: 'macOS-latest'
runs-on: macos-15
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 14
node-version: 22
- name: Setup - Install Yarn
run: YARN_GPG=NO curl -o- -L https://yarnpkg.com/install.sh | bash
- name: Setup - Install NPM Dependencies
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,40 @@ on:
pull_request:
jobs:
build:
runs-on: macos-latest
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v7
with:
node-version: 16
node-version: 22
- name: Cache /node_modules
uses: actions/cache@v2
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Boost moved its release archives off JFrog, so the old URL in this podspec
# no longer serves the tarball and pod install fails the checksum check.
- name: Point boost podspec at archives.boost.io
run: sed -i '' 's#https://boostorg.jfrog.io/artifactory/main/release/#https://archives.boost.io/release/#' node_modules/react-native/third-party-podspecs/boost.podspec
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Newer Xcode warns about bitwise | on booleans, and Yoga's podspec builds with
# -Werror, so two hadOverflow() lines in RN 0.68's Yoga break the build.
- name: Fix Yoga bitwise-or for current Xcode
run: sed -i '' 's/getLayout().hadOverflow() |$/getLayout().hadOverflow() ||/' node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp
- name: Install Pods
run: pod install
working-directory: example/ios
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Boost 1.76 uses std::unary_function, which Xcode 16's libc++ drops in C++17
# mode. This define brings it back for every target, and $(inherited) keeps
# each target's own preprocessor definitions.
- name: Build iOS test app
run: |
device_name='iPhone 13'
device=$(xcrun simctl list devices "${device_name}" available | grep "${device_name} (")
re='\(([-0-9A-Fa-f]+)\)'
[[ $device =~ $re ]] || exit 1
xcodebuild -workspace WebviewExample.xcworkspace -scheme ReactTestApp -destination "platform=iOS Simulator,id=${BASH_REMATCH[1]}" CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO build
xcodebuild -workspace WebviewExample.xcworkspace -scheme ReactTestApp -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO GCC_PREPROCESSOR_DEFINITIONS='$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION' build
working-directory: example/ios
timeout-minutes: 60
34 changes: 24 additions & 10 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
name: macOS
# Discord doesn't ship this fork on macOS, and several webViewKey code paths use UIKit-only APIs
# with no macOS branch, so this build doesn't compile. It only runs when triggered by hand from
# the Actions tab until someone takes on macOS support.
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v7
with:
node-version: 16
node-version: 22
- name: Cache /node_modules
uses: actions/cache@v2
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Boost moved its release archives off JFrog, so the old URL in this podspec
# no longer serves the tarball and pod install fails the checksum check.
- name: Point boost podspec at archives.boost.io
run: sed -i '' 's#https://boostorg.jfrog.io/artifactory/main/release/#https://archives.boost.io/release/#' node_modules/react-native-macos/third-party-podspecs/boost.podspec
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Newer Xcode warns about bitwise | on booleans, and Yoga's podspec builds with
# -Werror, so two hadOverflow() lines in RN 0.68's Yoga break the build.
- name: Fix Yoga bitwise-or for current Xcode
run: sed -i '' 's/getLayout().hadOverflow() |$/getLayout().hadOverflow() ||/' node_modules/react-native-macos/ReactCommon/yoga/yoga/Yoga.cpp
- name: Install Pods
run: pod install
working-directory: example/macos
# TODO(rn-upgrade): Remove once the example app is on RN 0.86, which already fixes this.
# Boost 1.76 uses std::unary_function, which Xcode 16's libc++ drops in C++17
# mode. This define brings it back for every target, and $(inherited) keeps
# each target's own preprocessor definitions.
- name: Build macOS test app
run: |
xcodebuild -workspace WebviewExample.xcworkspace -scheme ReactTestApp CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO build
xcodebuild -workspace WebviewExample.xcworkspace -scheme ReactTestApp CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO GCC_PREPROCESSOR_DEFINITIONS='$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION' build
working-directory: example/macos
timeout-minutes: 60
6 changes: 3 additions & 3 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3.0.14
- uses: actions/stale@v11
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'
exempt-issue-labels: 'Keep opened'
exempt-pr-labels: 'Keep opened'
remove-stale-when-updated: true
18 changes: 12 additions & 6 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ on: [pull_request]
jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019
# TODO(rn-upgrade): windows-2022 has the Windows SDK 10.0.19041.0 that react-native-windows
# 0.68 targets. Revisit once react-native-windows is upgraded.
runs-on: windows-2022

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

# TODO(rn-upgrade): Remove once react-native-windows is upgraded.
# The react-native-windows 0.68 CLI spawns .cmd files without a shell, which Node
# rejects with EINVAL starting in 20.12.2 (CVE-2024-27980). 20.12.1 is the newest
# release that still allows it.
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v7
with:
node-version: '^14'
node-version: 20.12.1

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

- name: Check node modules cache
uses: actions/cache@v1
uses: actions/cache@v6
id: yarn-cache
with:
path: ./node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ public void setWebViewKey(RNCWebViewContainer view, String webViewKey) {
webView.setWebViewKey(webViewKey);
RNCWebViewMapManager.INSTANCE.getViewIdMap().put(webView.getId(), view.getId());
rncWebViewMap.put(webViewKey, webView);
// Let any RNCWebViewTargetView waiting on this key borrow the view now that it's registered. Deferred to the
// next frame so the builder finishes attaching it before a target reparents it away.
view.post(() -> RNCWebViewMapManager.INSTANCE.notifyWebViewRegistered(webViewKey));
});
}

Expand Down Expand Up @@ -2073,7 +2076,11 @@ protected void dispatchEvent(WebView webView, Event event) {
return;
}

uiManager.getEventDispatcher().dispatchEvent(event);
// TODO(rn-upgrade): Once the example app is on RN 0.86, this can be chained again.
// Older React Native declares getEventDispatcher() as a generic <T> T, so we
// assign it to a typed local to give Java something to infer T from.
EventDispatcher eventDispatcher = uiManager.getEventDispatcher();
eventDispatcher.dispatchEvent(event);
}

protected void cleanupCallbacksAndDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,23 @@ object RNCWebViewMapManager {
// This map facilitates finding the viewId of the wrapper RNCWebView from the WebView
// view Id.
val viewIdMap = mutableMapOf<Integer, Integer>();

// Listeners notified (with the webViewKey) when a WebView is registered, so a RNCWebViewTargetView already
// waiting on that key can borrow it as soon as it exists rather than racing the builder that creates it.
private val registrationListeners = mutableListOf<(String) -> Unit>()

fun addRegistrationListener(listener: (String) -> Unit) {
registrationListeners.add(listener)
}

fun removeRegistrationListener(listener: (String) -> Unit) {
registrationListeners.remove(listener)
}

fun notifyWebViewRegistered(webViewKey: String) {
// Copy first: a listener may borrow synchronously and mutate the list.
for (listener in registrationListeners.toList()) {
listener(webViewKey)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class RNCWebViewPackage: ReactPackage {
)

override fun createViewManagers(reactContext: ReactApplicationContext) = listOf(
RNCWebViewManager()
RNCWebViewManager(),
RNCWebViewTargetManager()
)
}
Loading
Loading