Skip to content

Commit b144992

Browse files
EvanBaconnecolas
authored andcommitted
[fix] Add enum types to interaction prop types
Close #1358
1 parent 9d5a41c commit b144992

File tree

1 file changed

+60
-16
lines changed
  • packages/react-native-web/src/modules/InteractionPropTypes

1 file changed

+60
-16
lines changed

packages/react-native-web/src/modules/InteractionPropTypes/index.js

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,68 @@
77
* @flow
88
*/
99

10-
import { oneOf, string } from 'prop-types';
10+
import { oneOf, oneOfType, string } from 'prop-types';
11+
12+
const cursorEnum = [
13+
'auto',
14+
'default',
15+
'none',
16+
'context-menu',
17+
'help',
18+
'pointer',
19+
'progress',
20+
'wait',
21+
'cell',
22+
'crosshair',
23+
'text',
24+
'vertical-text',
25+
'alias',
26+
'copy',
27+
'move',
28+
'no-drop',
29+
'not-allowed',
30+
'e-resize',
31+
'n-resize',
32+
'ne-resize',
33+
'nw-resize',
34+
's-resize',
35+
'se-resize',
36+
'sw-resize',
37+
'w-resize',
38+
'ew-resize',
39+
'ns-resize',
40+
'nesw-resize',
41+
'nwse-resize',
42+
'col-resize',
43+
'row-resize',
44+
'all-scroll',
45+
'zoom-in',
46+
'zoom-out',
47+
'grab',
48+
'grabbing '
49+
];
50+
const touchActionEnum = [
51+
'auto',
52+
'inherit',
53+
'manipulation',
54+
'none',
55+
'pan-down',
56+
'pan-left',
57+
'pan-right',
58+
'pan-up',
59+
'pan-x',
60+
'pan-y',
61+
'pinch-zoom'
62+
];
63+
const userSelectEnum = ['auto', 'text', 'none', 'contain', 'all'];
1164

1265
const InteractionPropTypes = {
13-
cursor: string,
14-
touchAction: oneOf([
15-
'auto',
16-
'inherit',
17-
'manipulation',
18-
'none',
19-
'pan-down',
20-
'pan-left',
21-
'pan-right',
22-
'pan-up',
23-
'pan-x',
24-
'pan-y',
25-
'pinch-zoom'
26-
]),
27-
userSelect: string,
66+
// https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Formal_syntax
67+
cursor: oneOfType([string, oneOf(cursorEnum)]),
68+
// https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action#Formal_syntax
69+
touchAction: oneOf(touchActionEnum),
70+
// https://developer.mozilla.org/en-US/docs/Web/CSS/user-select#Formal_syntax_2
71+
userSelect: oneOf(userSelectEnum),
2872
willChange: string
2973
};
3074

0 commit comments

Comments
 (0)