Module TouchableNativeFeedback-BsReactNative

type t;
let make: ?⁠accessible:bool => ?⁠accessibilityLabel:string => ?⁠accessibilityComponentType:BsReactNative.Types.accessibilityComponentType => ?⁠accessibilityTraits:list(BsReactNative.Types.accessibilityTrait) => ?⁠accessibilityRole:BsReactNative.Types.accessibilityRole => ?⁠accessibilityStates:list(BsReactNative.Types.accessibilityState) => ?⁠accessibilityHint:string => ?⁠accessibilityIgnoresInvertColors:bool => ?⁠delayLongPress:int => ?⁠delayPressIn:int => ?⁠delayPressOut:int => ?⁠disabled:bool => ?⁠hitSlop:BsReactNative.Types.insets => ?⁠onLayout:(BsReactNative.RNEvent.NativeLayoutEvent.t => unit) => ?⁠onLongPress:(BsReactNative.RNEvent.NativePressEvent.t => unit) => ?⁠onPress:(BsReactNative.RNEvent.NativePressEvent.t => unit) => ?⁠onPressIn:(BsReactNative.RNEvent.NativePressEvent.t => unit) => ?⁠onPressOut:(BsReactNative.RNEvent.NativePressEvent.t => unit) => ?⁠pressRetentionOffset:BsReactNative.Types.insets => ?⁠style:BsReactNative.Style.t => ?⁠background:t => ?⁠useForeground:bool => ?⁠testID:string => array(ReasonReact.reactElement) => ReasonReact.component(ReasonReact.stateless, ReasonReact.noRetainedProps, unit);

A wrapper for making views respond properly to touches (Android only). On Android this component uses native state drawable to display touch feedback.

At the moment it only supports having a single View instance as a child node, as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.

Background drawable of native feedback touchable can be customized with background property.

You can read more on TouchableNativeFeedback component usage in official docs: https://facebook.github.io/react-native/docs/touchablenativefeedback

Example

let component = ReasonReact.statelessComponent("MyComponent");

let make = _children => {
  ...component,
  render: _self =>
    <TouchableNativeFeedback>
      <View style=Style.(style([backgroundColor(String("#03DAC5"))]))>
        <Text style=Style.(style([height(Pt(50.))]))>
          (ReasonReact.string("Press the button"))
        </Text>
      </View>
    </TouchableNativeFeedback>,
};

Props

TouchableWithoutFeedback props

background
~background: string=?
useForeground
~useForeground: bool=?

Methods

selectableBackground

Creates an object that represents android theme's default background for selectable elements (?android:attr/selectableItemBackground).

let selectableBackground: unit => t;
selectableBackgroundBorderless

Creates an object that represent android theme's default background for borderless selectable elements (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+.

let selectableBackgroundBorderless: unit => t;
canUseNativeForeground
let canUseNativeForeground: unit => t;
ripple

Creates an object that represents ripple drawable with specified color (as a string). If property borderless evaluates to true the ripple will render outside of the view bounds (see native actionbar buttons as an example of that behavior). This background type is available on Android API level 21+.

let ripple: string => bool => t;