GeezerVison is showing github.com — Upgrade to react-native 0.86, generic events/elements, typed refs by Freddy03h · Pull Request #858 · rescript-react-native/rescript-react-native
Conversation
Upgrade the bindings to [email protected], plus a pass on events, elements and refs. Bindings were checked against the generated types of [email protected]. One commit per topic, each commit builds on its own.
React Native 0.86
- Breaking:
BackHandler.addEventListener handler receives a hardwareBackPressEvent (type_, timeStamp) instead of unit
Style.blendMode: add #"plus-lighter"
Pressable.rippleConfig: add alpha; TouchableNativeFeedback.Background.ripple takes a Color.t (accepts PlatformColor)
TextInput.autoComplete: new Android autofill hints, plus values that were already missing (current-password, new-password, given-name, …)
peerDependencies: react-native >= 0.86.0
- No new deprecation affects the bindings (
ViewUtil.getUIManagerType is native Android, setComponentProviderInstrumentationHook isn't bound)
Fixes
- Breaking: synthetic events
target and currentTarget are native elements (DOMAPI.anyElement), not numbers. The renderer sets them to the element's public instance since the new architecture (the only one since RN 0.82), and the web-based event dispatching of RN 0.88 keeps them as elements.
- Breaking:
getBoundingClientRect returns a Layout.domRect (x, y, width, height, top, right, bottom, left), it was typed as Rect.t
- Add
Rect.size to pass a number to hitSlop / pressRetentionOffset
Events
- Generic
Event.syntheticEvent<'payload> / Event.responderSyntheticEvent<'payload> records with Event.Methods / Event.ResponderMethods
Event.SyntheticEvent / Event.ResponderSyntheticEvent functors stay the public API to define an event module, now built on these records: events of third-party bindings share the same type and get new methods for free
- Breaking:
bubbles, cancelable, defaultPrevented, eventPhase, isTrusted and type are option<…> (undefined while the handler runs, never null; event pooling errors stay explicit, see Event.layoutEvent needs to be Js.Nullable.t #832)
- Breaking: the
nativeEvent getter returns the payload type instead of 'a
Elements and refs
- Element methods are generic externals on
DOMAPI.element<'nativeElement>. Component-specific methods are restricted by the element kind ([> #scrollView], [> #textInput], …): FlatList gets the ScrollView methods, TextInput doesn't. No more *Methods.Make functor applied at runtime.
NativeElement.Impl stays the public API to define an element module, now based on NativeElement.Methods
DOMAPI.Node.Impl takes a type constructor so node methods are written once; DOMAPI.Element accepts any element
- Typed
useRef in every element module: let ref = TextInput.useRef(), compiled to React.useRef(null)
Ref.t is the object ref type: pass it directly (ref=myRef), and the generated JS no longer wraps it in Primitive_option.some. Add Ref.callbackWithCleanup (React 19). Ref.value / Ref.valueRef are deprecated.
- Breaking: remove the internal
NativeMethods.Make / *Methods.Make functors, DOMAPI.Element.Impl, and the deprecated NativeElement.element / NativeElement.ref types
Notes for reviewers
npm test passes (clean build, warnings as errors). Changes were checked by compiling throwaway usage files and reading the generated JS; nothing was run in a real React Native app.
- Third-party bindings of the org (
safe-area-context, flash-list, rescript-react-navigation) were compiled against this branch and still build (react-navigation has its own unrelated Js.* deprecation warnings with ReScript 12).
- Public functors (
NativeElement.Impl, Event.SyntheticEvent) are kept on purpose as a stable API for third-party bindings, even though applying them costs one empty function call per module at load.
- The website still uses
Ref.value in scrollview.md, to update separately.
package.json version is still 0.85.0, to be bumped in the release commit.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
- BackHandler: handler receives a hardwareBackPressEvent (breaking)
- Style.blendMode: add plus-lighter
- Pressable.rippleConfig: add alpha
- TouchableNativeFeedback.Background.ripple takes a Color.t (PlatformColor)
- TextInput.autoComplete: add new Android autofill hints and missing values
- peerDependencies: react-native >= 0.86.0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the new architecture (the only one since RN 0.82), the renderer sets
target and currentTarget to the public instance of the native element,
not to a numeric view tag.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- generic Event.syntheticEvent<'payload> and responderSyntheticEvent<'payload>
records, with Event.Methods / Event.ResponderMethods externals
- Event.SyntheticEvent / ResponderSyntheticEvent functors stay the public API to
define an event module, now based on these records: events of third-party
bindings share the same type and get new methods for free
- bubbles, cancelable, defaultPrevented, eventPhase, isTrusted and type are
option<...> (undefined while the handler runs, never null)
- nativeEvent getter returns the payload type instead of 'a
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- NativeMethods, DOMAPI.Element and *Methods modules are generic externals on
DOMAPI.element<'nativeElement>, no more *Methods.Make functor applied at
runtime
- DOMAPI.Node.Impl takes a type constructor so node methods are written once
and stay generic for elements; DOMAPI.Element.Impl is removed
- component-specific methods are restricted by a polymorphic variant kind
([> #scrollView], [> #textInput], ...), so lists keep ScrollView methods
and TextInput doesn't get them
- NativeElement.Impl stays the public API to define an element module, now
based on NativeElement.Methods: third-party bindings get new methods for free
- remove the internal *Methods.Make functors and the deprecated
NativeElement.element / NativeElement.ref types
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- DOMAPI.Element.getBoundingClientRect returns a Layout.domRect (x, y, width,
height, top, right, bottom, left), it was wrongly typed as Rect.t (insets
with optional fields)
- add Rect.size to pass a single number to hitSlop / pressRetentionOffset,
as React Native accepts a number for these props
Co-Authored-By: Claude Opus 5.5 <[email protected]>
NativeElement.Impl provides useRef, an external to React.useRef(null) typed
for the element: `let ref = TextInput.useRef()` instead of annotating the
ref or each use of its current value.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Ref.t is React.ref<nullable<'element>>: an object ref is passed directly
(ref=myRef), and the generated JS no longer wraps it in Primitive_option.some
- add Ref.callbackWithCleanup for React 19 callback refs returning a cleanup
- deprecate Ref.value and Ref.valueRef, no longer needed
- typed useRef of element modules returns the element ref type
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-11T11:35:33.253308Z |
ad84331 |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
cknitt
Awaiting requested review from cknitt
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|