Skip to content

Backport changes to 3.17 #7041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Backport changes to 3.17 #7041

merged 2 commits into from
Feb 18, 2025

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented Feb 18, 2025

Summary

This PR contains cherry-picked commits that should be backported to 3.17

Test plan

After switching to new `findNodeHandle` implementation based on
`display: contents;`, we can no longer detect components from `SVG` that
are wrapped using `createAnimatedComponent` (see
[issue](software-mansion/react-native-gesture-handler#3356)
on Gesture Handler side). This is because our
[Wrap](https://github.com/software-mansion/react-native-gesture-handler/blob/7f90209add0b761d3738882339f4949b31f6f88f/src/handlers/gestures/GestureDetector/Wrap.web.tsx#L9)
receives `forwardRef` as child - that makes it impossible to detect what
component is used inside. Theoretically we could do something like

```js
child.type.render().displayName
```

and use regex to get component name, but it would be very expensive.

Instead, we can add `displayName` directly to `forwardRef` on Reanimated
side. This should help us detect if component passed inside
`createAnimatedComponent` was from `SVG`.

Code used inside our
[Wrap.web.tsx](https://github.com/software-mansion/react-native-gesture-handler/blob/7f90209add0b761d3738882339f4949b31f6f88f/src/handlers/gestures/GestureDetector/Wrap.web.tsx#L9)

```jsx
const child = React.Children.only(children);

console.log(child)
console.log(child.type.displayName)
```

gives the following result:

<img width="605" alt="image"
src="https://github.com/user-attachments/assets/e12059bb-ebbc-4812-8a1a-ae8eb6507cf2"
/>
Starting from Android 15 devices can use 16KB page size instead of 4KB.
Apps that take advantage of this require additional linker flag.

This PR adds aforementioned flag so that apps that use Reanimated don't
crash.

>[!NOTE]
> More info can be found
[here](https://developer.android.com/guide/practices/page-sizes)

Tested on fabric-example on AVD with 16KB page size.
@m-bert m-bert requested a review from tjzel February 18, 2025 09:47
@tjzel tjzel merged commit fe97a28 into 3.17-stable Feb 18, 2025
26 of 42 checks passed
@tjzel tjzel deleted the @mbert/backport-3.17 branch February 18, 2025 10:31
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.

2 participants