[iOS] Button press feedback invisible on quick taps when Reduce Motion is enabled
维护者通常 2 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- objective-c, typescript
- 领域
- accessibility, mobile
调研方向
Start with handleAnimatePressOut in apple/RNGestureHandlerButton.mm, where a short tap's remaining hold is forced to 0 under UIAccessibilityIsReduceMotionEnabled(). Then check animateUnderlayToOpacity:duration: and animateTarget:toOpacity:scale:duration:, which also zero their durations. Done means a quick tap with Reduce Motion on still shows the opacity and underlay change for tapAnimationInDuration, while the activeScale motion stays removed. The web equivalent is prefersReducedMotion() in GestureHandlerButton.web.tsx.
由索引模型根据 Issue 内容生成。
描述
Description
With Reduce Motion turned on in iOS, a quick tap on a native button (Touchable, RectButton, BorderlessButton, ...) shows no press feedback at all. The activeOpacity dim and the activeUnderlayOpacity highlight are both affected. Only a press held longer than tapAnimationInDuration shows anything.
This shows up most inside a ScrollView. There, delaysContentTouches hands the button press-in and press-out together on a quick tap, so the elapsed press time is ~0 ms and every tap takes the short path described below.
Cause, in apple/RNGestureHandlerButton.mm (since #4197):
animateUnderlayToOpacity:duration:andanimateTarget:toOpacity:scale:duration:set the duration to 0 whenUIAccessibilityIsReduceMotionEnabled()is on.- In
handleAnimatePressOut, a tap shorter thantapAnimationInDurationfinishes the press-in inremainingms and schedules the press-out afterremaining. Under Reduce Motion, that delay is also forced to 0.
So the active state is set and then reset within the same frame, and it never reaches the screen.
Apple's Reduce Motion guidance asks apps to remove motion (scaling, sliding, zooming). It does not ask them to remove feedback: a dissolve, highlight fade or color change is the recommended replacement. Only the activeScale animation should be affected. The opacity and underlay changes should still be shown, at minimum held for tapAnimationInDuration like they are without Reduce Motion.
Code reading only, not verified on a device: web has the same prefersReducedMotion() ? 0 : remaining in GestureHandlerButton.web.tsx. Android scales the hold by the animator duration scale (here), so with animations removed (scale 0) it would collapse the same way.
Steps to reproduce
- Turn on Settings > Accessibility > Motion > Reduce Motion on an iPhone or simulator.
- Render buttons inside a
ScrollView:
import { Text } from 'react-native';
import { ScrollView, Touchable } from 'react-native-gesture-handler';
export default function Repro() {
return (
<ScrollView contentContainerStyle={{ padding: 24, gap: 16 }}>
<Touchable activeOpacity={0.3} onPress={() => {}} style={{ padding: 24, backgroundColor: 'tomato' }}>
<Text>activeOpacity</Text>
</Touchable>
<Touchable
underlayColor="black"
activeUnderlayOpacity={0.3}
onPress={() => {}}
style={{ padding: 24, backgroundColor: 'gold' }}>
<Text>underlay</Text>
</Touchable>
</ScrollView>
);
}
- Tap each button quickly.
Expected: each tap briefly dims or highlights the button, the same as with Reduce Motion off. An instant change instead of a fade is fine.
Actual: nothing is visible. Holding the press does show the active state. Turning Reduce Motion off brings the feedback back.
On 3.3.0, an iPhone 17 Pro simulator (iOS 27.2), quick taps on activeUnderlayOpacity buttons showed nothing with Reduce Motion on, while a long press did. With the change in #4708 applied to 3.3.0 as a patch, a screen recording of a quick tap with Reduce Motion on shows the underlay at the same peak as with it off, for ~150 ms (50 ms in, 100 ms out).
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
The repro is the single component inline above: it needs nothing beyond react-native-gesture-handler, and only the Reduce Motion setting changes the result.
Gesture Handler version
3.3.0 (also present on main at c09aaa6af4d4e9f5189247b59f72d5124b3911f2)
React Native version
0.88.1
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Using Expo Prebuild or an Expo development build
Build type
Debug mode
Device
iOS simulator
Device model
iPhone 17 Pro simulator, iOS 27.2
Acknowledgements
Yes
Related libraries installed: Expo SDK 58 (expo 58.0.26), react-native-reanimated 4.7.1, react-native-worklets 0.13.0, react-native-screens 4.30.1 (none involved: the bug is in the native button).
- 主要语言
- TypeScript
- 星标
- 6.8k
- 派生
- 1.1k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 28
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
software-mansion/react-native-gesture-handler 的其他 Issue
-
Missing repro Platform: Android Platform: iOS
难度 5/5 一周以上 新手友好度 39/100
software-mansion/react-native-gesture-handler#4714 · 1 条评论 ·
维护者通常 2 天内回复
-
[Web] A pan that starts on a Pressable presses it when the mouse button is released可能已有人在做 @mokshupadhyay 于 1 天前认领。 未关闭Platform: Web
难度 4/5 3-5 天 新手友好度 57/100
software-mansion/react-native-gesture-handler#4713 ·
维护者通常 2 天内回复
-
[iOS] Crash at app exit: static `_managers` map destroyed while `flushOperations` reads it可能已有人在做 @beqramo 于 5 天前认领。 未关闭Missing info Missing repro Platform: iOS Platform: MacOS
难度 2/5 1-3 小时 新手友好度 30/100
software-mansion/react-native-gesture-handler#4711 · 3 条评论 ·
维护者通常 2 天内回复
-
[iOS][Fabric] Recognizer of a live handler stays on a recycled view and takes every drag on the component that reuses it可能已有人在做 @nihar777 于 5 天前认领。 未关闭Platform: iOS
难度 4/5 3-5 天 新手友好度 35/100
software-mansion/react-native-gesture-handler#4710 · 2 条评论 ·
维护者通常 2 天内回复
-
Missing info Platform: Android
难度 4/5 3-5 天 新手友好度 22/100
software-mansion/react-native-gesture-handler#4706 · 1 条评论 ·
维护者通常 2 天内回复
查看 software-mansion/react-native-gesture-handler 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
维护者通常 1 天内回复
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chat可能已有人在做 @koeria 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
milind-soni/OpenMausBot#8023 ·
维护者通常 1 天内回复
-
Windows microphone listing treats words in a device name as DirectShow labels可能已有人在做 @Sujal-chaudhary 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 88/100
clipy-recorder/clipy#447 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement from-app needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
nightly-labs/openbot#19162 ·
维护者通常 1 天内回复
-
triage:in-progress
难度 2/5 1-3 小时 新手友好度 76/100
Cotal-AI/Cotal#11229 · 1 条评论 ·
维护者通常 1 天内回复