@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.
- package/CHANGELOG.md +22 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AlertDialogView.kt +56 -28
- package/android/src/main/java/expo/modules/ui/BasicAlertDialogView.kt +9 -1
- package/android/src/main/java/expo/modules/ui/CarouselView.kt +93 -67
- package/android/src/main/java/expo/modules/ui/DividerView.kt +21 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +25 -17
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +6 -0
- package/android/src/main/java/expo/modules/ui/PullToRefreshBoxView.kt +20 -3
- package/android/src/main/java/expo/modules/ui/SlotView.kt +8 -0
- package/android/src/main/java/expo/modules/ui/SurfaceView.kt +88 -11
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +15 -3
- package/android/src/main/java/expo/modules/ui/TextView.kt +145 -12
- package/build/jetpack-compose/AlertDialog/index.d.ts +72 -36
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts +7 -2
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Carousel/index.d.ts +86 -23
- package/build/jetpack-compose/Carousel/index.d.ts.map +1 -1
- package/build/jetpack-compose/Divider/index.d.ts +20 -5
- package/build/jetpack-compose/Divider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Progress/index.d.ts +6 -7
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts +34 -9
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts.map +1 -1
- package/build/jetpack-compose/Surface/index.d.ts +52 -2
- package/build/jetpack-compose/Surface/index.d.ts.map +1 -1
- package/build/jetpack-compose/Text/index.d.ts +77 -89
- package/build/jetpack-compose/Text/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextInput/index.d.ts +18 -3
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +2 -2
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +5 -0
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +1 -1
- package/build/types.d.ts +26 -0
- package/build/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- 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
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha512 +1 -0
- 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
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha512 +1 -0
- 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
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/jetpack-compose/AlertDialog/index.tsx +94 -41
- package/src/jetpack-compose/BasicAlertDialog/index.tsx +9 -2
- package/src/jetpack-compose/Card/index.tsx +4 -2
- package/src/jetpack-compose/Carousel/index.tsx +118 -30
- package/src/jetpack-compose/Divider/index.tsx +34 -14
- package/src/jetpack-compose/Progress/index.tsx +11 -9
- package/src/jetpack-compose/PullToRefreshBox/index.tsx +35 -18
- package/src/jetpack-compose/Surface/index.tsx +75 -4
- package/src/jetpack-compose/Text/index.tsx +171 -101
- package/src/jetpack-compose/TextInput/index.tsx +38 -8
- package/src/jetpack-compose/index.ts +2 -2
- package/src/jetpack-compose/modifiers/index.ts +10 -0
- package/src/swift-ui/modifiers/index.ts +1 -1
- package/src/types.ts +27 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +0 -1
- 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 {
|
|
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
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Fling behavior type for controlling carousel snapping.
|
|
18
|
+
*/
|
|
14
19
|
export type FlingBehaviorType = 'singleAdvance' | 'noSnap';
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Shared props across all carousel components.
|
|
23
|
+
*/
|
|
24
|
+
export type CarouselCommonConfig = {
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
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
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Padding for carousel content (dp or object).
|
|
32
|
+
*/
|
|
26
33
|
contentPadding?: number | PaddingValuesRecord;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
58
|
-
|
|
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 {
|
|
4
|
+
import { type ModifierConfig } from '../../types';
|
|
4
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
|
|
6
|
-
export type
|
|
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?:
|
|
19
|
+
modifiers?: ModifierConfig[];
|
|
11
20
|
};
|
|
12
21
|
|
|
13
|
-
|
|
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
|
|
44
|
+
* A horizontal divider line that groups content in lists and layouts,
|
|
45
|
+
* matching Compose's `HorizontalDivider`.
|
|
30
46
|
*/
|
|
31
|
-
export
|
|
32
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
4
|
-
import {
|
|
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
|
|
35
|
+
* Callback that is called when the user pulls to refresh.
|
|
15
36
|
*/
|
|
16
37
|
onRefresh?: () => void;
|
|
17
38
|
/**
|
|
18
|
-
*
|
|
39
|
+
* Alignment of children within the box.
|
|
40
|
+
* @default 'topStart'
|
|
19
41
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
contentAlignment?: ContentAlignment;
|
|
22
43
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @default [align('topCenter'), padding(0, 10, 0, 0)]
|
|
44
|
+
* Configuration for the loading indicator shown during pull-to-refresh.
|
|
25
45
|
*/
|
|
26
|
-
|
|
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
|
-
*
|
|
62
|
-
*
|
|
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
|
|
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?:
|
|
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
|
|