@expo/ui 1.0.0-canary-20250305-0af9ad2 → 1.0.0-canary-20250320-7a205d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +4 -0
  3. package/android/src/main/java/expo/modules/ui/PickerView.kt +3 -0
  4. package/android/src/main/java/expo/modules/ui/TextInputView.kt +75 -0
  5. package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +7 -3
  6. package/build/components/BottomSheet/index.d.ts +9 -0
  7. package/build/components/BottomSheet/index.d.ts.map +1 -0
  8. package/build/components/BottomSheet/index.ios.d.ts +11 -0
  9. package/build/components/BottomSheet/index.ios.d.ts.map +1 -0
  10. package/build/components/Button/index.d.ts +25 -8
  11. package/build/components/Button/index.d.ts.map +1 -1
  12. package/build/components/ContextMenu/index.android.d.ts +23 -0
  13. package/build/components/ContextMenu/index.android.d.ts.map +1 -0
  14. package/build/components/ContextMenu/index.d.ts +62 -19
  15. package/build/components/ContextMenu/index.d.ts.map +1 -1
  16. package/build/components/DatePicker/index.d.ts +8 -9
  17. package/build/components/DatePicker/index.d.ts.map +1 -1
  18. package/build/components/Picker/index.d.ts +30 -19
  19. package/build/components/Picker/index.d.ts.map +1 -1
  20. package/build/components/Progress/index.d.ts +1 -1
  21. package/build/components/Section/index.d.ts +6 -1
  22. package/build/components/Section/index.d.ts.map +1 -1
  23. package/build/components/Slider/index.d.ts +18 -10
  24. package/build/components/Slider/index.d.ts.map +1 -1
  25. package/build/components/Switch/index.d.ts +18 -36
  26. package/build/components/Switch/index.d.ts.map +1 -1
  27. package/build/components/TextInput/index.d.ts +25 -2
  28. package/build/components/TextInput/index.d.ts.map +1 -1
  29. package/build/src/types.d.ts +13 -0
  30. package/build/src/types.d.ts.map +1 -0
  31. package/components/BottomSheet/index.ios.tsx +34 -0
  32. package/components/BottomSheet/index.tsx +12 -0
  33. package/components/Button/index.tsx +26 -8
  34. package/components/ContextMenu/index.android.tsx +72 -0
  35. package/components/ContextMenu/index.tsx +73 -30
  36. package/components/DatePicker/index.tsx +7 -8
  37. package/components/Picker/index.tsx +32 -19
  38. package/components/Progress/index.tsx +1 -1
  39. package/components/Section/index.tsx +6 -1
  40. package/components/Slider/index.tsx +19 -10
  41. package/components/Switch/index.tsx +37 -54
  42. package/components/TextInput/index.tsx +31 -4
  43. package/ios/BottomSheetView.swift +82 -0
  44. package/ios/ContextMenu/ContextMenu.swift +65 -2
  45. package/ios/ContextMenu/ContextMenuRecords.swift +6 -0
  46. package/ios/ExpoUIModule.swift +3 -0
  47. package/ios/PickerView.swift +32 -27
  48. package/package.json +3 -6
  49. package/src/types.ts +16 -0
  50. package/tsconfig.json +1 -1
  51. package/build/src/index.d.ts +0 -13
  52. package/build/src/index.d.ts.map +0 -1
  53. package/src/index.ts +0 -22
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Section/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,OAEjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Section/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,OAEjD"}
@@ -1,5 +1,16 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
- import { ViewEvent } from '../../src';
2
+ import { ViewEvent } from '../../src/types';
3
+ /**
4
+ * Colors for slider's core elements.
5
+ * @platform android
6
+ */
7
+ export type SliderElementColors = {
8
+ thumbColor?: string;
9
+ activeTrackColor?: string;
10
+ inactiveTrackColor?: string;
11
+ activeTickColor?: string;
12
+ inactiveTickColor?: string;
13
+ };
3
14
  export type SliderProps = {
4
15
  /**
5
16
  * Custom styles for the slider component.
@@ -11,12 +22,12 @@ export type SliderProps = {
11
22
  */
12
23
  value?: number;
13
24
  /**
14
- * The number of steps between the minimum and maximum values. 0 signifies infinite steps.
25
+ * The number of steps between the minimum and maximum values, `0` signifies infinite steps.
15
26
  * @default 0
16
27
  */
17
28
  steps?: number;
18
29
  /**
19
- * The mininum value of the slider. Updating this value does not trigger callbacks if the current value is below `min`.
30
+ * The minimum value of the slider. Updating this value does not trigger callbacks if the current value is below `min`.
20
31
  * @default 0
21
32
  */
22
33
  min?: number;
@@ -29,13 +40,7 @@ export type SliderProps = {
29
40
  * Colors for slider's core elements.
30
41
  * @platform android
31
42
  */
32
- elementColors?: {
33
- thumbColor?: string;
34
- activeTrackColor?: string;
35
- inactiveTrackColor?: string;
36
- activeTickColor?: string;
37
- inactiveTickColor?: string;
38
- };
43
+ elementColors?: SliderElementColors;
39
44
  /**
40
45
  * Slider color.
41
46
  */
@@ -48,6 +53,9 @@ export type SliderProps = {
48
53
  type NativeSliderProps = Omit<SliderProps, 'onValueChange'> & ViewEvent<'onValueChanged', {
49
54
  value: number;
50
55
  }>;
56
+ /**
57
+ * @hidden
58
+ */
51
59
  export declare function transformSliderProps(props: SliderProps): NativeSliderProps;
52
60
  export declare function Slider(props: SliderProps): import("react").JSX.Element;
53
61
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Slider/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,aAAa,CAAC,EAAE;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GACzD,SAAS,CAAC,gBAAgB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAOjD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAqB1E;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Slider/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GACzD,SAAS,CAAC,gBAAgB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAOjD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAqB1E;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
@@ -1,46 +1,22 @@
1
1
  import { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
2
+ /**
3
+ * Only for switch.
4
+ */
2
5
  type SwitchElementColors = {
3
- /**
4
- * Only for switch.
5
- */
6
6
  checkedThumbColor?: string;
7
- /**
8
- * Only for switch.
9
- */
10
7
  checkedTrackColor?: string;
11
- /**
12
- * Only for switch.
13
- */
14
8
  uncheckedThumbColor?: string;
15
- /**
16
- * Only for switch.
17
- */
18
9
  uncheckedTrackColor?: string;
19
10
  };
11
+ /**
12
+ * Only for checkbox.
13
+ */
20
14
  type CheckboxElementColors = {
21
- /**
22
- * Only for checkbox.
23
- */
24
15
  checkedColor?: string;
25
- /**
26
- * Only for checkbox.
27
- */
28
16
  disabledCheckedColor?: string;
29
- /**
30
- * Only for checkbox.
31
- */
32
17
  uncheckedColor?: string;
33
- /**
34
- * Only for checkbox.
35
- */
36
18
  disabledUncheckedColor?: string;
37
- /**
38
- * Only for checkbox.
39
- */
40
19
  checkmarkColor?: string;
41
- /**
42
- * Only for checkbox.
43
- */
44
20
  disabledIndeterminateColor?: string;
45
21
  };
46
22
  export type SwitchProps = {
@@ -56,7 +32,7 @@ export type SwitchProps = {
56
32
  */
57
33
  label?: string;
58
34
  /**
59
- * Type of the switch component. Can be 'checkbox', 'switch', or 'button'. The 'button' style is iOS only.
35
+ * Type of the switch component. Can be `'checkbox'`, `'switch'`, or `'button'`. The `'button'` style is iOS only.
60
36
  * @default 'switch'
61
37
  */
62
38
  variant?: 'checkbox' | 'switch' | 'button';
@@ -69,32 +45,38 @@ export type SwitchProps = {
69
45
  */
70
46
  style?: StyleProp<ViewStyle>;
71
47
  /**
72
- * Picker color. On iOS it only applies to the `menu` variant.
48
+ * Picker color. On iOS, it only applies to the `menu` variant.
73
49
  */
74
50
  color?: string;
75
- } & ({
51
+ } & (SwitchSwitchVariantProps | SwitchCheckboxVariantProps | SwitchButtonVariantProps);
52
+ export type SwitchSwitchVariantProps = {
76
53
  variant?: 'switch';
77
54
  /**
78
55
  * Colors for switch's core elements.
79
56
  * @platform android
80
57
  */
81
58
  elementColors?: SwitchElementColors;
82
- } | {
59
+ };
60
+ export type SwitchCheckboxVariantProps = {
83
61
  variant: 'checkbox';
84
62
  /**
85
63
  * Colors for checkbox core elements.
86
64
  * @platform android
87
65
  */
88
66
  elementColors?: CheckboxElementColors;
89
- } | {
67
+ };
68
+ export type SwitchButtonVariantProps = {
90
69
  variant: 'button';
91
70
  elementColors?: undefined;
92
- });
71
+ };
93
72
  type NativeSwitchProps = Omit<SwitchProps, 'onValueChange'> & {
94
73
  onValueChange: (event: NativeSyntheticEvent<{
95
74
  value: boolean;
96
75
  }>) => void;
97
76
  };
77
+ /**
78
+ * @hidden
79
+ */
98
80
  export declare function transformSwitchProps(props: SwitchProps): NativeSwitchProps;
99
81
  export declare function Switch(props: SwitchProps): import("react").JSX.Element;
100
82
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Switch/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,KAAK,CAA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AAK,EAAE,oBAAoB,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;CAC1E,CAAC;AAyBF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAU1E;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
@@ -1,5 +1,8 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
- import { ViewEvent } from '../../src';
2
+ import { ViewEvent } from '../../src/types';
3
+ /**
4
+ * @hidden Not used anywhere yet.
5
+ */
3
6
  export type TextInputRole = 'default' | 'cancel' | 'destructive';
4
7
  /**
5
8
  * Props for the TextInput component.
@@ -30,6 +33,27 @@ export type TextInputProps = {
30
33
  numberOfLines?: number;
31
34
  /**
32
35
  * Determines which keyboard to open, e.g., numeric.
36
+ *
37
+ * Types that work on both platforms:
38
+ * - default
39
+ * - numeric
40
+ * - email-address
41
+ * - phone-pad
42
+ * - decimal-pad
43
+ * - ascii-capable
44
+ * - url
45
+ *
46
+ * Types that only work on Android:
47
+ * - password
48
+ * - password-numeric
49
+ *
50
+ * Types that only work on iOS:
51
+ * - numbers-and-punctuation
52
+ * - name-phone-pad
53
+ * - twitter
54
+ * - web-search
55
+ * - ascii-capable-number-pad
56
+ *
33
57
  * @default default
34
58
  */
35
59
  keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'ascii-capable' | 'numbers-and-punctuation' | 'url' | 'name-phone-pad' | 'decimal-pad' | 'twitter' | 'web-search' | 'ascii-capable-number-pad';
@@ -41,7 +65,6 @@ export type TextInputProps = {
41
65
  };
42
66
  export type NativeTextInputProps = Omit<TextInputProps, 'onChangeText'> & {} & ViewEvent<'onValueChanged', {
43
67
  value: string;
44
- eventIndex: number;
45
68
  }>;
46
69
  export declare function TextInput(props: TextInputProps): import("react").JSX.Element;
47
70
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/TextInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EACT,SAAS,GACT,eAAe,GACf,SAAS,GACT,WAAW,GACX,eAAe,GACf,yBAAyB,GACzB,KAAK,GACL,gBAAgB,GAChB,aAAa,GACb,SAAS,GACT,YAAY,GACZ,0BAA0B,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,SAAS,CACpF,gBAAgB,EAChB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CACtC,CAAC;AAiBJ,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAE9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/TextInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,CAAC,EACT,SAAS,GACT,eAAe,GACf,SAAS,GACT,WAAW,GACX,eAAe,GACf,yBAAyB,GACzB,KAAK,GACL,gBAAgB,GAChB,aAAa,GACb,SAAS,GACT,YAAY,GACZ,0BAA0B,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,SAAS,CACpF,gBAAgB,EAChB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAClB,CAAC;AAoBJ,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAE9C"}
@@ -0,0 +1,13 @@
1
+ export type * from '../components/Button';
2
+ export type * from '../components/ContextMenu';
3
+ export type * from '../components/Picker';
4
+ export type * from '../components/Section';
5
+ export type * from '../components/Slider';
6
+ export type * from '../components/Switch';
7
+ /**
8
+ * @hidden
9
+ */
10
+ export type ViewEvent<Name extends string, Data> = Record<Name, Data extends object ? ((event: {
11
+ nativeEvent: Data;
12
+ }) => void) | undefined : (() => void) | undefined>;
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,sBAAsB,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,IAAI,MAAM,CACvD,IAAI,EACJ,IAAI,SAAS,MAAM,GACf,CAAC,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,KAAK,IAAI,CAAC,GAAG,SAAS,GACpD,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAC7B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { Dimensions, NativeSyntheticEvent, View } from 'react-native';
3
+
4
+ import { BottomSheetProps } from '.';
5
+
6
+ type NativeBottomSheetProps = Omit<BottomSheetProps, 'onIsOpenedChange'> & {
7
+ onIsOpenedChange: (event: NativeSyntheticEvent<{ isOpened: boolean }>) => void;
8
+ };
9
+
10
+ const BottomSheetNativeView: React.ComponentType<NativeBottomSheetProps> = requireNativeView(
11
+ 'ExpoUI',
12
+ 'BottomSheetView'
13
+ );
14
+
15
+ export function transformBottomSheetProps(props: BottomSheetProps): NativeBottomSheetProps {
16
+ return {
17
+ ...props,
18
+ onIsOpenedChange: ({ nativeEvent: { isOpened } }) => {
19
+ props?.onIsOpenedChange?.(isOpened);
20
+ },
21
+ };
22
+ }
23
+
24
+ export function BottomSheet(props: BottomSheetProps) {
25
+ const { width } = Dimensions.get('window');
26
+ return (
27
+ <View>
28
+ <BottomSheetNativeView
29
+ style={{ position: 'absolute', width }}
30
+ {...transformBottomSheetProps(props)}
31
+ />
32
+ </View>
33
+ );
34
+ }
@@ -0,0 +1,12 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+
3
+ export type BottomSheetProps = {
4
+ style?: StyleProp<ViewStyle>;
5
+ children: any;
6
+ isOpened: boolean;
7
+ onIsOpenedChange: (isOpened: boolean) => void;
8
+ };
9
+
10
+ export function BottomSheet({ children }: BottomSheetProps) {
11
+ return children;
12
+ }
@@ -2,7 +2,7 @@ import { requireNativeView } from 'expo';
2
2
  import { Platform, StyleProp, StyleSheet, ViewStyle } from 'react-native';
3
3
 
4
4
  import { MaterialIcon } from './types';
5
- import { ViewEvent } from '../../src';
5
+ import { ViewEvent } from '../../src/types';
6
6
 
7
7
  /**
8
8
  * The role of the button.
@@ -15,10 +15,12 @@ export type ButtonRole = 'default' | 'cancel' | 'destructive';
15
15
 
16
16
  /**
17
17
  * The built-in button styles available on iOS and Android.
18
+ *
18
19
  * Common styles:
19
20
  * - `default` - The default system button style.
20
21
  * - `bordered` - A button with a light fill. On Android equivalent to `FilledTonalButton`.
21
22
  * - `borderless` - A button with no background or border. On Android equivalent to `TextButton`.
23
+ *
22
24
  * Apple-only styles:
23
25
  * - `borderedProminent` - A bordered button with a prominent appearance.
24
26
  * - `plain` - A button with no border or background and a less prominent text.
@@ -27,6 +29,7 @@ export type ButtonRole = 'default' | 'cancel' | 'destructive';
27
29
  * - `accessoryBarAction` - A button style for accessory bar actions.
28
30
  * - `card` - A button style for cards.
29
31
  * - `link` - A button style for links.
32
+ *
30
33
  * Android-only styles:
31
34
  * - `outlined` - A button with an outline.
32
35
  * - `elevated` - A filled button with a shadow.
@@ -48,6 +51,17 @@ export type ButtonVariant =
48
51
  | 'outlined'
49
52
  | 'elevated';
50
53
 
54
+ /**
55
+ * Colors for button's core elements.
56
+ * @platform android
57
+ */
58
+ export type ButtonElementColors = {
59
+ containerColor?: string;
60
+ contentColor?: string;
61
+ disabledContainerColor?: string;
62
+ disabledContentColor?: string;
63
+ };
64
+
51
65
  export type ButtonProps = {
52
66
  /**
53
67
  * A callback that is called when the button is pressed.
@@ -55,7 +69,7 @@ export type ButtonProps = {
55
69
  onPress?: () => void;
56
70
  /**
57
71
  * A string describing the system image to display in the button.
58
- * Uses SF Symbols on iOS and Material Icons on Android.
72
+ * Uses Material Icons on Android and SF Symbols on iOS.
59
73
  */
60
74
  systemImage?: {
61
75
  ios?: string;
@@ -82,12 +96,7 @@ export type ButtonProps = {
82
96
  * Colors for button's core elements.
83
97
  * @platform android
84
98
  */
85
- elementColors?: {
86
- containerColor?: string;
87
- contentColor?: string;
88
- disabledContainerColor?: string;
89
- disabledContentColor?: string;
90
- };
99
+ elementColors?: ButtonElementColors;
91
100
  /**
92
101
  * Button color.
93
102
  */
@@ -98,6 +107,9 @@ export type ButtonProps = {
98
107
  disabled?: boolean;
99
108
  };
100
109
 
110
+ /**
111
+ * @hidden
112
+ */
101
113
  export type NativeButtonProps = Omit<
102
114
  ButtonProps,
103
115
  'role' | 'onPress' | 'children' | 'systemImage'
@@ -113,6 +125,9 @@ const ButtonNativeView: React.ComponentType<NativeButtonProps> = requireNativeVi
113
125
  'Button'
114
126
  );
115
127
 
128
+ /**
129
+ * @hidden
130
+ */
116
131
  export function transformButtonProps(props: ButtonProps): NativeButtonProps {
117
132
  const { role, children, onPress, systemImage, ...restProps } = props;
118
133
  return {
@@ -131,6 +146,9 @@ export function transformButtonProps(props: ButtonProps): NativeButtonProps {
131
146
  };
132
147
  }
133
148
 
149
+ /**
150
+ * Displays a native button component.
151
+ */
134
152
  export function Button(props: ButtonProps) {
135
153
  // Min height from https://m3.material.io/components/buttons/specs, minWidth
136
154
  return (
@@ -0,0 +1,72 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { Children, useMemo } from 'react';
3
+ import { NativeSyntheticEvent } from 'react-native';
4
+
5
+ import { ContextMenuProps, EventHandlers, NativeMenuProps } from '.';
6
+ import { transformChildrenToElementArray } from './utils';
7
+
8
+ const MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(
9
+ 'ExpoUI',
10
+ 'ContextMenu'
11
+ );
12
+
13
+ export function Submenu() {
14
+ return <></>;
15
+ }
16
+
17
+ export function Items() {
18
+ return <></>;
19
+ }
20
+ Items.tag = 'Items';
21
+
22
+ export function Trigger(props: { children: React.ReactNode }) {
23
+ return <></>;
24
+ }
25
+ Trigger.tag = 'Trigger';
26
+
27
+ export function Preview(props: { children: React.ReactNode }) {
28
+ return <></>;
29
+ }
30
+
31
+ function ContextMenu(props: ContextMenuProps) {
32
+ const eventHandlersMap: EventHandlers = {};
33
+ const initialChildren = Children.map(
34
+ props.children as any,
35
+ (c: { type: { tag: string }; props: { children: React.ReactNode } }) =>
36
+ c.type.tag === Items.tag ? c.props.children : null
37
+ );
38
+ const processedElements = useMemo(
39
+ () => transformChildrenToElementArray(initialChildren, eventHandlersMap),
40
+ [initialChildren]
41
+ );
42
+
43
+ const activationElement = Children.map(
44
+ props.children as any,
45
+ (c: { type: { tag: string }; props: { children: React.ReactNode } }) =>
46
+ c.type.tag === Trigger.tag ? c.props.children : null
47
+ );
48
+
49
+ const createEventHandler =
50
+ (handlerType: string) => (e: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {
51
+ const handler = eventHandlersMap[e.nativeEvent.contextMenuElementID]?.[handlerType];
52
+ handler?.(e);
53
+ };
54
+
55
+ return (
56
+ <MenuNativeView
57
+ style={props.style}
58
+ elements={processedElements}
59
+ onContextMenuButtonPressed={createEventHandler('onPress')}
60
+ onContextMenuSwitchValueChanged={createEventHandler('onValueChange')}
61
+ onContextMenuPickerOptionSelected={createEventHandler('onOptionSelected')}
62
+ {...props}>
63
+ {activationElement}
64
+ </MenuNativeView>
65
+ );
66
+ }
67
+
68
+ ContextMenu.Trigger = Trigger;
69
+ ContextMenu.Preview = Preview;
70
+ ContextMenu.Items = Items;
71
+
72
+ export { ContextMenu };
@@ -1,11 +1,26 @@
1
1
  import { requireNativeView } from 'expo';
2
- import React, { ReactElement, ReactNode, useMemo } from 'react';
2
+ import { ComponentType, Children, ReactElement, ReactNode, useMemo } from 'react';
3
3
  import { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
4
4
 
5
+ import { MenuElement, transformChildrenToElementArray } from './utils';
5
6
  import { ButtonProps } from '../Button';
6
7
  import { PickerProps } from '../Picker';
7
8
  import { SwitchProps } from '../Switch';
8
- import { MenuElement, transformChildrenToElementArray } from './utils';
9
+
10
+ const MenuNativeView: ComponentType<NativeMenuProps> = requireNativeView(
11
+ 'ExpoUI',
12
+ 'ContextMenu'
13
+ );
14
+
15
+ const MenuNativeTriggerView: ComponentType<object> = requireNativeView(
16
+ 'ExpoUI',
17
+ 'ContextMenuActivationElement'
18
+ );
19
+
20
+ const MenuNativePreviewView: ComponentType<object> = requireNativeView(
21
+ 'ExpoUI',
22
+ 'ContextMenuPreview'
23
+ );
9
24
 
10
25
  type SubmenuElement =
11
26
  | ReactElement<ButtonProps>
@@ -13,18 +28,21 @@ type SubmenuElement =
13
28
  | ReactElement<PickerProps>
14
29
  | ReactElement<SubmenuProps>;
15
30
 
16
- type ContentChildren = SubmenuElement | SubmenuElement[];
17
-
18
31
  export type ContextMenuContentProps = {
19
- children: ContentChildren;
32
+ children: SubmenuElement | SubmenuElement[];
20
33
  };
21
34
 
22
- export type EventHandlers = {
23
- [key: string]: {
24
- [key: string]: (event: NativeSyntheticEvent<any>) => void;
25
- };
26
- };
35
+ /**
36
+ * @hidden
37
+ */
38
+ export type EventHandlers = Record<
39
+ string,
40
+ Record<string, (event: NativeSyntheticEvent<any>) => void>
41
+ >;
27
42
 
43
+ /**
44
+ * @hidden
45
+ */
28
46
  export type ContextMenuElementBase = { contextMenuElementID: string };
29
47
 
30
48
  /**
@@ -38,13 +56,6 @@ export type ActivationMethod = 'singlePress' | 'longPress';
38
56
  * Props of the `ContextMenu` component.
39
57
  */
40
58
  export type ContextMenuProps = {
41
- /**
42
- * Items visible inside the context menu. The items should be wrapped in a `React.Fragment`.
43
- * `Button`, `Switch` and `Submenu` components are supported on both Android and iOS.
44
- * The `Picker` component is supported only on iOS. Remember to use components from the `@expo/ui` library.
45
- */
46
- Items: React.ReactElement<ContextMenuContentProps>;
47
-
48
59
  /**
49
60
  * Determines how the context menu will be activated.
50
61
  *
@@ -78,14 +89,17 @@ export type SubmenuProps = {
78
89
  /**
79
90
  * The button that will be used to expand the submenu. On Android the `text` prop of the `Button` will be used as a section title.
80
91
  */
81
- button: React.ReactElement<ButtonProps>;
92
+ button: ReactElement<ButtonProps>;
82
93
  /**
83
94
  * Children of the submenu. Only `Button`, `Switch`, `Picker` and `Submenu` elements should be used.
84
95
  */
85
- children: React.ReactNode;
96
+ children: ReactNode;
86
97
  };
87
98
 
88
- type NativeMenuProps = ContextMenuProps & {
99
+ /**
100
+ * @hidden
101
+ */
102
+ export type NativeMenuProps = ContextMenuProps & {
89
103
  elements: MenuElement[];
90
104
  onContextMenuButtonPressed: (
91
105
  event: NativeSyntheticEvent<{ contextMenuElementID: string }>
@@ -105,11 +119,6 @@ type NativeMenuProps = ContextMenuProps & {
105
119
  ) => void;
106
120
  };
107
121
 
108
- const MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(
109
- 'ExpoUI',
110
- 'ContextMenu'
111
- );
112
-
113
122
  /**
114
123
  * The `Submenu` component is used to create a nested context menu. Submenus can be infinitely nested.
115
124
  * Android does not support nesting in the context menu. All the submenus will be flat-mapped into a single level with multiple titled sections.
@@ -118,6 +127,30 @@ export function Submenu(props: SubmenuProps) {
118
127
  return <></>;
119
128
  }
120
129
 
130
+ /**
131
+ * Items visible inside the context menu. Pass input components as immidiate children of the tag.
132
+ * `Button`, `Switch` and `Submenu` components are supported on both Android and iOS.
133
+ * The `Picker` component is supported only on iOS. Remember to use components from the `@expo/ui` library.
134
+ */
135
+ export function Items(props: { children: React.ReactNode }) {
136
+ return <></>;
137
+ }
138
+ Items.tag = 'Items';
139
+ /**
140
+ * The component visible all the time that triggers the menu when tapped or long-pressed.
141
+ */
142
+ export function Trigger(props: { children: React.ReactNode }) {
143
+ return <MenuNativeTriggerView {...props} />;
144
+ }
145
+
146
+ /**
147
+ * The component visible above the menu when it is opened.
148
+ * @platform ios
149
+ */
150
+ export function Preview(props: { children: React.ReactNode }) {
151
+ return <MenuNativePreviewView {...props} />;
152
+ }
153
+
121
154
  /**
122
155
  * `ContextMenu` allows you to create a context menu, which can be used to provide additional options to the user.
123
156
  *
@@ -127,18 +160,22 @@ export function Submenu(props: SubmenuProps) {
127
160
  * - Android does not support nesting in the context menu. All the submenus will be flat-mapped into a single level with multiple sections. The `title` prop of the `Button`, which opens the submenu on iOS will be used as a section title.
128
161
  * - Android does not support showing a `Picker` element in the context menu.
129
162
  */
130
- export function ContextMenu(props: ContextMenuProps) {
163
+ function ContextMenu(props: ContextMenuProps) {
131
164
  const eventHandlersMap: EventHandlers = {};
132
- const initialChildren = props.Items.props.children;
165
+ const initialChildren = Children.map(
166
+ props.children as any,
167
+ (c: { type: { tag: string }; props: { children: React.ReactNode } }) =>
168
+ c.type.tag === Items.tag ? c.props.children : null
169
+ );
133
170
  const processedElements = useMemo(
134
171
  () => transformChildrenToElementArray(initialChildren, eventHandlersMap),
135
172
  [initialChildren]
136
173
  );
137
174
 
138
175
  const createEventHandler =
139
- (handlerType: string) => (e: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {
140
- const handler = eventHandlersMap[e.nativeEvent.contextMenuElementID]?.[handlerType];
141
- handler?.(e);
176
+ (handlerType: string) => (event: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {
177
+ const handler = eventHandlersMap[event.nativeEvent.contextMenuElementID]?.[handlerType];
178
+ handler?.(event);
142
179
  };
143
180
 
144
181
  return (
@@ -152,3 +189,9 @@ export function ContextMenu(props: ContextMenuProps) {
152
189
  />
153
190
  );
154
191
  }
192
+
193
+ ContextMenu.Trigger = Trigger;
194
+ ContextMenu.Preview = Preview;
195
+ ContextMenu.Items = Items;
196
+
197
+ export { ContextMenu };