Skip to main content

TouchableOpacity

如果你正在寻找更广泛且面向未来的方法来处理基于触摸的输入,请查看 Pressable API。

¥If you're looking for a more extensive and future-proof way to handle touch-based input, check out the Pressable API.

使视图正确响应触摸的封装器。按下时,封装视图的不透明度会降低,使其变暗。

¥A wrapper for making views respond properly to touches. On press down, the opacity of the wrapped view is decreased, dimming it.

通过将子项封装在 Animated.View 中(添加到视图层次结构中)来控制不透明度。请注意,这可能会影响布局。

¥Opacity is controlled by wrapping the children in an Animated.View, which is added to the view hierarchy. Be aware that this can affect layout.

示例

¥Example


参考

¥Reference

属性

¥Props

TouchableWithoutFeedback 属性

¥TouchableWithoutFeedback Props

继承 TouchableWithoutFeedback 属性

¥Inherits TouchableWithoutFeedback Props.


style

类型
View.style

activeOpacity

确定触摸处于活动状态时封装视图的不透明度应为多少。默认为 0.2

¥Determines what the opacity of the wrapped view should be when touch is active. Defaults to 0.2.

类型
number

tvParallaxProperties
IOS

(仅限苹果电视)具有控制 Apple TV 视差效果属性的对象。

¥(Apple TV only) Object with properties to control Apple TV parallax effects.

  • enabled:如果为 true,则启用视差效果。默认为 true

    ¥enabled: If true, parallax effects are enabled. Defaults to true.

  • shiftDistanceX:默认为 2.0

    ¥shiftDistanceX: Defaults to 2.0.

  • shiftDistanceY:默认为 2.0

    ¥shiftDistanceY: Defaults to 2.0.

  • tiltAngle:默认为 0.05

    ¥tiltAngle: Defaults to 0.05.

  • magnification:默认为 1.0

    ¥magnification: Defaults to 1.0.

  • pressMagnification:默认为 1.0

    ¥pressMagnification: Defaults to 1.0.

  • pressDuration:默认为 0.3

    ¥pressDuration: Defaults to 0.3.

  • pressDelay:默认为 0.0

    ¥pressDelay: Defaults to 0.0.

类型
object

hasTVPreferredFocus
iOS

(仅限苹果电视)TV 首选焦点(请参阅 View 组件的文档)。

¥(Apple TV only) TV preferred focus (see documentation for the View component).

类型
bool

nextFocusDown
Android

接下来电视焦点向下(请参阅查看组件的文档)。

¥TV next focus down (see documentation for the View component).

类型
number

nextFocusForward
Android

TV 下一个焦点向前(请参阅 View 组件的文档)。

¥TV next focus forward (see documentation for the View component).

类型
number

nextFocusLeft
Android

TV 的下一个焦点向左(请参阅 View 组件的文档)。

¥TV next focus left (see documentation for the View component).

类型
number

nextFocusRight
Android

电视下一个焦点向右(请参阅查看组件的文档)。

¥TV next focus right (see documentation for the View component).

类型
number

nextFocusUp
Android

接下来聚焦电视(请参阅查看组件的文档)。

¥TV next focus up (see documentation for the View component).

类型
number