Repository navigation
chore(example): run the example on Expo SDK 52 with Reanimated 3, and fix what it showed - #16
Merged
Merged
Conversation
The example ran Expo 47 with Reanimated 2.12 and Gesture Handler 2.8, the same minimum peers Jest uses, so nothing in the repo ran the library on Reanimated 3 or the New Architecture, which is what production runs. - Expo SDK 52: React 18.3.1, React Native 0.76.9, Reanimated 3.16, Gesture Handler 2.20, FlashList 1.7.3. Runs in Expo Go for SDK 52, which always uses the New Architecture (now explicit in app.json). - Metro: blacklistRE is now blockList. tsconfig paths are off for Metro, since Babel and extraNodeModules already alias the library and its peers. - Babel: babel-preset-expo adds the Reanimated plugin itself. - Removed the Webpack config (SDK 50+ bundles web with Metro), Flipper and the Shopify lists profiler, which needs Flipper. No list was wrapped in its performance view, so it only logged empty callbacks. - The example's tsconfig maps the library's peers to the example's copies, so its typecheck sees one React. Two errors remain in src/ against Reanimated 3's types; they are in docs/backlog.md with the other findings from running the example on the device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two refs only fit Reanimated 2.12's typings: - the section list's `Animated.FlatList` callback ref took a 2.12 `Animated.FlatList`, while Reanimated 3 hands it React Native's `FlatList`; - the dots bar measured a ref typed as the `Animated.View` element, which in Reanimated 3 is its own component class without `measure`. Both now use a callback ref that accepts any object and keep the ref as what it is at runtime (the native `FlatList` / `View`), and `useComponentSize` takes a `RefObject<View>`. Runtime behavior is unchanged. `yarn typecheck` now also checks the example app, whose peers are Reanimated 3, so CI catches code that fits only one side. CI already installs the example's dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The row's GestureDetector wrapped a Text. On the New Architecture a Text
can be flattened into its parent, so Gesture Handler (2.20 here) logged
"GestureDetector has received a child that may get view-flattened" once
per row, as a red error in development, every time the section list
rendered. The Text now sits in a View with collapsable={false}, as the
message asks.
On the Android emulator (example app, Expo SDK 52, New Architecture), the
section list with 12 rows logged 12 errors before and none after. The
rows keep the same frames, and tapping a row still scrolls the list to
that section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
React Native 0.76 and Metro in the example require Node 18 or newer, and CI installs the example for the typecheck, so yarn install failed on Node 16.18.1 in every job. 22.14.0 is the version the checks were run with locally. Co-Authored-By: Claude Opus 5.5 <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.
Summary
The example app ran Expo 47 with Reanimated 2.12 and Gesture Handler 2.8, the same minimum peers Jest runs, so nothing in this repo ran the library on Reanimated 3 or the New Architecture. Apps on current React Native run both. This PR moves the example to Expo SDK 52 and fixes the two library problems that showed up there.
Animated.FlatListref as React Native'sFlatList, and types theAnimated.Viewinstance as its own class, which has nomeasure. Both are now callback refs that accept any object and keep the ref as what it is at runtime. Behavior is unchanged.yarn typecheckalso checks the example now, so CI fails on code that fits only one side. CI already installs the example's dependencies.GestureDetectorwrapped aText. On the New Architecture aTextcan be flattened into its parent, so Gesture Handler logged a red "may get view-flattened" error for every row, every time the section list rendered. The row now wraps theTextin aViewwithcollapsable={false}, as the message asks.Evidence
The example on SDK 52. Android emulator (API 36), Expo Go 2.32.20, categories screen.
Full resolution: categories-sdk52.mp4. The bundle takes every peer (
react,react-native, Reanimated, Gesture Handler) fromexample/node_modules, none from the root's copies.Section list rows. DotsLayout screen, 12 sections, section list opened from the dots. Same code with only the row file reverted:
The error from the toast in full (row-before-logbox.png):
With the fix, tapping Section 8 still scrolls the list to Product 8.1. On the categories screen the Metro log has no errors or warnings.
No unit test for the row: flattening happens in Fabric's native code and Jest cannot show it. The existing tap tests pass unchanged.
Typecheck. With only the
typecheckscript changed, the new check fails on the two refs:With the fix, both checks pass.
yarn test(101 passed, 1 todo),yarn lintandyarn prepackpass.Still open. On the emulator, two of six drags on the dots right after scrolling the list scrolled the list instead of opening the section list. I could not reproduce it reliably. It is in
docs/backlog.mdas unconfirmed.Merge Danger
Door: two-way
Reverting restores the old example and the old row. The library's props, handles and gestures are unchanged.
Blast Radius: section list rows
View. Layout is the same on the device; a customtextcomponent still renders inside theText, as before.yarn typechecknow needs the example installed (yarn bootstrap), locally as in CI..nvmrc): React Native 0.76 and Metro do not install on Node below 18. The tests already ran on Node 18+ locally.🤖 Generated with Claude Code