@expo/ui 55.0.4 → 55.0.6

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 (97) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/AlertDialogView.kt +56 -28
  4. package/android/src/main/java/expo/modules/ui/BasicAlertDialogView.kt +9 -1
  5. package/android/src/main/java/expo/modules/ui/CarouselView.kt +93 -67
  6. package/android/src/main/java/expo/modules/ui/DividerView.kt +21 -2
  7. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +25 -17
  8. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +6 -0
  9. package/android/src/main/java/expo/modules/ui/PullToRefreshBoxView.kt +20 -3
  10. package/android/src/main/java/expo/modules/ui/SlotView.kt +8 -0
  11. package/android/src/main/java/expo/modules/ui/SurfaceView.kt +88 -11
  12. package/android/src/main/java/expo/modules/ui/TextInputView.kt +15 -3
  13. package/android/src/main/java/expo/modules/ui/TextView.kt +145 -12
  14. package/build/jetpack-compose/AlertDialog/index.d.ts +72 -36
  15. package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
  16. package/build/jetpack-compose/BasicAlertDialog/index.d.ts +7 -2
  17. package/build/jetpack-compose/BasicAlertDialog/index.d.ts.map +1 -1
  18. package/build/jetpack-compose/Card/index.d.ts.map +1 -1
  19. package/build/jetpack-compose/Carousel/index.d.ts +86 -23
  20. package/build/jetpack-compose/Carousel/index.d.ts.map +1 -1
  21. package/build/jetpack-compose/Divider/index.d.ts +20 -5
  22. package/build/jetpack-compose/Divider/index.d.ts.map +1 -1
  23. package/build/jetpack-compose/Progress/index.d.ts +6 -7
  24. package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
  25. package/build/jetpack-compose/PullToRefreshBox/index.d.ts +34 -9
  26. package/build/jetpack-compose/PullToRefreshBox/index.d.ts.map +1 -1
  27. package/build/jetpack-compose/Surface/index.d.ts +52 -2
  28. package/build/jetpack-compose/Surface/index.d.ts.map +1 -1
  29. package/build/jetpack-compose/Text/index.d.ts +77 -89
  30. package/build/jetpack-compose/Text/index.d.ts.map +1 -1
  31. package/build/jetpack-compose/TextInput/index.d.ts +18 -3
  32. package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
  33. package/build/jetpack-compose/index.d.ts +2 -2
  34. package/build/jetpack-compose/index.d.ts.map +1 -1
  35. package/build/jetpack-compose/modifiers/index.d.ts +5 -0
  36. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  37. package/build/swift-ui/modifiers/index.d.ts +1 -1
  38. package/build/types.d.ts +26 -0
  39. package/build/types.d.ts.map +1 -1
  40. package/expo-module.config.json +1 -1
  41. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4-sources.jar → 55.0.6/expo.modules.ui-55.0.6-sources.jar} +0 -0
  42. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.md5 +1 -0
  43. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha1 +1 -0
  44. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha256 +1 -0
  45. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha512 +1 -0
  46. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar +0 -0
  47. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.md5 +1 -0
  48. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha1 +1 -0
  49. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha256 +1 -0
  50. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha512 +1 -0
  51. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4.module → 55.0.6/expo.modules.ui-55.0.6.module} +22 -22
  52. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.md5 +1 -0
  53. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha1 +1 -0
  54. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha256 +1 -0
  55. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha512 +1 -0
  56. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4.pom → 55.0.6/expo.modules.ui-55.0.6.pom} +1 -1
  57. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.md5 +1 -0
  58. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha1 +1 -0
  59. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha256 +1 -0
  60. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha512 +1 -0
  61. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  62. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  66. package/package.json +2 -2
  67. package/src/jetpack-compose/AlertDialog/index.tsx +94 -41
  68. package/src/jetpack-compose/BasicAlertDialog/index.tsx +9 -2
  69. package/src/jetpack-compose/Card/index.tsx +4 -2
  70. package/src/jetpack-compose/Carousel/index.tsx +118 -30
  71. package/src/jetpack-compose/Divider/index.tsx +34 -14
  72. package/src/jetpack-compose/Progress/index.tsx +11 -9
  73. package/src/jetpack-compose/PullToRefreshBox/index.tsx +35 -18
  74. package/src/jetpack-compose/Surface/index.tsx +75 -4
  75. package/src/jetpack-compose/Text/index.tsx +171 -101
  76. package/src/jetpack-compose/TextInput/index.tsx +38 -8
  77. package/src/jetpack-compose/index.ts +2 -2
  78. package/src/jetpack-compose/modifiers/index.ts +10 -0
  79. package/src/swift-ui/modifiers/index.ts +1 -1
  80. package/src/types.ts +27 -0
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +0 -1
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +0 -1
  83. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +0 -1
  84. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +0 -1
  85. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar +0 -0
  86. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5 +0 -1
  87. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +0 -1
  88. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +0 -1
  89. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512 +0 -1
  90. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +0 -1
  91. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +0 -1
  92. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +0 -1
  93. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512 +0 -1
  94. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +0 -1
  95. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +0 -1
  96. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +0 -1
  97. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512 +0 -1
