@expo/ui 57.0.11 → 57.0.12

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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +14 -1
  4. package/android/src/main/java/expo/modules/ui/graphics/DrawablePainter.kt +43 -0
  5. package/android/src/main/java/expo/modules/ui/{icon/VectorIconLoader.kt → graphics/ImageLoader.kt} +122 -87
  6. package/android/src/main/java/expo/modules/ui/graphics/ImageSource.kt +28 -0
  7. package/android/src/main/java/expo/modules/ui/{icon → graphics}/ResourceIdHelper.kt +1 -1
  8. package/android/src/main/java/expo/modules/ui/icon/IconView.kt +7 -78
  9. package/android/src/main/java/expo/modules/ui/image/ImageView.kt +136 -0
  10. package/build/jetpack-compose/Image/index.d.ts +107 -0
  11. package/build/jetpack-compose/Image/index.d.ts.map +1 -0
  12. package/build/jetpack-compose/index.d.ts +1 -0
  13. package/build/jetpack-compose/index.d.ts.map +1 -1
  14. package/build/swift-ui/Alert/index.d.ts.map +1 -1
  15. package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
  16. package/build/swift-ui/Overlay/index.d.ts.map +1 -1
  17. package/build/swift-ui/Popover/index.d.ts.map +1 -1
  18. package/build/swift-ui/Slider/index.d.ts.map +1 -1
  19. package/build/swift-ui/modifiers/index.d.ts +16 -8
  20. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  21. package/build/universal/BottomSheet/index.android.d.ts +1 -1
  22. package/build/universal/BottomSheet/index.android.d.ts.map +1 -1
  23. package/build/universal/BottomSheet/index.d.ts +1 -1
  24. package/build/universal/BottomSheet/index.d.ts.map +1 -1
  25. package/build/universal/BottomSheet/index.ios.d.ts +1 -1
  26. package/build/universal/BottomSheet/index.ios.d.ts.map +1 -1
  27. package/build/universal/BottomSheet/types.d.ts +28 -0
  28. package/build/universal/BottomSheet/types.d.ts.map +1 -1
  29. package/build/universal/BottomSheet/utils.d.ts +13 -0
  30. package/build/universal/BottomSheet/utils.d.ts.map +1 -0
  31. package/expo-module.config.json +1 -1
  32. package/ios/Convertibles/PaddingValue.swift +57 -0
  33. package/ios/Modifiers/ViewModifierRegistry.swift +62 -18
  34. package/ios/SliderView.swift +11 -5
  35. package/ios/Toggle/ToggleView.swift +16 -18
  36. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.11/expo.modules.ui-57.0.11-sources.jar → 57.0.12/expo.modules.ui-57.0.12-sources.jar} +0 -0
  37. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12-sources.jar.md5 +1 -0
  38. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12-sources.jar.sha1 +1 -0
  39. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12-sources.jar.sha256 +1 -0
  40. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12-sources.jar.sha512 +1 -0
  41. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.aar +0 -0
  42. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.aar.md5 +1 -0
  43. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.aar.sha1 +1 -0
  44. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.aar.sha256 +1 -0
  45. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.aar.sha512 +1 -0
  46. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.11/expo.modules.ui-57.0.11.module → 57.0.12/expo.modules.ui-57.0.12.module} +22 -22
  47. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.module.md5 +1 -0
  48. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.module.sha1 +1 -0
  49. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.module.sha256 +1 -0
  50. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.module.sha512 +1 -0
  51. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.11/expo.modules.ui-57.0.11.pom → 57.0.12/expo.modules.ui-57.0.12.pom} +1 -1
  52. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.pom.md5 +1 -0
  53. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.pom.sha1 +1 -0
  54. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.pom.sha256 +1 -0
  55. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.12/expo.modules.ui-57.0.12.pom.sha512 +1 -0
  56. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  57. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  58. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  59. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  60. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  61. package/package.json +3 -3
  62. package/src/jetpack-compose/Image/index.tsx +149 -0
  63. package/src/jetpack-compose/index.ts +1 -0
  64. package/src/swift-ui/Alert/index.tsx +1 -0
  65. package/src/swift-ui/ConfirmationDialog/index.tsx +1 -0
  66. package/src/swift-ui/Overlay/index.tsx +1 -0
  67. package/src/swift-ui/Popover/index.tsx +1 -0
  68. package/src/swift-ui/Slider/index.tsx +14 -8
  69. package/src/swift-ui/modifiers/index.ts +16 -8
  70. package/src/universal/BottomSheet/index.android.tsx +13 -2
  71. package/src/universal/BottomSheet/index.ios.tsx +9 -1
  72. package/src/universal/BottomSheet/index.tsx +17 -2
  73. package/src/universal/BottomSheet/types.ts +33 -0
  74. package/src/universal/BottomSheet/utils.ts +35 -0
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11-sources.jar.md5 +0 -1
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11-sources.jar.sha1 +0 -1
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11-sources.jar.sha256 +0 -1
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11-sources.jar.sha512 +0 -1
  79. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.aar +0 -0
  80. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.aar.md5 +0 -1
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.aar.sha1 +0 -1
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.aar.sha256 +0 -1
  83. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.aar.sha512 +0 -1
  84. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.module.md5 +0 -1
  85. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.module.sha1 +0 -1
  86. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.module.sha256 +0 -1
  87. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.module.sha512 +0 -1
  88. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.pom.md5 +0 -1
  89. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.pom.sha1 +0 -1
  90. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.pom.sha256 +0 -1
  91. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.11/expo.modules.ui-57.0.11.pom.sha512 +0 -1
