-
-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description #3127 introduced our own implementation of `findNodeHandle` on web. Unfortunately, it doesn't work if someone uses `GestureDetector` on SVG elements, e.g.: ```jsx <Svg width={200} height={200}> <GestureDetector gesture={tapGestureCircle}> <Circle r={200} cx={210} cy={210} fill={circleFill} /> </GestureDetector> </Svg> ``` Code above would render additional `div` element with `display: 'contents';`, which would break `SVG`. This PR does the following things: 1. Bumps `react-native-svg` version 2. Modifies `Wrap` component such that now if element is part of `SVG` it doesn't wrap it into additional `div` 3. Adjusts `findNodeHandle` function to properly handle `SVG` refs ## Test plan <details> <summary>Tested on the following example:</summary> ```jsx import { GestureHandlerRootView, GestureDetector, Gesture, } from 'react-native-gesture-handler'; import { View } from 'react-native'; import { Svg, Circle } from 'react-native-svg'; import { useState, useCallback } from 'react'; export default function App() { const [circleFill, setCircleFill] = useState('blue'); const switchCircleColor = useCallback( () => setCircleFill((old) => (old === 'blue' ? 'brown' : 'blue')), [setCircleFill] ); const tapGestureCircle = Gesture.Tap().runOnJS(true).onEnd(switchCircleColor); return ( <GestureHandlerRootView style={{ flex: 1, paddingTop: 200 }}> <View style={{ padding: 10, borderWidth: 1, alignSelf: 'flex-start' }}> <Svg width={200} height={200}> <GestureDetector gesture={tapGestureCircle}> <Circle r={200} cx={210} cy={210} fill={circleFill} /> </GestureDetector> </Svg> </View> </GestureHandlerRootView> ); } ``` </details>
- Loading branch information
Showing
6 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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