Skip to content

chore: update the Lynx toolchain and drop the ref bridge - #10

Merged
upupming merged 1 commit into
feat/linkingfrom
chore/lynx-toolchain
Sep 7, 2026
Merged

upupming merged 1 commit into
feat/linkingfrom
chore/lynx-toolchain

Conversation

@upupming

@upupming upupming commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Every @lynx-js/* package to its current release. The one that matters is
ReactLynx 0.126, which moves from Preact 10 to 11.

Preact 10 pulled ref out of props in createElement and pointed it at the
component instance. BaseNavigationContainer takes ref as a plain prop —
the way React 19 delivers it — so it never saw one: useImperativeHandle ran
against undefined, and the caller got a Preact instance with no
getRootState. That is why the container published its handle through
NavigationContainerRefContext instead.

Preact 11 delivers ref as a prop, so LinkingBridge goes away and the
container hands useLinking its own ref, matching @react-navigation/native.

react-rsbuild-plugin has to move with it — 0.19.1 peers on 0.124/0.125 only.

Verified on a Pixel 5: a cold start lands on the linked route, and a warm one
navigates onto the existing stack — the path that needs ref.current.

One thing to know: the demo still aliases react to this package's compat
shim rather than @lynx-js/react/compat. The official entry makes the
main-thread render throw cannot read property '__cC7' of undefined inside
use(NavigationStateContext); the shim's use = useContext does not.

ReactLynx 0.126 moves from Preact 10 to 11. Preact 10 pulled `ref` out
of props in createElement and pointed it at the component instance, so
`BaseNavigationContainer`, which takes `ref` as a plain prop the way
React 19 does, never saw it - `useImperativeHandle` ran against
undefined and the caller got a Preact instance with no `getRootState`.

Preact 11 delivers ref as a prop, so the container hands `useLinking`
its own ref and LinkingBridge goes away.

react-rsbuild-plugin has to move too: 0.19.1 peers on 0.124/0.125 only.
@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b9c140a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@react-navigation/lynx Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@socket-security

Copy link
Copy Markdown

@upupming
upupming merged commit a1df6b5 into main Sep 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant