@expo/ui 1.0.0-canary-20250306-d9d3e02 → 1.0.0-canary-20250331-817737a

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 (62) hide show
  1. package/CHANGELOG.md +7 -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 +1 -1
  11. package/build/components/ContextMenu/index.android.d.ts +23 -0
  12. package/build/components/ContextMenu/index.android.d.ts.map +1 -0
  13. package/build/components/ContextMenu/index.d.ts +54 -20
  14. package/build/components/ContextMenu/index.d.ts.map +1 -1
  15. package/build/components/DatePicker/index.d.ts +6 -6
  16. package/build/components/Label/index.d.ts +28 -0
  17. package/build/components/Label/index.d.ts.map +1 -0
  18. package/build/components/Label/index.ios.d.ts +10 -0
  19. package/build/components/Label/index.ios.d.ts.map +1 -0
  20. package/build/components/List/index.d.ts +87 -0
  21. package/build/components/List/index.d.ts.map +1 -0
  22. package/build/components/List/index.ios.d.ts +9 -0
  23. package/build/components/List/index.ios.d.ts.map +1 -0
  24. package/build/components/Picker/index.d.ts +8 -5
  25. package/build/components/Picker/index.d.ts.map +1 -1
  26. package/build/components/Progress/index.d.ts +1 -1
  27. package/build/components/Section/index.d.ts +10 -2
  28. package/build/components/Section/index.d.ts.map +1 -1
  29. package/build/components/Slider/index.d.ts +5 -2
  30. package/build/components/Slider/index.d.ts.map +1 -1
  31. package/build/components/Switch/index.d.ts +18 -36
  32. package/build/components/Switch/index.d.ts.map +1 -1
  33. package/build/components/TextInput/index.d.ts +24 -1
  34. package/build/components/TextInput/index.d.ts.map +1 -1
  35. package/build/src/types.d.ts +4 -2
  36. package/build/src/types.d.ts.map +1 -1
  37. package/components/BottomSheet/index.ios.tsx +34 -0
  38. package/components/BottomSheet/index.tsx +12 -0
  39. package/components/Button/index.tsx +1 -1
  40. package/components/ContextMenu/index.android.tsx +72 -0
  41. package/components/ContextMenu/index.tsx +67 -33
  42. package/components/DatePicker/index.tsx +6 -6
  43. package/components/Label/index.ios.tsx +16 -0
  44. package/components/Label/index.tsx +34 -0
  45. package/components/List/index.ios.tsx +35 -0
  46. package/components/List/index.tsx +99 -0
  47. package/components/Picker/index.tsx +8 -5
  48. package/components/Progress/index.tsx +1 -1
  49. package/components/Section/index.tsx +10 -2
  50. package/components/Slider/index.tsx +5 -2
  51. package/components/Switch/index.tsx +37 -54
  52. package/components/TextInput/index.tsx +30 -3
  53. package/ios/BottomSheetView.swift +82 -0
  54. package/ios/ContextMenu/ContextMenu.swift +65 -2
  55. package/ios/ContextMenu/ContextMenuRecords.swift +6 -0
  56. package/ios/ExpoUIModule.swift +5 -0
  57. package/ios/Label.swift +24 -0
  58. package/ios/List.swift +122 -0
  59. package/ios/PickerView.swift +32 -27
  60. package/ios/SectionView.swift +1 -1
  61. package/package.json +3 -4
  62. package/src/types.ts +4 -2
@@ -1,8 +1,16 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
2
  export type SectionProps = {
3
- style?: StyleProp<ViewStyle>;
4
- title: string;
3
+ /**
4
+ * @note On iOS, section titles are usually capitalized for consistency with platform conventions.
5
+ */
6
+ title?: string;
5
7
  children: any;
8
+ style?: StyleProp<ViewStyle>;
6
9
  };
10
+ /**
11
+ * Section component uses the native [Section](https://developer.apple.com/documentation/swiftui/section) component.
12
+ * It has no intrinsic dimensions, so it needs explicit height or flex set to display content (like ScrollView).
13
+ * @platform ios
14
+ */
7
15
  export declare function Section({ children }: SectionProps): any;
8
16
  //# sourceMappingURL=index.d.ts.map
@@ -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;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,OAEjD"}
@@ -22,12 +22,12 @@ export type SliderProps = {
22
22
  */
23
23
  value?: number;
24
24
  /**
25
- * 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.
26
26
  * @default 0
27
27
  */
28
28
  steps?: number;
29
29
  /**
30
- * 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`.
31
31
  * @default 0
32
32
  */
33
33
  min?: number;
@@ -53,6 +53,9 @@ export type SliderProps = {
53
53
  type NativeSliderProps = Omit<SliderProps, 'onValueChange'> & ViewEvent<'onValueChanged', {
54
54
  value: number;
55
55
  }>;
56
+ /**
57
+ * @hidden
58
+ */
56
59
  export declare function transformSliderProps(props: SliderProps): NativeSliderProps;
57
60
  export declare function Slider(props: SliderProps): import("react").JSX.Element;
58
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,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,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAq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E,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,CA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AwB,GAAG;IACrC,OAAO,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG;IAC5D,aAAa,EAAE,CAAC,KAAK,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
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,iBAAiB,CAAC;AAE5C,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"}
@@ -1,9 +1,11 @@
1
- export type * from '../components/Switch';
2
- export type * from '../components/Picker';
3
1
  export type * from '../components/Button';
4
2
  export type * from '../components/ContextMenu';
3
+ export type * from '../components/Picker';
5
4
  export type * from '../components/Section';
6
5
  export type * from '../components/Slider';
6
+ export type * from '../components/Switch';
7
+ export type * from '../components/Label';
8
+ export type * from '../components/List';
7
9
  /**
8
10
  * @hidden
9
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,uBAAuB,CAAC;AAC3C,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"}
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;AAC1C,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC;AAExC;;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
+ }
@@ -69,7 +69,7 @@ export type ButtonProps = {
69
69
  onPress?: () => void;
70
70
  /**
71
71
  * A string describing the system image to display in the button.
72
- * Uses SF Symbols on iOS and Material Icons on Android.
72
+ * Uses Material Icons on Android and SF Symbols on iOS.
73
73
  */
74
74
  systemImage?: {
75
75
  ios?: string;
@@ -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 { 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,23 +28,17 @@ type SubmenuElement =
13
28
  | ReactElement<PickerProps>
14
29
  | ReactElement<SubmenuProps>;
15
30
 
16
- type ContentChildren = SubmenuElement | SubmenuElement[];
17
-
18
- /**
19
- * @hidden
20
- */
21
31
  export type ContextMenuContentProps = {
22
- children: ContentChildren;
32
+ children: SubmenuElement | SubmenuElement[];
23
33
  };
24
34
 
25
35
  /**
26
36
  * @hidden
27
37
  */
28
- export type EventHandlers = {
29
- [key: string]: {
30
- [key: string]: (event: NativeSyntheticEvent<any>) => void;
31
- };
32
- };
38
+ export type EventHandlers = Record<
39
+ string,
40
+ Record<string, (event: NativeSyntheticEvent<any>) => void>
41
+ >;
33
42
 
34
43
  /**
35
44
  * @hidden
@@ -47,13 +56,6 @@ export type ActivationMethod = 'singlePress' | 'longPress';
47
56
  * Props of the `ContextMenu` component.
48
57
  */
49
58
  export type ContextMenuProps = {
50
- /**
51
- * Items visible inside the context menu. The items should be wrapped in a `React.Fragment`.
52
- * `Button`, `Switch` and `Submenu` components are supported on both Android and iOS.
53
- * The `Picker` component is supported only on iOS. Remember to use components from the `@expo/ui` library.
54
- */
55
- Items: React.ReactElement<ContextMenuContentProps>;
56
-
57
59
  /**
58
60
  * Determines how the context menu will be activated.
59
61
  *
@@ -87,14 +89,17 @@ export type SubmenuProps = {
87
89
  /**
88
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.
89
91
  */
90
- button: React.ReactElement<ButtonProps>;
92
+ button: ReactElement<ButtonProps>;
91
93
  /**
92
94
  * Children of the submenu. Only `Button`, `Switch`, `Picker` and `Submenu` elements should be used.
93
95
  */
94
- children: React.ReactNode;
96
+ children: ReactNode;
95
97
  };
96
98
 
97
- type NativeMenuProps = ContextMenuProps & {
99
+ /**
100
+ * @hidden
101
+ */
102
+ export type NativeMenuProps = ContextMenuProps & {
98
103
  elements: MenuElement[];
99
104
  onContextMenuButtonPressed: (
100
105
  event: NativeSyntheticEvent<{ contextMenuElementID: string }>
@@ -114,11 +119,6 @@ type NativeMenuProps = ContextMenuProps & {
114
119
  ) => void;
115
120
  };
116
121
 
117
- const MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(
118
- 'ExpoUI',
119
- 'ContextMenu'
120
- );
121
-
122
122
  /**
123
123
  * The `Submenu` component is used to create a nested context menu. Submenus can be infinitely nested.
124
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.
@@ -127,6 +127,30 @@ export function Submenu(props: SubmenuProps) {
127
127
  return <></>;
128
128
  }
129
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
+
130
154
  /**
131
155
  * `ContextMenu` allows you to create a context menu, which can be used to provide additional options to the user.
132
156
  *
@@ -136,18 +160,22 @@ export function Submenu(props: SubmenuProps) {
136
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.
137
161
  * - Android does not support showing a `Picker` element in the context menu.
138
162
  */
139
- export function ContextMenu(props: ContextMenuProps) {
163
+ function ContextMenu(props: ContextMenuProps) {
140
164
  const eventHandlersMap: EventHandlers = {};
141
- 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
+ );
142
170
  const processedElements = useMemo(
143
171
  () => transformChildrenToElementArray(initialChildren, eventHandlersMap),
144
172
  [initialChildren]
145
173
  );
146
174
 
147
175
  const createEventHandler =
148
- (handlerType: string) => (e: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {
149
- const handler = eventHandlersMap[e.nativeEvent.contextMenuElementID]?.[handlerType];
150
- handler?.(e);
176
+ (handlerType: string) => (event: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {
177
+ const handler = eventHandlersMap[event.nativeEvent.contextMenuElementID]?.[handlerType];
178
+ handler?.(event);
151
179
  };
152
180
 
153
181
  return (
@@ -161,3 +189,9 @@ export function ContextMenu(props: ContextMenuProps) {
161
189
  />
162
190
  );
163
191
  }
192
+
193
+ ContextMenu.Trigger = Trigger;
194
+ ContextMenu.Preview = Preview;
195
+ ContextMenu.Items = Items;
196
+
197
+ export { ContextMenu };
@@ -15,12 +15,12 @@ type DisplayedComponents = 'date' | 'hourAndMinute' | 'dateAndTime';
15
15
  */
16
16
  export type DatePickerProps = {
17
17
  /**
18
- * The intial date to display on the picker.
18
+ * The initial date to display on the picker.
19
19
  */
20
20
  initialDate?: string | null;
21
21
  /**
22
22
  * A title displayed on the picker on iOS.
23
- * @platform iOS
23
+ * @platform ios
24
24
  */
25
25
  title?: string;
26
26
  /**
@@ -29,7 +29,7 @@ export type DatePickerProps = {
29
29
  onDateSelected?: (date: Date) => void;
30
30
  /**
31
31
  * The variant of the picker, which determines its appearance and behavior.
32
- * @platform iOS
32
+ * @platform ios
33
33
  * @default 'automatic'
34
34
  */
35
35
  iosVariant?: IOSVariant;
@@ -42,15 +42,15 @@ export type DatePickerProps = {
42
42
  /**
43
43
  * Show to button to toggle between variants on Android.
44
44
  * @platform android
45
- * @default 'true'
45
+ * @default true
46
46
  */
47
47
  showVariantToggle?: boolean;
48
48
  /**
49
49
  * The components that the picker should display.
50
- * On iOS, you can have a picker that selects both date and time.
51
50
  * On Android, you can have a picker that selects just the date or just the time.
52
51
  * `dateAndTime` is only available on iOS and will result in a date picker on Android.
53
- * @default ['date']
52
+ * On iOS, you can have a picker that selects both date and time.
53
+ * @default 'date'
54
54
  */
55
55
  displayedComponents?: DisplayedComponents;
56
56
  /**
@@ -0,0 +1,16 @@
1
+ import { requireNativeView } from 'expo';
2
+
3
+ import { LabelProps } from '.';
4
+
5
+ const LabelNativeView: React.ComponentType<LabelProps> = requireNativeView('ExpoUI', 'LabelView');
6
+
7
+ /**
8
+ * Renders a native label view, which could be used in a list or section.
9
+ *
10
+ * @param {LabelProps} props - The properties passed to the Label component.
11
+ * @returns {JSX.Element} The rendered native Label component.
12
+ * @platform ios
13
+ */
14
+ export function Label(props: LabelProps) {
15
+ return <LabelNativeView {...props} />;
16
+ }
@@ -0,0 +1,34 @@
1
+ import { StyleProp, Text, ViewStyle } from 'react-native';
2
+
3
+ export type LabelProps = {
4
+ /**
5
+ * The title text to be displayed in the label.
6
+ */
7
+ title?: string;
8
+
9
+ /**
10
+ * The name of the SFSymbol to be displayed in the label.
11
+ */
12
+ systemImage?: string;
13
+
14
+ /**
15
+ * The color of the label icon.
16
+ */
17
+ color?: string;
18
+
19
+ /**
20
+ * Additional styles to apply to the label.
21
+ */
22
+ style?: StyleProp<ViewStyle>;
23
+ };
24
+
25
+ /**
26
+ * Renders a native label view, which could be used in a list or section.
27
+ *
28
+ * @param {LabelProps} props - The properties passed to the Label component.
29
+ * @returns {JSX.Element} The rendered native Label component.
30
+ * @platform ios
31
+ */
32
+ export function Label(props: LabelProps) {
33
+ return <Text>{props.title}</Text>;
34
+ }