Skip to content

chore(example): run the example on Expo SDK 52 with Reanimated 3, and fix what it showed - #16

Merged
gfrancischini merged 4 commits into
mainfrom
chore/example-expo-reanimated-3
Nov 10, 2026
Merged

gfrancischini merged 4 commits into
mainfrom
chore/example-expo-reanimated-3

Conversation

@gfrancischini

@gfrancischini gfrancischini commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

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.

 example/                                   Expo 47  ->  Expo SDK 52
-  react 18.1, react-native 0.70.6            (old architecture)
+  react 18.3.1, react-native 0.76.9          (New Architecture, Expo Go 52)
-  reanimated 2.12, gesture-handler 2.8
+  reanimated 3.16, gesture-handler 2.20, flash-list 1.7.3, screens 4.4
   metro.config.js    blacklistRE -> blockList; tsconfig paths off for Metro
   babel.config.js    babel-preset-expo adds the Reanimated plugin itself
-  webpack.config.js, Flipper, lists profiler (needs Flipper)
   tsconfig.json      library peers resolve to the example's copies

 yarn typecheck
   tsc --noEmit                  src against Reanimated 2.12 (dev deps)
+  tsc --noEmit -p example       src against Reanimated 3 (example peers)

 src/
   FastScrollSectionFullList     Animated.FlatList ref: callback that fits both typings
   FastScrollSectionDotsBar      measured ref: callback that fits both typings
   utils.useComponentSize        takes RefObject<View>
   FastScrollSectionFullListItem
     <GestureDetector gesture={tap}>
-      <Text>                    may be flattened on the New Architecture
+      <View collapsable={false}>
+        <Text>
  • Typecheck. Two refs only fit Reanimated 2.12's typings. Reanimated 3 types the Animated.FlatList ref as React Native's FlatList, and types the Animated.View instance as its own class, which has no measure. Both are now callback refs that accept any object and keep the ref as what it is at runtime. Behavior is unchanged. yarn typecheck also checks the example now, so CI fails on code that fits only one side. CI already installs the example's dependencies.
  • Section list rows. Each row's GestureDetector wrapped a Text. On the New Architecture a Text can 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 the Text in a View with collapsable={false}, as the message asks.

Evidence

The example on SDK 52. Android emulator (API 36), Expo Go 2.32.20, categories screen.

  1. The list scrolls and the indicator and the dots appear.
  2. Dragging the indicator runs the list through the sections.
  3. Dragging the dots opens the section list, and the active row follows the finger.
  4. Tapping Bracelets / Platinum scrolls the list there.

Full resolution: categories-sdk52.mp4. The bundle takes every peer (react, react-native, Reanimated, Gesture Handler) from example/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:

Before After
12 errors in the Metro log, one per row, and the LogBox toast. 0 errors. The rows keep the same frames.

The error from the toast in full (row-before-logbox.png):

[react-native-gesture-handler] GestureDetector has received a child that may get view-flattened.
To prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.
  refHandler  useViewRefHandler.ts:41:24
  commitAttachRef  ReactFabric-dev.js

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 typecheck script changed, the new check fails on the two refs:

$ tsc --noEmit && tsc --noEmit -p example
src/FastScrollSectionDots/FastScrollSectionDotsBar.tsx(153,49): error TS2345: Argument of type
  'RefObject<Component<AnimateProps<ViewProps>, any, any>>' is not assignable to parameter of type
  'MutableRefObject<View | AnimatedView | null | undefined>'.
src/FastScrollSectionDots/FastScrollSectionFullList.tsx(193,9): error TS2322: Type
  '(list: Animated.FlatList<SectionFullData> | null) => void' is not assignable to type
  'ForwardedRef<FlatList<any>> | undefined'.

With the fix, both checks pass. yarn test (101 passed, 1 todo), yarn lint and yarn prepack pass.

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.md as 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

  • Each row gains one native View. Layout is the same on the device; a custom text component still renders inside the Text, as before.
  • yarn typecheck now needs the example installed (yarn bootstrap), locally as in CI.
  • CI moves from Node 16.18.1 to 22.14.0 (.nvmrc): React Native 0.76 and Metro do not install on Node below 18. The tests already ran on Node 18+ locally.
  • The example needs Expo Go for SDK 52. The Expo Go installed for SDK 47 no longer opens it.

🤖 Generated with Claude Code

gfrancischini and others added 4 commits November 9, 2026 20:52
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>
@gfrancischini
gfrancischini merged commit 7d1978c into main Nov 10, 2026
3 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