-
Notifications
You must be signed in to change notification settings - Fork 30
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
Hover style is not applied correctly to Pressable components #12
Comments
let's do this.... Assign me |
Hi @okwasniewski, I was not able to reproduce it. It was solved? |
Hey @Marcoo09, No it wasn't fixed. If you go to Components > Pressable and modify function ContentPress() {
const [timesPressed, setTimesPressed] = useState(0);
let textLog = '';
if (timesPressed > 1) {
textLog = timesPressed + 'x onPress';
} else if (timesPressed > 0) {
textLog = 'onPress';
}
return (
<>
<View style={styles.row}>
<Pressable
+ style={{padding: 10, borderRadius: 20, backgroundColor: 'red'}}
onPress={() => {
setTimesPressed(current => current + 1);
}}>
{({pressed}) => (
<Text testID="one_press_me_button" style={styles.text}>
{pressed ? 'Pressed!' : 'Press Me'}
</Text>
)}
</Pressable>
</View>
<View style={styles.logBox}>
<Text testID="pressable_press_console">{textLog}</Text>
</View>
</>
);
} You will see that borderRadius is not correctly applied for hoverStyle |
I gone through this issue, In RCTViewComponentView.cpp, self.layers.cornerRadius becomes 0.0. because of that *shape is created with 0 borderRadius. If we pass any custom value like |
@gokul1099 Maybe we need to use |
I have found something. whenever we update the borderRadius the updateHoverEffect is not getting triggered. So I made some changes like below so it will get triggered everytime props changes. After this change the borderRadius working fine. But in the initial render the self.layers.cornerRadius in updateHoverEffect is 0.0. So the borderRadius is not getting applied. |
Description
Hover style is not applied correctly to Pressable components. For some reason, Pressable components are not passing
borderRadius
to the native side correctly.The text was updated successfully, but these errors were encountered: