-
Notifications
You must be signed in to change notification settings - Fork 24.6k
scale 0 touchable is clickable, inherits dimensions from random views #50797
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
Comments
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.79.1. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Reproducible on 0.79.1 |
Similar (but different) behavior is present in 0.76.9 |
@vanaigr thanks for the issue. We will look into it as soon as possible. I believe this is the reproducer, am I correct? import { AppRegistry } from 'react-native';
import { name as appName } from './app.json'
import React from 'react'
import { View, Text, TouchableWithoutFeedback, TextInput } from 'react-native'
function App() {
const [value, setValue] = React.useState('0.9')
const [scale, setScale] = React.useState(0.9)
return <View>
<View style={{ backgroundColor: 'green', marginTop: 50 }}>
<View style={{ height: 200, transform: [{ scaleY: 0 }] }}>
<TouchableWithoutFeedback onPress={() => console.log('1 clicked')}>
<View style={{ flex: 1, backgroundColor: 'red' }}>
<Text>View 1</Text>
</View>
</TouchableWithoutFeedback>
</View>
</View>
<View style={{ backgroundColor: 'blue', marginTop: 50 }}>
<View style={{ height: 200, transform: [{ scaleY: scale }] }}>
<TouchableWithoutFeedback onPress={() => console.log('2 clicked')}>
<View style={{ flex: 1, backgroundColor: 'red' }}>
<Text>View 2</Text>
</View>
</TouchableWithoutFeedback>
</View>
</View>
<View>
<Text>Scale:</Text>
<TextInput value={value} onChangeText={it => {
setValue(it)
const p = parseFloat(it)
if(isFinite(p)) setScale(p)
}}/>
</View>
</View>
}
AppRegistry.registerComponent(appName, () => App); |
yes |
Description
If a transform
scaleY: 0
is applied to a view with e.g.TouchableWithoutFeedback
inside, the clicks are still registered as ifTouchableWithoutFeedback
had some height.The height matches height of another
TouchableWithoutFeedback
in the hierarchy.Steps to reproduce
git clone https://github.com/vanaigr/react-native-scale-0-bug
andcd
into the directorynpm i
npm run android
Scale:
input to 0.51 clicked
appears in console.Scale:
input to 0.91 clicked
printed in console.Scale:
input to 02 clicked
printed in console.React Native Version
0.79.0
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli info
Stacktrace or Logs
Reproducer
https://github.com/vanaigr/react-native-scale-0-bug
Screenshots and Videos
2025-04-18.00-04-30.mp4
The text was updated successfully, but these errors were encountered: