Repository navigation
chore: widen expo peer range to >=51 - #3
Open
EliottGand wants to merge 3 commits into
Open
EliottGand wants to merge 3 commits into
EliottGand wants to merge 3 commits into
Conversation
The peerDependency was pinned to `expo: "^51.0.9"`, which is now several SDKs
behind. Installing `@bam.tech/react-native-keyevent-expo-config-plugin@1.0.52`
into an Expo SDK 57 app fails outright with npm:
npm error Could not resolve dependency:
npm error peer expo@"^51.0.9" from @bam.tech/react-native-keyevent-expo-config-plugin@1.0.52
Widening to `>=51` unblocks that install. No source change: the plugin's own
`@expo/config-plugins` dependency and the APIs it uses are untouched.
Verified:
- `withAppDelegate`, `withMainActivity` and `mergeContents`
(`@expo/config-plugins/build/utils/generateCode`) still exist with identical
signatures in @expo/config-plugins 9.1.7, 11.0.7 and 57.0.9.
- `yarn build` (expo-module build) passes and produces no change to `build/`.
- Fresh SDK 57 `create-expo-app` project with the plugin installed from this
working tree: `npx expo prebuild --clean --platform android` succeeds and both
generated blocks land in `MainActivity.kt`.
- `npx expo prebuild --clean --platform ios` on the same project FAILS. From SDK
53 the Expo template ships `AppDelegate.swift`, so the plugin's ObjC anchors
(`#import "AppDelegate.h"`, `@implementation AppDelegate`) no longer match and
`mergeContents` throws ERR_NO_MATCH. That is pre-existing and not introduced
here; the README now documents it instead of leaving it implied by the peer
range.
`yarn lint` and `yarn test` are already broken on main (eslint 10 vs the
`.eslintrc.js` flat-config migration, and a missing `jest` for jest-expo); both
fail identically before and after this change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Runs the plugin's iOS and Android mods against the AppDelegate / MainActivity sources shipped by expo-template-bare-minimum for SDK 51, 52, 53, 54 and 57. - Android Kotlin succeeds on every SDK tested and contains both generated blocks - iOS Objective-C++ (SDK 51/52) succeeds - iOS Swift (SDK 53+) fails with ERR_NO_MATCH, asserted on purpose so the known breakage cannot regress silently in either direction The tests run on Node's built-in test runner via `yarn test:plugin`, independent of `yarn lint` / `yarn test`, which are red on main for unrelated toolchain reasons. Adds a CI workflow running those tests plus an `expo prebuild --platform android` smoke check against a freshly created app on the current SDK. Also records in the README what is now verified on a real Android emulator: volume, character, enter and back presses all reach JS via react-native-keyevent on Expo SDK 57 / RN 0.86.3. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`node --test "test/*.test.js"` only expands the glob on Node 21+, so CI on Node 20 failed with "Could not find .../test/*.test.js". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
package.json—peerDependencies.expo:"^51.0.9"→">=51". Plus a newtest:pluginscript.README.md— a "Supported Expo SDK versions" section stating what actually works per platform per SDK, now including what has been verified at runtime on a device, and a short Development/Tests section.test/(new) — the repo's first tests. They run the plugin's iOS and Android mods against the realAppDelegate/MainActivitysources shipped byexpo-template-bare-minimumfor SDK 51, 52, 53, 54 and 57 (checked in undertest/fixtures/)..github/workflows/ci.yml(new) — the repo's first CI: runs those tests, and anexpo prebuild --platform androidsmoke check against a freshly created app on the current SDK.No source change to the plugin. The package version is not bumped: the release is left to the maintainer.
Why
The pin is several SDKs behind, and it is a hard install failure, not a warning. Reproduced against the published package in a fresh Expo SDK 57 app:
PROVEN ON DEVICE: Android key events actually reach JS on SDK 57
This is the part that a passing
expo prebuilddoes not establish, so it was done for real.A fresh Expo SDK 57 app (
expo@57.0.24,react-native@0.86.3) withreact-native-keyevent@0.3.2and this plugin installed from a local path, prebuilt for Android, then fully built and installed withnpx expo run:android(BUILD SUCCESSFUL in 1m 25s) on the Android emulatorMedium_Phone_API_36.1(API 36, arm64). The app screen renders the last key code, a running event count, and a scrolling event log, wired toKeyEvent.onKeyDownListener/onKeyUpListenerwith the documented cleanup.Hardware keys were then injected into the running app and the on-screen state was read back from the accessibility tree after each press:
keyCodein JSpressedKey24lastKeyCode 24,eventCount 225lastKeyCode 25,eventCount 4, log of 4a29alastKeyCode 29,eventCount 6, log of 64lastKeyCode 4,eventCount 2(fresh launch)66z54zlastKeyCode 54,eventCount 6, log of 6So on Expo SDK 57 / RN 0.86.3 with the new architecture enabled, the
MainActivity.ktoverrides the plugin generates are wired correctly and volume keys, character keys, Enter and Back all reach JS as bothonKeyDownandonKeyUp.One behavioural note worth knowing: the generated
onKeyDown/onKeyUpcallsuperbefore returningtrue, so a Back press still finishes the activity. Observing Back on screen required the test app to handlehardwareBackPressitself; without that the event does reach JS but the activity is gone before you can see it.Automated regression coverage (new)
yarn test:plugin— 17 tests, all passing locally, on Node's built-in test runner:MainActivitygets both generated blocks, the imports and all three overrides, placed inside the class body; the merge is idempotent.assert.rejectswithcode === 'ERR_NO_MATCH'. The test asserts the breakage on purpose — it exists so the gap cannot be forgotten, and it should be rewritten if and when the iOS mod is ported to Swift.CI (run 35621289060, conclusion
success): both jobs green on this branch.Plugin mod tests(yarn build+yarn test:plugin)expo prebuild --platform android (current SDK)expo@~57.0.24from a freshcreate-expo-app, asserting both generated blocks land inMainActivity.ktOn the repo's existing scripts:
yarn lintandyarn testare red onmainfor unrelated toolchain reasons (eslint 10 refuses.eslintrc.js;jest-expocannot resolvejest/package.json). I did not fix them. The new tests are deliberately independent of both, run under their owntest:pluginscript, and CI runs onlyyarn build+yarn test:plugin. Fixing the eslint/jest toolchain is a separate change.The iOS problem (pre-existing, not introduced here, not fixed here)
expo-template-bare-minimumshipsAppDelegate.mm+AppDelegate.hon SDK 51/52 andAppDelegate.swiftfrom SDK 53 onwards. The plugin's two iOS mods anchor on#import "AppDelegate.h"and@implementation AppDelegate;mergeContentsthrows rather than no-opping, so it is a hard prebuild failure. Already true onmain; the pin just made SDK 53+ users hit an install error first.I have not attempted the Swift port: that is a behavioural change and belongs in its own PR with the maintainer's call on how to express
keyCommands/keyInput:inAppDelegate.swift.What is still NOT proven
MainActivity. The plugin emits Kotlin only; a hand-writtenMainActivity.javawould get Kotlin spliced into it. Untested, now stated in the README.onKeyMultiple. The override is generated and compiles, but no multiple-key event was produced on device.What a reviewer should still decide
>=51is the range you want. It is fully open at the top, so it will never warn on a future SDK either, including ones that break the plugin.>=51 <58is the alternative.@expo/config-plugins: ~8.0.0should be relaxed or moved to a peer dependency. Left alone deliberately; bundling a v8 copy next to an app's v57 is a latent hazard worth its own look.🤖 Generated with Claude Code