Home > Blockchain >  How can I find TouchableOpacity component's delayLongPress property default value in React Nati
How can I find TouchableOpacity component's delayLongPress property default value in React Nati

Time:09-20

I couldn't find any docs or knowledge about this value. Are these values determined at the java level for android?

CodePudding user response:

It should be 500 milliseconds.

You can find out in the code file in node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js.

TouchableOpacity.js

import Pressability, {
  type PressabilityConfig,
} from '../../Pressability/Pressability';

_createPressabilityConfig(): PressabilityConfig {
    return {
      ...
      delayLongPress: this.props.delayLongPress,
      ...
    };
  }

As you may see, it is defined in Pressability.js.

Pressability.js

  /**
   * Duration (in addition to `delayPressIn`) after which a press gesture is
   * considered a long press gesture. Defaults to 500 (milliseconds).
   */
  delayLongPress?: ?number,

CodePudding user response:

Find the basic default values for all the touchableOpacity attributes below,

enabled: If true, parallax effects are enabled. Defaults to true.
shiftDistanceX: Defaults to 2.0.
shiftDistanceY: Defaults to 2.0.
tiltAngle: Defaults to 0.05.
magnification: Defaults to 1.0.
pressMagnification: Defaults to 1.0.
pressDuration: Defaults to 0.3.
pressDelay: Defaults to 0.0.

And you may find all these in here

  • Related