@@ -1,8 +1,11 @@
1
1
  import { requireNativeView } from 'expo';
2
2
 
3
- import { ExpoModifier } from '../../types';
3
+ import { type ModifierConfig } from '../../types';
4
4
  import { createViewModifierEventListener } from '../modifiers/utils';
5
5
 
6
+ /**
7
+ * Per-side padding values in dp for carousel content.
8
+ */
6
9
  export type PaddingValuesRecord = {
7
10
  start?: number;
8
11
  top?: number;
@@ -10,50 +13,135 @@ export type PaddingValuesRecord = {
10
13
  bottom?: number;
11
14
  };
12
15
 
13
- export type CarouselVariant = 'multiBrowse' | 'unconstrained';
16
+ /**
17
+ * Fling behavior type for controlling carousel snapping.
18
+ */
14
19
  export type FlingBehaviorType = 'singleAdvance' | 'noSnap';
15
20
 
16
- export type CarouselProps = {
21
+ /**
22
+ * Shared props across all carousel components.
23
+ */
24
+ export type CarouselCommonConfig = {
17
25
  /**
18
- * Modifiers for the component.
26
+ * Spacing between items in dp.
27
+ * @default 0
19
28
  */
20
- modifiers?: ExpoModifier[];
21
- /** Carousel variant */
22
- variant?: CarouselVariant;
23
- /** Spacing between items (dp) */
24
29
  itemSpacing?: number;
25
- /** Padding for carousel content (dp or object) */
30
+ /**
31
+ * Padding for carousel content (dp or object).
32
+ */
26
33
  contentPadding?: number | PaddingValuesRecord;
27
- /** Minimum small item width (dp) */
28
- minSmallItemWidth?: number;
29
- /** Maximum small item width (dp) */
30
- maxSmallItemWidth?: number;
31
- /** Fling behavior type */
34
+ /**
35
+ * Controls snapping behavior when the user flings the carousel.
36
+ * `'singleAdvance'` snaps to the next item, `'noSnap'` allows free scrolling.
37
+ */
32
38
  flingBehavior?: FlingBehaviorType;
33
- /** Preferred item width (dp) for multiBrowse variant */
34
- preferredItemWidth?: number;
35
- /** Item width (dp) for unconstrained variant */
36
- itemWidth?: number;
37
- /** Children to render */
39
+ /**
40
+ * Whether the user can scroll the carousel.
41
+ * @default true
42
+ */
43
+ userScrollEnabled?: boolean;
44
+ /**
45
+ * Modifiers for the component.
46
+ */
47
+ modifiers?: ModifierConfig[];
48
+ /**
49
+ * Children to render as carousel items.
50
+ */
38
51
  children: React.ReactNode;
39
52
  };
40
53
 
41
- type NativeCarouselProps = CarouselProps;
42
-
43
- const CarouselNativeView: React.ComponentType<NativeCarouselProps> = requireNativeView(
44
- 'ExpoUI',
45
- 'CarouselView'
46
- );
47
-
48
- export function transformCarouselProps(props: CarouselProps): NativeCarouselProps {
54
+ function transformProps<T extends { modifiers?: ModifierConfig[] }>(props: T): T {
49
55
  const { modifiers, ...restProps } = props;
50
56
  return {
51
57
  modifiers,
52
58
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
53
59
  ...restProps,
54
- };
60
+ } as T;
55
61
  }
56
62
 
57
- export function Carousel(props: CarouselProps) {
58
- return <CarouselNativeView {...transformCarouselProps(props)} />;
63
+ function createCarouselComponent<P extends { modifiers?: ModifierConfig[] }>(
64
+ viewName: string
65
+ ): React.ComponentType<P> {
66
+ const NativeView: React.ComponentType<P> = requireNativeView('ExpoUI', viewName);
67
+ return function CarouselComponent(props: P) {
68
+ return <NativeView {...transformProps(props)} />;
69
+ };
59
70
  }
71
+
72
+ // region HorizontalCenteredHeroCarousel
73
+
74
+ export type HorizontalCenteredHeroCarouselProps = CarouselCommonConfig & {
75
+ /**
76
+ * Maximum width of the hero item in dp.
77
+ * When unspecified, the hero item will be as wide as possible.
78
+ */
79
+ maxItemWidth?: number;
80
+ /**
81
+ * Minimum width of small peek items in dp.
82
+ * @default CarouselDefaults.MinSmallItemSize
83
+ */
84
+ minSmallItemWidth?: number;
85
+ /**
86
+ * Maximum width of small peek items in dp.
87
+ * @default CarouselDefaults.MaxSmallItemSize
88
+ */
89
+ maxSmallItemWidth?: number;
90
+ };
91
+
92
+ /**
93
+ * A hero carousel that centers one large item between two small peek items,
94
+ * matching Compose's `HorizontalCenteredHeroCarousel`.
95
+ */
96
+ export const HorizontalCenteredHeroCarousel =
97
+ createCarouselComponent<HorizontalCenteredHeroCarouselProps>(
98
+ 'HorizontalCenteredHeroCarouselView'
99
+ );
100
+
101
+ // endregion
102
+
103
+ // region HorizontalMultiBrowseCarousel
104
+
105
+ export type HorizontalMultiBrowseCarouselProps = CarouselCommonConfig & {
106
+ /**
107
+ * The preferred width of the large item in dp.
108
+ */
109
+ preferredItemWidth: number;
110
+ /**
111
+ * Minimum width of small peek items in dp.
112
+ * @default CarouselDefaults.MinSmallItemSize
113
+ */
114
+ minSmallItemWidth?: number;
115
+ /**
116
+ * Maximum width of small peek items in dp.
117
+ * @default CarouselDefaults.MaxSmallItemSize
118
+ */
119
+ maxSmallItemWidth?: number;
120
+ };
121
+
122
+ /**
123
+ * A carousel that shows a large item alongside smaller peek items,
124
+ * matching Compose's `HorizontalMultiBrowseCarousel`.
125
+ */
126
+ export const HorizontalMultiBrowseCarousel =
127
+ createCarouselComponent<HorizontalMultiBrowseCarouselProps>('HorizontalMultiBrowseCarouselView');
128
+
129
+ // endregion
130
+
131
+ // region HorizontalUncontainedCarousel
132
+
133
+ export type HorizontalUncontainedCarouselProps = CarouselCommonConfig & {
134
+ /**
135
+ * The width of each item in dp.
136
+ */
137
+ itemWidth: number;
138
+ };
139
+
140
+ /**
141
+ * A carousel where each item has a fixed width with free-form scrolling,
142
+ * matching Compose's `HorizontalUncontainedCarousel`.
143
+ */
144
+ export const HorizontalUncontainedCarousel =
145
+ createCarouselComponent<HorizontalUncontainedCarouselProps>('HorizontalUncontainedCarouselView');
146
+
147
+ // endregion
@@ -1,22 +1,25 @@
1
1
  import { requireNativeView } from 'expo';
2
+ import { type ColorValue } from 'react-native';
2
3
 
3
- import { ExpoModifier } from '../../types';
4
+ import { type ModifierConfig } from '../../types';
4
5
  import { createViewModifierEventListener } from '../modifiers/utils';
5
6
 
6
- export type DividerProps = {
7
+ export type DividerCommonConfig = {
8
+ /**
9
+ * Thickness of the divider line. Accepts dp values; use `StyleSheet.hairlineWidth` for a single-pixel line.
10
+ */
11
+ thickness?: number;
12
+ /**
13
+ * Color of the divider line.
14
+ */
15
+ color?: ColorValue;
7
16
  /**
8
17
  * Modifiers for the component.
9
18
  */
10
- modifiers?: ExpoModifier[];
19
+ modifiers?: ModifierConfig[];
11
20
  };
12
21
 
13
- type NativeDividerProps = DividerProps;
14
- const DividerNativeView: React.ComponentType<NativeDividerProps> = requireNativeView(
15
- 'ExpoUI',
16
- 'DividerView'
17
- );
18
-
19
- function transformProps(props: DividerProps): NativeDividerProps {
22
+ function transformProps(props: DividerCommonConfig): DividerCommonConfig {
20
23
  const { modifiers, ...restProps } = props;
21
24
  return {
22
25
  modifiers,
@@ -25,9 +28,26 @@ function transformProps(props: DividerProps): NativeDividerProps {
25
28
  };
26
29
  }
27
30
 
31
+ function createDividerComponent(viewName: string): React.ComponentType<DividerCommonConfig> {
32
+ const NativeView: React.ComponentType<DividerCommonConfig> = requireNativeView(
33
+ 'ExpoUI',
34
+ viewName
35
+ );
36
+ function Component(props: DividerCommonConfig) {
37
+ return <NativeView {...transformProps(props)} />;
38
+ }
39
+ Component.displayName = viewName;
40
+ return Component;
41
+ }
42
+
28
43
  /**
29
- * A visual element that can be used to separate other content.
44
+ * A horizontal divider line that groups content in lists and layouts,
45
+ * matching Compose's `HorizontalDivider`.
30
46
  */
31
- export function Divider(props: DividerProps) {
32
- return <DividerNativeView {...transformProps(props)} />;
33
- }
47
+ export const HorizontalDivider = createDividerComponent('HorizontalDividerView');
48
+
49
+ /**
50
+ * A vertical divider line that groups content in layouts,
51
+ * matching Compose's `VerticalDivider`.
52
+ */
53
+ export const VerticalDivider = createDividerComponent('VerticalDividerView');
@@ -12,7 +12,7 @@ export type StrokeCap = 'round' | 'butt' | 'square';
12
12
  /**
13
13
  * Common props shared by all progress indicator variants.
14
14
  */
15
- type BaseProgressProps = {
15
+ export type ProgressCommonConfig = {
16
16
  /**
17
17
  * The current progress value between `0` and `1`. Omit for indeterminate.
18
18
  */
@@ -31,7 +31,7 @@ type BaseProgressProps = {
31
31
  modifiers?: ModifierConfig[];
32
32
  };
33
33
 
34
- function transformProps<T extends BaseProgressProps>(props: T): T {
34
+ function transformProps<T extends ProgressCommonConfig>(props: T): T {
35
35
  const { modifiers, ...restProps } = props;
36
36
  return {
37
37
  modifiers,
@@ -40,13 +40,15 @@ function transformProps<T extends BaseProgressProps>(props: T): T {
40
40
  } as T;
41
41
  }
42
42
 
43
- function createProgressComponent<P extends BaseProgressProps>(
43
+ function createProgressComponent<P extends ProgressCommonConfig>(
44
44
  viewName: string
45
45
  ): React.ComponentType<P> {
46
46
  const NativeView: React.ComponentType<P> = requireNativeView('ExpoUI', viewName);
47
- return function ProgressComponent(props: P) {
47
+ function Component(props: P) {
48
48
  return <NativeView {...transformProps(props)} />;
49
- };
49
+ }
50
+ Component.displayName = viewName;
51
+ return Component;
50
52
  }
51
53
 
52
54
  // region LinearProgressIndicator
@@ -70,7 +72,7 @@ export type DrawStopIndicatorConfig = {
70
72
  stopSize?: number;
71
73
  };
72
74
 
73
- export type LinearProgressIndicatorProps = BaseProgressProps & {
75
+ export type LinearProgressIndicatorProps = ProgressCommonConfig & {
74
76
  /**
75
77
  * Stroke cap style for the indicator ends.
76
78
  * @default 'round'
@@ -99,7 +101,7 @@ export const LinearProgressIndicator = createProgressComponent<LinearProgressInd
99
101
 
100
102
  // region CircularProgressIndicator
101
103
 
102
- export type CircularProgressIndicatorProps = BaseProgressProps & {
104
+ export type CircularProgressIndicatorProps = ProgressCommonConfig & {
103
105
  /**
104
106
  * Width of the circular stroke in dp.
105
107
  */
@@ -128,7 +130,7 @@ export const CircularProgressIndicator = createProgressComponent<CircularProgres
128
130
 
129
131
  // region LinearWavyProgressIndicator
130
132
 
131
- export type LinearWavyProgressIndicatorProps = BaseProgressProps & {
133
+ export type LinearWavyProgressIndicatorProps = ProgressCommonConfig & {
132
134
  /**
133
135
  * Size of the stop indicator in dp at the end of the determinate progress track.
134
136
  */
@@ -147,7 +149,7 @@ export const LinearWavyProgressIndicator =
147
149
 
148
150
  // region CircularWavyProgressIndicator
149
151
 
150
- export type CircularWavyProgressIndicatorProps = BaseProgressProps;
152
+ export type CircularWavyProgressIndicatorProps = ProgressCommonConfig;
151
153
 
152
154
  /**
153
155
  * A circular progress indicator with wavy animation style.
@@ -1,9 +1,30 @@
1
1
  import { requireNativeView } from 'expo';
2
+ import { type ColorValue } from 'react-native';
2
3
 
3
- import { type ViewEvent, type ExpoModifier } from '../../types';
4
- import { align } from '../modifiers';
4
+ import { type ViewEvent, type ModifierConfig } from '../../types';
5
+ import { type ContentAlignment } from '../layout-types';
5
6
  import { createViewModifierEventListener } from '../modifiers/utils';
6
7
 
8
+ /**
9
+ * Configuration for the loading indicator shown during pull-to-refresh.
10
+ */
11
+ export type PullToRefreshIndicatorProps = {
12
+ /**
13
+ * Color of the loading indicator spinner.
14
+ * @default MaterialTheme.colorScheme.primary
15
+ */
16
+ color?: ColorValue;
17
+ /**
18
+ * Background color of the loading indicator container.
19
+ * @default MaterialTheme.colorScheme.surfaceContainerHigh
20
+ */
21
+ containerColor?: ColorValue;
22
+ /**
23
+ * Modifiers for the loading indicator.
24
+ */
25
+ modifiers?: ModifierConfig[];
26
+ };
27
+
7
28
  export type PullToRefreshBoxProps = {
8
29
  /**
9
30
  * Whether the content is refreshing.
@@ -11,20 +32,22 @@ export type PullToRefreshBoxProps = {
11
32
  */
12
33
  isRefreshing?: boolean;
13
34
  /**
14
- * Callback to call when the content is refreshed.
35
+ * Callback that is called when the user pulls to refresh.
15
36
  */
16
37
  onRefresh?: () => void;
17
38
  /**
18
- * Modifiers for the component.
39
+ * Alignment of children within the box.
40
+ * @default 'topStart'
19
41
  */
20
- modifiers?: ExpoModifier[];
21
-
42
+ contentAlignment?: ContentAlignment;
22
43
  /**
23
- * Modifiers for the loading indicator.
24
- * @default [align('topCenter'), padding(0, 10, 0, 0)]
44
+ * Configuration for the loading indicator shown during pull-to-refresh.
25
45
  */
26
- loadingIndicatorModifiers?: ExpoModifier[];
27
-
46
+ indicator?: PullToRefreshIndicatorProps;
47
+ /**
48
+ * Modifiers for the component.
49
+ */
50
+ modifiers?: ModifierConfig[];
28
51
  /**
29
52
  * The content to refresh.
30
53
  */
@@ -40,11 +63,6 @@ const NativePullToRefreshBoxView: React.ComponentType<NativePullToRefreshBoxProp
40
63
  function transformProps(props: PullToRefreshBoxProps): NativePullToRefreshBoxProps {
41
64
  const { isRefreshing, modifiers, onRefresh, ...restProps } = props;
42
65
 
43
- const loadingIndicatorModifiers = props.loadingIndicatorModifiers ?? [
44
- align('topCenter'),
45
- // padding(0, 10, 0, 0),
46
- ];
47
-
48
66
  return {
49
67
  modifiers,
50
68
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
@@ -53,13 +71,12 @@ function transformProps(props: PullToRefreshBoxProps): NativePullToRefreshBoxPro
53
71
  onRefresh: () => {
54
72
  onRefresh?.();
55
73
  },
56
- loadingIndicatorModifiers,
57
74
  };
58
75
  }
59
76
 
60
77
  /**
61
- * Renders a `PullToRefreshBox` component.
62
- * A box that allows the user to pull down to refresh the content.
78
+ * A pull-to-refresh container that wraps scrollable content and shows a refresh indicator when pulled,
79
+ * matching Compose's `PullToRefreshBox`.
63
80
  */
64
81
  export function PullToRefreshBox(props: PullToRefreshBoxProps) {
65
82
  return <NativePullToRefreshBoxView {...transformProps(props)} />;
@@ -2,9 +2,26 @@ import { requireNativeView } from 'expo';
2
2
  import React from 'react';
3
3
  import { type ColorValue } from 'react-native';
4
4
 
5
- import { type ExpoModifier } from '../../types';
5
+ import { type ViewEvent, type ModifierConfig } from '../../types';
6
+ import { parseJSXShape, ShapeJSXElement, type ShapeRecordProps } from '../Shape';
6
7
  import { createViewModifierEventListener } from '../modifiers/utils';
7
8
 
9
+ /**
10
+ * Border stroke configuration.
11
+ */
12
+ export type SurfaceBorder = {
13
+ /**
14
+ * Border width in dp.
15
+ * @default 1
16
+ */
17
+ width?: number;
18
+ /**
19
+ * Border color.
20
+ * @default MaterialTheme.colorScheme.outline
21
+ */
22
+ color?: ColorValue;
23
+ };
24
+
8
25
  export type SurfaceProps = {
9
26
  /**
10
27
  * The content to display inside the surface.
@@ -33,13 +50,58 @@ export type SurfaceProps = {
33
50
  * @default 0
34
51
  */
35
52
  shadowElevation?: number;
53
+ /**
54
+ * Shape configuration for clipping the surface.
55
+ */
56
+ shape?: ShapeJSXElement;
57
+ /**
58
+ * Border stroke drawn around the surface.
59
+ */
60
+ border?: SurfaceBorder;
61
+
62
+ /**
63
+ * Whether the surface is enabled and responds to user interaction.
64
+ *
65
+ * @default true
66
+ */
67
+ enabled?: boolean;
68
+
69
+ /**
70
+ * Whether the surface is in a selected state. When provided together with `onClick`,
71
+ * the surface becomes a selectable surface that visually reflects its selection state.
72
+ */
73
+ selected?: boolean;
74
+
75
+ /**
76
+ * Whether the surface is in a checked (toggled on) state. When provided together with
77
+ * `onCheckedChange`, the surface becomes a toggleable surface.
78
+ */
79
+ checked?: boolean;
80
+
81
+ /**
82
+ * Called when the surface is clicked. Providing this callback makes the surface clickable.
83
+ * When combined with `selected`, the surface becomes a selectable variant.
84
+ */
85
+ onClick?: () => void;
86
+
87
+ /**
88
+ * Called when the checked state of a toggleable surface changes.
89
+ * Providing this callback together with `checked` enables the toggleable variant.
90
+ */
91
+ onCheckedChange?: (checked: boolean) => void;
92
+
36
93
  /**
37
94
  * Modifiers for the component.
38
95
  */
39
- modifiers?: ExpoModifier[];
96
+ modifiers?: ModifierConfig[];
40
97
  };
41
98
 
42
- type NativeSurfaceProps = SurfaceProps;
99
+ type NativeSurfaceProps = Omit<SurfaceProps, 'onClick' | 'onCheckedChange' | 'shape'> &
100
+ ViewEvent<'onSurfaceClick', void> &
101
+ ViewEvent<'onCheckedChange', { value: boolean }> & {
102
+ clickable?: boolean;
103
+ shape?: ShapeRecordProps;
104
+ };
43
105
 
44
106
  const SurfaceNativeView: React.ComponentType<NativeSurfaceProps> = requireNativeView(
45
107
  'ExpoUI',
@@ -47,11 +109,20 @@ const SurfaceNativeView: React.ComponentType<NativeSurfaceProps> = requireNative
47
109
  );
48
110
 
49
111
  function transformProps(props: SurfaceProps): NativeSurfaceProps {
50
- const { modifiers, ...restProps } = props;
112
+ const { modifiers, onClick, onCheckedChange, shape, ...restProps } = props;
113
+
51
114
  return {
52
115
  modifiers,
53
116
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
54
117
  ...restProps,
118
+ clickable: !!onClick,
119
+ shape: parseJSXShape(shape),
120
+ onSurfaceClick: onClick ? () => onClick() : undefined,
121
+ onCheckedChange: onCheckedChange
122
+ ? (e: { nativeEvent: { value: boolean } }) => {
123
+ onCheckedChange(e.nativeEvent.value);
124
+ }
125
+ : undefined,
55
126
  };
56
127
  }
57
128