Create HitSlop & Rect module (closes #765) · rescript-react-native/rescript-react-native@394bd60

5 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -1,14 +1,18 @@

11

include NativeElement

22
3-

type edgeInsets

4-

@obj

3+

// @todo in 0.70

4+

// @deprecated("Use `Rect.t` or `HitSlop.t` type instead")

5+

type edgeInsets = Rect.t

6+
7+

// @todo in 0.70

8+

// @deprecated("Use `Rect.t` or `HitSlop.t` type instead") @obj

59

external edgeInsets: (

610

~left: float=?,

711

~right: float=?,

812

~top: float=?,

913

~bottom: float=?,

1014

unit,

11-

) => edgeInsets = ""

15+

) => Rect.t = ""

1216
1317

// commodity for easier copy pasting for updating other components that have

1418

// View props

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,14 @@

1+

'use strict';

2+
3+
4+

function $$float(value) {

5+

return {

6+

left: value,

7+

right: value,

8+

top: value,

9+

bottom: value

10+

};

11+

}

12+
13+

exports.$$float = $$float;

14+

/* No side effect */

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,17 @@

1+

type t = {

2+

left: option<float>,

3+

right: option<float>,

4+

top: option<float>,

5+

bottom: option<float>,

6+

}

7+
8+

// hitSlop prop accept number and edge inset object

9+

external rect: (~left: float=?, ~right: float=?, ~top: float=?, ~bottom: float=?, unit) => t = ""

10+

// @todo in 0.70

11+

// external float: float => t = ""

12+

let float = (value: float) => {

13+

left: Some(value),

14+

right: Some(value),

15+

top: Some(value),

16+

bottom: Some(value),

17+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1 @@

1+

/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,6 @@

1+

type t = {

2+

left: option<float>,

3+

right: option<float>,

4+

top: option<float>,

5+

bottom: option<float>,

6+

}