teaset icon indicating copy to clipboard operation
teaset copied to clipboard

version diff -- Libraries/Pressability/Pressability.js 0.660. 0.62.0 version API differences, these APIs need to be updated if the latest version is used

Open program-spiritual opened this issue 2 years ago • 0 comments

version diff

0.62

export type PressabilityConfig = $ReadOnly<{|
  /**
   * Returns the amount to extend the `VisualRect` by to create `HitRect`.
   */
  getHitSlop?: ?() => ?EdgeInsetsProp,

  /**
   * Returns the duration to wait after hover in before activation.
   */
  getHoverInDelayMS?: ?() => ?number,

  /**
   * Returns the duration to wait after hover out before deactivation.
   */
  getHoverOutDelayMS?: ?() => ?number,

  /**
   * Returns the duration (in addition to the value from `getPressDelayMS`)
   * after which a press gesture becomes a long press gesture.
   */
  getLongPressDelayMS?: ?() => ?number,

  /**
   * Returns the duration to wait after press down before activation.
   */
  getPressDelayMS?: ?() => ?number,

  /**
   * Returns the duration to wait after letting up before deactivation.
   */
  getPressOutDelayMS?: ?() => ?number,

  /**
   * Returns the amount to extend the `HitRect` by to create `PressRect`.
   */
  getPressRectOffset?: ?() => ?EdgeInsetsProp,

  /**
   * Returns true to disable playing system sound on touch (Android Only)
   **/
  getTouchSoundDisabled?: ?() => ?boolean,

  /**
   * Called after the element loses focus.
   */
  onBlur?: ?(event: BlurEvent) => void,

  /**
   * Called after the element is focused.
   */
  onFocus?: ?(event: FocusEvent) => void,

  /**
   * Called when the hover is activated to provide visual feedback.
   */
  onHoverIn?: ?(event: MouseEvent) => void,

  /**
   * Called when the hover is deactivated to undo visual feedback.
   */
  onHoverOut?: ?(event: MouseEvent) => void,

  /**
   * Called when a long press gesture has been triggered.
   */
  onLongPress?: ?(event: PressEvent) => void,

  /**
   * Returns whether a long press gesture should cancel the press gesture.
   * Defaults to true.
   */
  onLongPressShouldCancelPress?: ?() => boolean,

  /**
   * Called when a press gestute has been triggered.
   */
  onPress?: ?(event: PressEvent) => void,

  /**
   * Called when the press is activated to provide visual feedback.
   */
  onPressIn?: ?(event: PressEvent) => void,

  /**
   * Called when the press location moves. (This should rarely be used.)
   */
  onPressMove?: ?(event: PressEvent) => void,

  /**
   * Called when the press is deactivated to undo visual feedback.
   */
  onPressOut?: ?(event: PressEvent) => void,

  /**
   * Returns whether to yield to a lock termination request (e.g. if a native
   * scroll gesture attempts to steal the responder lock).
   */
  onResponderTerminationRequest?: ?() => boolean,

  /**
   * Returns whether to start a press gesture.
   */
  onStartShouldSetResponder?: ?() => boolean,
|}>;

0.66.0

export type PressabilityConfig = $ReadOnly<{|
  /**
   * Whether a press gesture can be interrupted by a parent gesture such as a
   * scroll event. Defaults to true.
   */
  cancelable?: ?boolean,

  /**
   * Whether to disable initialization of the press gesture.
   */
  disabled?: ?boolean,

  /**
   * Amount to extend the `VisualRect` by to create `HitRect`.
   */
  hitSlop?: ?RectOrSize,

  /**
   * Amount to extend the `HitRect` by to create `PressRect`.
   */
  pressRectOffset?: ?RectOrSize,

  /**
   * Whether to disable the systemm sound when `onPress` fires on Android.
   **/
  android_disableSound?: ?boolean,

  /**
   * Duration to wait after hover in before calling `onHoverIn`.
   */
  delayHoverIn?: ?number,

  /**
   * Duration to wait after hover out before calling `onHoverOut`.
   */
  delayHoverOut?: ?number,

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

  /**
   * Duration to wait after press down before calling `onPressIn`.
   */
  delayPressIn?: ?number,

  /**
   * Duration to wait after letting up before calling `onPressOut`.
   */
  delayPressOut?: ?number,

  /**
   * Minimum duration to wait between calling `onPressIn` and `onPressOut`.
   */
  minPressDuration?: ?number,

  /**
   * Called after the element loses focus.
   */
  onBlur?: ?(event: BlurEvent) => mixed,

  /**
   * Called after the element is focused.
   */
  onFocus?: ?(event: FocusEvent) => mixed,

  /**
   * Called when the hover is activated to provide visual feedback.
   */
  onHoverIn?: ?(event: MouseEvent) => mixed,

  /**
   * Called when the hover is deactivated to undo visual feedback.
   */
  onHoverOut?: ?(event: MouseEvent) => mixed,

  /**
   * Called when a long press gesture has been triggered.
   */
  onLongPress?: ?(event: PressEvent) => mixed,

  /**
   * Called when a press gestute has been triggered.
   */
  onPress?: ?(event: PressEvent) => mixed,

  /**
   * Called when the press is activated to provide visual feedback.
   */
  onPressIn?: ?(event: PressEvent) => mixed,

  /**
   * Called when the press location moves. (This should rarely be used.)
   */
  onPressMove?: ?(event: PressEvent) => mixed,

  /**
   * Called when the press is deactivated to undo visual feedback.
   */
  onPressOut?: ?(event: PressEvent) => mixed,

  /**
   * Returns whether a long press gesture should cancel the press gesture.
   * Defaults to true.
   */
  onLongPressShouldCancelPress_DEPRECATED?: ?() => boolean,

  /**
   * If `cancelable` is set, this will be ignored.
   *
   * Returns whether to yield to a lock termination request (e.g. if a native
   * scroll gesture attempts to steal the responder lock).
   */
  onResponderTerminationRequest_DEPRECATED?: ?() => boolean,

  /**
   * If `disabled` is set, this will be ignored.
   *
   * Returns whether to start a press gesture.
   *
   * @deprecated
   */
  onStartShouldSetResponder_DEPRECATED?: ?() => boolean,
|}>;

see also RN -- Libraries/Pressability/Pressability.js 0.660. 0.62.0 版本API 差异 - 小新开源

program-spiritual avatar Jan 17 '22 11:01 program-spiritual