-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[0.63] TouchableOpacity has a slightly delay between press and opacity change #29313
Comments
It's difficult to migrate all existing |
This was fixed in 4aaf629#diff-ff4d5358a97501a402a3f234318497e4 and the pick has been requested for 0.63 |
This affects the behavior of onPress as well which is IMO a much bigger deal. It's a really big behavior change that now users cannot just tap on TouchableOpacity in my app -- they must tap and hold for 130ms to trigger the onPress. That breaks a lot of interactions. edit: disregard, the error was in my app code. TouchableOpacity seems fine other than the delay in opacity change mentioned in this issue. |
So should I add |
A workaround is to add below code in the entry file:
|
I am using 0.63.1 and still get the issue with |
yep can confirm, the delay is still there. I really hope the gets fixed soon. I don't want to add the |
Same here. I am getting the delay as well (0.63.2). I rely on 3rd party components which utilise TouchableOpacity which complicates matters in regards to just adding |
Still having this issue on 0.63.2 as well. |
I did this eventually, luckily I am in a single person codebase which is quite small: import React, { PropsWithChildren } from 'react';
import {
TouchableWithoutFeedback,
TouchableNativeFeedbackProps,
View,
} from 'react-native';
type TouchableInstantProps = PropsWithChildren<
Omit<TouchableNativeFeedbackProps, 'children'>
>;
export default function TouchableInstant({
children,
style,
...rest
}: TouchableInstantProps) {
return (
<TouchableWithoutFeedback {...rest} delayPressIn={0}>
{children ?? <View style={style} />}
</TouchableWithoutFeedback>
);
} But you could do the same with TouchableOpacity I think. Seems kind of dumb, but I see both sides to the argument. I think changing the default behaviour is kind of leaving everyone who's already assumed the default is Not even considering dependencies. What would have been sensible is for I'd say revert it, personally, else upgrading to 0.63 is just going to make everyone's app feel sluggish. |
Closed in favor of #29376 |
To resolve this issue, here is the following step:
So, you do not have to add delayPressIn={0} to every single TouchableOpacity component or migrate to Pressable component. Moreover, I also saw that even some people still find the delay in opacity change at the newest update of React Native (v0.63+). So far my solution works for me, and hopefully it works for you guys also. Cheers. 🤟 |
Still getting this issue |
Description
0.63.0 changes the default behavior of
TouchableOpacity
causing a 130ms delay between the press and opacity change.fc45530#diff-ff4d5358a97501a402a3f234318497e4R273-R276
Before 0.63:
TouchableOpacity
will instantly become semi-transparent when pressed.0.63.0: A simple press will not trigger the opacity change. Only 'press and hold' will make it semi-transparent.
TouchableOpacity
is usually used as the base of customized buttons, where most interactions should be simple presses (without hold). Such change makes it super hard to trigger the opacity animation, causing many customized buttons feels so non-interactive.React Native version:
0.63.0
Steps To Reproduce
<TouchableOpacity />
by default will have a 130ms delay between press and opacity change.Expected Results
<TouchableOpacity />
should behave like<TouchableOpacity delayPressIn={0} />
.Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/jilPTbg9l
The text was updated successfully, but these errors were encountered: