You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
The `Pressable` was developed with an incorrect assumption that the
`onLayout` prop is not available on the `NativeButton`.
This PR defines the `onLayout` on `RawButtonProps`, and makes use of
said prop in `Pressable` to remove the need for the
`dimensionsAfterResize` property.
This PR also marks `dimensionsAfterResize` as deprecated.
Fixes#3600
## Test plan
1. Use the provided test code.
2. Notice how the `Pressable`, despite starting out with `0, 0`
dimensions, responds correctly to all press events.
3. Use the `Pressable` examples in our example app to confirm there are
no new issues with the component.
## Test code
<details>
```tsx
import React, { useEffect } from 'react';
import { StyleSheet } from 'react-native';
import {
Pressable,
GestureHandlerRootView,
} from 'react-native-gesture-handler';
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
} from 'react-native-reanimated';
export default function EmptyExample() {
const opacity = useSharedValue(0);
const containerAnimatedStyle = useAnimatedStyle(() => {
'worklet';
return {
opacity: opacity.value,
transform: [{ scale: opacity.value }],
};
});
useEffect(() => {
opacity.value = withTiming(1, { duration: 200 });
}, [opacity]);
return (
<GestureHandlerRootView style={styles.container}>
<Animated.View style={containerAnimatedStyle}>
<Pressable style={styles.box} onPress={() => console.log('press')} />
</Animated.View>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 10,
},
box: {
width: 150,
height: 150,
backgroundColor: 'red',
alignItems: 'center',
justifyContent: 'center',
},
});
```
</details>
---------
Co-authored-by: Michał Bert <[email protected]>
0 commit comments