Closed m-bert closed 6 months ago
Currently our components (BaseButton, RectButton and BorderlessButton) don't support refs, so it is impossible to use methods like measure.
BaseButton
RectButton
BorderlessButton
refs
measure
This PR adds wrapper to these components, so that they are now exported as ForwardRef.
ForwardRef
Fixes #2894
Description
Currently our components (
BaseButton
,RectButton
andBorderlessButton
) don't supportrefs
, so it is impossible to use methods likemeasure
.This PR adds wrapper to these components, so that they are now exported as
ForwardRef
.Fixes #2894
Test plan
Tested on slightly modified code from issue
```jsx import React, { useRef } from 'react'; import { Text, StyleSheet } from 'react-native'; import { BaseButton, BorderlessButton, GestureHandlerRootView, RectButton, } from 'react-native-gesture-handler'; export default function App() { const rectButtonRef = useRef(null); const borderlessButtonRef = useRef(null); const baseButtonRef = useRef(null); const handlePress = () => { try { baseButtonRef.current?.measure?.((x, y, width, height) => { console.log('baseButtonRef', x, y, width, height); }); rectButtonRef.current?.measure?.((x, y) => { console.log('rectButtonRef', x, y); }); borderlessButtonRef.current?.measure?.((x, y) => { console.log('borderlessButtonRef', x, y); }); } catch (e) { console.error(e); } }; return (