@@ -157,18 +157,26 @@ export const containerRelativeFrame = (params: {
157
157
 
158
158
  /**
159
159
  * Sets padding on a view.
160
- * Supports individual edges or shorthand properties.
160
+ * Supports individual edges or shorthand properties. Every edge accepts a length in points or
161
+ * `'default'` to apply the system default padding to that edge. Edges set by a specific property
162
+ * take precedence over the shorthand ones, and unspecified edges get no padding.
163
+ * Calling it without parameters applies the system default padding to all edges.
161
164
  * @param params - The padding parameters: `top`, `bottom`, `leading`, `trailing`, `horizontal`, `vertical` and `all`.
162
165
  * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/SwiftUI/View/padding(_:_:)).
166
+ * @example
167
+ * ```tsx
168
+ * // The system default padding on top, 12 points on the sides, nothing at the bottom.
169
+ * <Text modifiers={[padding({ top: 'default', horizontal: 12 })]}>Hello</Text>
170
+ * ```
163
171
  */
164
172
  export const padding = (params?: {
165
- top?: number;
166
- bottom?: number;
167
- leading?: number;
168
- trailing?: number;
169
- horizontal?: number;
170
- vertical?: number;
171
- all?: number;
173
+ top?: number | 'default';
174
+ bottom?: number | 'default';
175
+ leading?: number | 'default';
176
+ trailing?: number | 'default';
177
+ horizontal?: number | 'default';
178
+ vertical?: number | 'default';
179
+ all?: number | 'default';
172
180
  }) => createModifier('padding', params);
173
181
 
174
182
  /**
@@ -8,6 +8,7 @@ import {
8
8
  import { useEffect, useRef, useState } from 'react';
9
9
 
10
10
  import type { BottomSheetProps, SnapPoint } from './types';
11
+ import { resolveContentPadding } from './utils';
11
12
 
12
13
  // M3 `ModalBottomSheet` only has partial/expanded states.
13
14
  // Only allow the partial state when the consumer requested a partial-friendly snap point.
@@ -38,6 +39,8 @@ export function BottomSheet({
38
39
  snapPoints,
39
40
  testID,
40
41
  modifiers,
42
+ shouldDismissOnBackPress = true,
43
+ contentPadding,
41
44
  }: BottomSheetProps) {
42
45
  const sheetRef = useRef<ModalBottomSheetRef>(null);
43
46
  const [mount, setMount] = useState(isPresented);
@@ -60,7 +63,15 @@ export function BottomSheet({
60
63
  return null;
61
64
  }
62
65
 
63
- const contentModifiers: ModifierConfig[] = [padding(16, showDragIndicator ? 0 : 16, 16, 0)];
66
+ // When the drag handle is hidden, the default inset adds top padding so content doesn't crop
67
+ // against the top edge of the sheet.
68
+ const { top, bottom, left, right } = resolveContentPadding(contentPadding, {
69
+ top: showDragIndicator ? 0 : 16,
70
+ bottom: 0,
71
+ left: 16,
72
+ right: 16,
73
+ });
74
+ const contentModifiers: ModifierConfig[] = [padding(left, top, right, bottom)];
64
75
  if (shouldFillMaxHeight(snapPoints)) contentModifiers.push(fillMaxHeight());
65
76
  if (testID) contentModifiers.push(testIDModifier(testID));
66
77
 
@@ -71,8 +82,8 @@ export function BottomSheet({
71
82
  onDismissRequest={onDismiss}
72
83
  showDragHandle={showDragIndicator}
73
84
  skipPartiallyExpanded={shouldSkipPartiallyExpanded(snapPoints)}
85
+ properties={{ shouldDismissOnBackPress }}
74
86
  modifiers={modifiers}>
75
- {/* When the drag handle is hidden, add top padding so content doesn't crop against the top edge of the sheet. */}
76
87
  <Column modifiers={contentModifiers}>{children}</Column>
77
88
  </ModalBottomSheet>
78
89
  </Host>
@@ -9,6 +9,7 @@ import {
9
9
  } from '@expo/ui/swift-ui/modifiers';
10
10
 
11
11
  import type { BottomSheetProps, SnapPoint } from './types';
12
+ import { resolveContentPadding } from './utils';
12
13
 
13
14
  function snapPointToDetent(snapPoint: SnapPoint): PresentationDetent {
14
15
  if (snapPoint === 'half') return 'medium';
@@ -24,10 +25,17 @@ export function BottomSheet({
24
25
  snapPoints,
25
26
  testID,
26
27
  modifiers,
28
+ contentPadding,
27
29
  }: BottomSheetProps) {
30
+ const { top, bottom, left, right } = resolveContentPadding(contentPadding, {
31
+ top: 16,
32
+ bottom: 0,
33
+ left: 16,
34
+ right: 16,
35
+ });
28
36
  const presentationModifiers: ModifierConfig[] = [
29
37
  frame({ maxWidth: Infinity, alignment: 'topLeading' }),
30
- padding({ top: 16, leading: 16, trailing: 16 }),
38
+ padding({ top, bottom, leading: left, trailing: right }),
31
39
  presentationDragIndicator(showDragIndicator ? 'visible' : 'hidden'),
32
40
  ];
33
41
  if (snapPoints && snapPoints.length > 0) {
@@ -2,6 +2,7 @@ import { useColorScheme } from 'react-native';
2
2
  import { Drawer } from 'vaul';
3
3
 
4
4
  import type { BottomSheetProps, SnapPoint } from './types';
5
+ import { resolveContentPadding } from './utils';
5
6
 
6
7
  // Visually-hidden style for the screen-reader-only Drawer.Title.
7
8
  const visuallyHiddenStyle: React.CSSProperties = {
@@ -33,8 +34,15 @@ export function BottomSheet({
33
34
  showDragIndicator = true,
34
35
  snapPoints,
35
36
  testID,
37
+ contentPadding,
36
38
  }: BottomSheetProps) {
37
39
  const isDark = useColorScheme() === 'dark';
40
+ const { top, bottom, left, right } = resolveContentPadding(contentPadding, {
41
+ top: 16,
42
+ bottom: 16,
43
+ left: 16,
44
+ right: 16,
45
+ });
38
46
  const vaulSnapPoints = snapPoints?.length ? snapPoints.map(snapPointToVaul) : undefined;
39
47
  const hasSnapPoints = vaulSnapPoints != null;
40
48
 
@@ -60,7 +68,15 @@ export function BottomSheet({
60
68
  {/* Radix Dialog requires a title for a11y; render visually-hidden. */}
61
69
  <Drawer.Title style={visuallyHiddenStyle}>Bottom sheet</Drawer.Title>
62
70
  {showDragIndicator && <Drawer.Handle />}
63
- <div style={innerStyle} data-testid={testID}>
71
+ <div
72
+ style={{
73
+ ...innerStyle,
74
+ paddingTop: top,
75
+ paddingBottom: bottom,
76
+ paddingLeft: left,
77
+ paddingRight: right,
78
+ }}
79
+ data-testid={testID}>
64
80
  {children}
65
81
  </div>
66
82
  </Drawer.Content>
@@ -99,7 +115,6 @@ const noSnapPointContentStyle: React.CSSProperties = {
99
115
  };
100
116
 
101
117
  const innerStyle: React.CSSProperties = {
102
- padding: 16,
103
118
  overflow: 'auto',
104
119
  };
105
120
 
@@ -15,6 +15,19 @@ import type { ModifierConfig } from '../../types';
15
15
  */
16
16
  export type SnapPoint = 'half' | 'full' | { fraction: number } | { height: number };
17
17
 
18
+ /**
19
+ * Padding between a [`BottomSheet`](#bottomsheet) and its content — a single value applied to every
20
+ * edge, or per-edge values where an edge that is left out is `0`.
21
+ */
22
+ export type BottomSheetContentPadding =
23
+ | number
24
+ | {
25
+ top?: number;
26
+ bottom?: number;
27
+ left?: number;
28
+ right?: number;
29
+ };
30
+
18
31
  /**
19
32
  * Props for the [`BottomSheet`](#bottomsheet) component, a modal sheet that slides up from the bottom of the screen.
20
33
  */
@@ -50,11 +63,31 @@ export interface BottomSheetProps {
50
63
  */
51
64
  snapPoints?: SnapPoint[];
52
65
 
66
+ /**
67
+ * Padding between the sheet and [`children`](#children), in dp on Android, points on iOS, and
68
+ * CSS pixels on web. Pass `0` for content that reaches the sheet's edges.
69
+ *
70
+ * When omitted, each platform keeps the inset it applies by default.
71
+ *
72
+ * @example `contentPadding={0}` — full-bleed content
73
+ * @example `contentPadding={{ top: 8, bottom: 24 }}` — no horizontal inset
74
+ */
75
+ contentPadding?: BottomSheetContentPadding;
76
+
53
77
  /**
54
78
  * Identifier used to locate the component in end-to-end tests.
55
79
  */
56
80
  testID?: string;
57
81
 
82
+ /**
83
+ * Whether pressing the Android hardware back button (or back gesture) dismisses the bottom sheet.
84
+ * When `false`, the back press does not dismiss the sheet (note: the press still does not reach
85
+ * React Native's `BackHandler`).
86
+ * @default true
87
+ * @platform android
88
+ */
89
+ shouldDismissOnBackPress?: boolean;
90
+
58
91
  /**
59
92
  * Platform-specific modifier escape hatch. Pass an array of modifier configs
60
93
  * from `@expo/ui/swift-ui/modifiers` or `@expo/ui/jetpack-compose/modifiers`.
@@ -0,0 +1,35 @@
1
+ import type { BottomSheetContentPadding } from './types';
2
+
3
+ export type ResolvedContentPadding = {
4
+ top: number;
5
+ bottom: number;
6
+ left: number;
7
+ right: number;
8
+ };
9
+
10
+ /**
11
+ * Resolves the `contentPadding` prop against the inset the platform applies when the prop is
12
+ * omitted. A number applies to every edge, and an edge left out of an object is `0`.
13
+ */
14
+ export function resolveContentPadding(
15
+ contentPadding: BottomSheetContentPadding | undefined,
16
+ platformDefault: ResolvedContentPadding
17
+ ): ResolvedContentPadding {
18
+ if (contentPadding == null) {
19
+ return platformDefault;
20
+ }
21
+ if (typeof contentPadding === 'number') {
22
+ return {
23
+ top: contentPadding,
24
+ bottom: contentPadding,
25
+ left: contentPadding,
26
+ right: contentPadding,
27
+ };
28
+ }
29
+ return {
30
+ top: contentPadding.top ?? 0,
31
+ bottom: contentPadding.bottom ?? 0,
32
+ left: contentPadding.left ?? 0,
33
+ right: contentPadding.right ?? 0,
34
+ };
35
+ }
@@ -1 +0,0 @@
1
- ff3268099478cd30644b24d64f739ca622826811
@@ -1 +0,0 @@
1
- 1c278284d86a0c256802d5c4bc4e8780650313dfca9cd372f11270677138f9fb
@@ -1 +0,0 @@
1
- 938426b2ed24a041a9cc2ab04e9fe12fac0bdf6556b6daadc5f14907395625122c9cb4d77e2aae78780413995cedc71c97d59f003da45a702af6328b0f4312d6
@@ -1 +0,0 @@
1
- 89971894361a24c8a79097da2beeb18acde639c8
@@ -1 +0,0 @@
1
- 36d7de508b797671c51d35fc849b3ccee089a15a6bb8852a335d0af13338c78f
@@ -1 +0,0 @@
1
- aaa731134a933ce7a2606140fc2655b2ed4967ca072ed210cd24192ee1316e2aace1d21d5c63660ee67888cdfddf86092f690a5d54767644eb6a40c9e64713f7
@@ -1 +0,0 @@
1
- 65af783c4afe310e5c6ee00745c0c6e5a239b005
@@ -1 +0,0 @@
1
- bee301bdc67401448d4fa2fad75928fba0f9877e339f3ae2dff2c9b9538450e8
@@ -1 +0,0 @@
1
- f5937b1b9255794c9831ba8c1b17efd5137bdeb4b90ac6f7417aa5ab179abea1339efbf406e3dfd38f05809ff1155e3db27b3bbcbee8a25621455dcbbb171a16
@@ -1 +0,0 @@
1
- 62d838ac8861f8481d98555383b063480b6bbb67
@@ -1 +0,0 @@
1
- 2123d3b3693b5a6bb8a826d69eda11510cd012743a02598e45946923ecf2eea6
@@ -1 +0,0 @@
1
- a6b49c57e6bc62137877d821131c05618d0ece33ff76b6ea3c9f5b19c6dbd25fdd832548892906ded177a2fd7888ceeb3e851ec8e997c98b09e041159de7e5fe