feat: bump nitro codegen to nitrogen 0.35.2 and upstream auto-size-input event sync - #83
Conversation
Upstreams the change app-monorepo has carried as a patch-package patch on @onekeyfe/react-native-auto-size-input 3.0.78: expose mostRecentEventCount on the AutoSizeInput hybrid view and count text-update events natively (TextUpdateEventCounter) so the JS side can drop stale controlled-input updates. Ships the Android implementation with unit tests and the iOS counterpart.
The Onramper headless SDK requires react-native-nitro-modules >= 0.35 in the consuming app, and nitro codegen is not compatible across that boundary: 0.35 moved the Kotlin JNI binding into a nested CxxPart and packages generated with older nitrogen fail to compile against the 0.35 runtime. Bumps nitrogen and react-native-nitro-modules (dev + peer) to 0.35.2 across all nitro packages, the example app, and the create-module/view templates, so the next release ships 0.35-compatible codegen. nitrogen >= 0.35 also emits the Android view manager as a final class; chart-webview needs it open so TeardownChartWebviewManager can subclass it to dispose the non-pooled WebView on drop. A post-nitrogen script now reapplies the open modifier on every codegen pass. Verified: regenerated output for all 20 nitro packages matches the patch-package patches app-monorepo has been building and running on-device (commit a71d5c1fff there), byte-identical except range-downloader (newer sources here) and the chart-webview open modifier.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…nts on iOS Addresses review on the mostRecentEventCount protocol: - Android: participation is now opt-in. TextUpdateEventCounter keeps mostRecentEventCount nullable; callers that never supply the count bypass stale-update filtering entirely, so programmatic clears/sanitization/form restores keep applying after native edits. Regression covered by unit tests. - iOS: both delegate change callbacks (editingChanged / textViewDidChange, user edits only) now bump a native event count, and the text setter rejects stale controlled updates for participating callers, realigning the stored prop with the displayed text; uncounted callers keep full control, matching Android.
|
Both handled:
Reminder for the release: these packages require |
When JS sanitizes an edit back to the same string, React re-sends only mostRecentEventCount (unchanged props are not re-sent), so the rejected characters used to stay displayed. Both platforms now cache the last requested JS text — even when the update is rejected as stale — and the count setter reapplies it once the acknowledgement catches up. TextUpdateEventCounter.acknowledge() owns the transition and is unit-tested (10/10 via testDebugUnitTest).
- Bump the example's react-native-mmkv to 4.2.0: 4.1.x ships pre-0.35 codegen and fails Android Kotlin compilation against the 0.35 runtime (same reason the app upgraded). - Refresh the iOS Podfile.lock: mmkv 4.2.0 moves MMKVCore to 2.3.0, which also satisfies bundle-update's MMKV ~> 2.2. - Adopt the mostRecentEventCount protocol on the controlled AutoSizeInput examples, mirroring the app's wrapper. Verified on the emulator: rapid input (adb input text) previously lost characters to the inherent uncounted controlled-echo race; with the counter every character is retained. The remaining uncontrolled examples still cover the no-counter path.
|
Example app verified on both platforms against this branch (per huanming's request), commit a86ead1: Android (emulator, Medium_Phone_API_36.0): iOS (iPhone Air simulator, iOS 26.0.1): Fixes needed to get there (included in a86ead1):
Setup note for anyone building the example from a fresh clone: run the workspace |
JS supplies mostRecentEventCount as a Double. On iOS, Int(_:) traps on NaN/infinity/out-of-range and would kill the process while applying a text update; validate via Int(exactly:) and fall back to uncounted. On Android, Double.toInt() coerces NaN to 0, which would silently opt the caller into filtering with a zero acknowledgement; filter non-finite values to null for the same uncounted fallback.
A fractional or finite out-of-range Double diverged: Android truncated or clamped (1.6 -> 1, stale) while iOS rounded (1.6 -> 2, current), so the same prop value could reject controlled text on one platform and apply it on the other. Valid acknowledgements are now exact, non-negative values in the Android Int range on both platforms — everything else degrades to uncounted. The rule lives in TextUpdateEventCounter.sanitizeAcknowledgement with unit coverage.
Summary
nitrogenandreact-native-nitro-modulesfrom 0.31.10 / 0.33.2 to 0.35.2 across all 20 nitro packages, the example app, and the create-module/view templates, so the next release ships 0.35-compatible codegen.react-native-chart-webviewthat marks the generated Android view manageropen(nitrogen ≥ 0.35 emits it final;TeardownChartWebviewManagermust subclass it to dispose the non-pooled WebView on drop).mostRecentEventCounttext-update sync that app-monorepo has been carrying as a patch-package patch on@onekeyfe/react-native-auto-size-input3.0.78 (Android impl + unit tests, iOS counterpart,.nitro.tsspec).Why
The Onramper headless SDK (app-monorepo PR OneKeyHQ/app-monorepo#12875) hard-requires
react-native-nitro-modules≥ 0.35 in the consuming app, and nitro codegen is not compatible across that boundary: 0.35 moved the Kotlin JNI binding into a nestedCxxPart, so packages generated with older nitrogen fail to compile on Android against the 0.35 runtime. app-monorepo currently works around this with 21 patch-package patches that regenerate codegen insidenode_modules(commita71d5c1fffthere). Landing the upgrade here and releasing lets the app delete all of those patches, per huanming's suggestion (Slack, 2026-08-14).Verification
nitrogenruns clean for all 20 nitro packages;typecheckpasses for every workspace.bundleGoogleRelease+ iOS Release builds): 18/20 packages byte-identical;chart-webviewdiffers only by the explanatory comment next to theopenmodifier;range-downloaderdiffers only where its sources moved past 3.0.78 (firmware-archive additions).TextUpdateEventCounterTest) is included; the same implementation has been shipping inside the app via the patch.Release coordination
Codegen incompatibility is bidirectional: packages released from this branch require
react-native-nitro-modules≥ 0.35 in the app. app-monorepoxis still on 0.33.2, so the new versions must land there together with the nitro bump (PR #12875) — please coordinate the npm release (3.0.82ornexttag first) soxdoesn't pick it up standalone.