@expo/ui 57.0.19 → 57.0.21

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 (83) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/HostView.kt +6 -4
  4. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +11 -3
  5. package/android/src/main/java/expo/modules/ui/SemanticsModifier.kt +2 -1
  6. package/build/jetpack-compose/colors.d.ts.map +1 -1
  7. package/build/jetpack-compose/modifiers/index.d.ts +15 -3
  8. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  9. package/build/swift-ui/Toolbar/index.d.ts +50 -0
  10. package/build/swift-ui/Toolbar/index.d.ts.map +1 -1
  11. package/build/swift-ui/modifiers/index.d.ts +15 -1
  12. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  13. package/build/swift-ui/modifiers/presentationModifiers.d.ts +8 -0
  14. package/build/swift-ui/modifiers/presentationModifiers.d.ts.map +1 -1
  15. package/build/universal/State.android.d.ts +1 -3
  16. package/build/universal/State.android.d.ts.map +1 -1
  17. package/build/universal/State.d.ts +2 -3
  18. package/build/universal/State.d.ts.map +1 -1
  19. package/build/universal/State.ios.d.ts +1 -3
  20. package/build/universal/State.ios.d.ts.map +1 -1
  21. package/build/universal/transformStyle.ios.d.ts.map +1 -1
  22. package/build/universal/types.d.ts +24 -0
  23. package/build/universal/types.d.ts.map +1 -1
  24. package/expo-module.config.json +1 -1
  25. package/ios/Convertibles/ToolbarItemPlacementOptions.swift +110 -0
  26. package/ios/Convertibles/ToolbarItemVisibilityPriorityOptions.swift +35 -0
  27. package/ios/Modifiers/PresentationModifiers.swift +10 -0
  28. package/ios/Modifiers/ScrollEdgeEffectStyleModifier.swift +34 -0
  29. package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
  30. package/ios/ToolbarView.swift +88 -4
  31. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.19/expo.modules.ui-57.0.19-sources.jar → 57.0.21/expo.modules.ui-57.0.21-sources.jar} +0 -0
  32. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21-sources.jar.md5 +1 -0
  33. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21-sources.jar.sha1 +1 -0
  34. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21-sources.jar.sha256 +1 -0
  35. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21-sources.jar.sha512 +1 -0
  36. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.aar +0 -0
  37. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.aar.md5 +1 -0
  38. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.aar.sha1 +1 -0
  39. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.aar.sha256 +1 -0
  40. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.aar.sha512 +1 -0
  41. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.19/expo.modules.ui-57.0.19.module → 57.0.21/expo.modules.ui-57.0.21.module} +22 -22
  42. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.module.md5 +1 -0
  43. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.module.sha1 +1 -0
  44. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.module.sha256 +1 -0
  45. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.module.sha512 +1 -0
  46. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.19/expo.modules.ui-57.0.19.pom → 57.0.21/expo.modules.ui-57.0.21.pom} +1 -1
  47. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.pom.md5 +1 -0
  48. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.pom.sha1 +1 -0
  49. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.pom.sha256 +1 -0
  50. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.21/expo.modules.ui-57.0.21.pom.sha512 +1 -0
  51. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  52. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  53. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  54. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  55. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  56. package/package.json +4 -4
  57. package/src/jetpack-compose/colors.ts +23 -1
  58. package/src/jetpack-compose/modifiers/index.ts +16 -1
  59. package/src/swift-ui/Toolbar/index.tsx +79 -0
  60. package/src/swift-ui/modifiers/index.ts +19 -0
  61. package/src/swift-ui/modifiers/presentationModifiers.ts +10 -0
  62. package/src/universal/State.android.ts +1 -1
  63. package/src/universal/State.ios.ts +1 -1
  64. package/src/universal/State.ts +12 -4
  65. package/src/universal/transformStyle.ios.ts +5 -2
  66. package/src/universal/types.ts +27 -0
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19-sources.jar.md5 +0 -1
  68. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19-sources.jar.sha1 +0 -1
  69. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19-sources.jar.sha256 +0 -1
  70. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19-sources.jar.sha512 +0 -1
  71. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.aar +0 -0
  72. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.aar.md5 +0 -1
  73. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.aar.sha1 +0 -1
  74. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.aar.sha256 +0 -1
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.aar.sha512 +0 -1
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.module.md5 +0 -1
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.module.sha1 +0 -1
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.module.sha256 +0 -1
  79. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.module.sha512 +0 -1
  80. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.pom.md5 +0 -1
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.pom.sha1 +0 -1
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.pom.sha256 +0 -1
  83. package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.19/expo.modules.ui-57.0.19.pom.sha512 +0 -1
@@ -18,6 +18,55 @@ export interface ToolbarContentProps {
18
18
  children: React.ReactNode;
19
19
  }
20
20
 
21
+ /**
22
+ * Where an item sits in the toolbar. A placement the current platform or OS version does not
23
+ * offer falls back to `automatic`.
24
+ *
25
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/toolbaritemplacement).
26
+ */
27
+ export type ToolbarItemPlacement =
28
+ | 'automatic'
29
+ | 'principal'
30
+ | 'navigation'
31
+ | 'primaryAction'
32
+ | 'secondaryAction'
33
+ | 'status'
34
+ | 'confirmationAction'
35
+ | 'cancellationAction'
36
+ | 'destructiveAction'
37
+ | 'keyboard'
38
+ | 'topBarLeading'
39
+ | 'topBarTrailing'
40
+ | 'topBarPinnedTrailing'
41
+ | 'largeTitle'
42
+ | 'bottomBar';
43
+
44
+ /**
45
+ * How readily a toolbar item gives up its place when the toolbar runs out of room.
46
+ *
47
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/toolbaritemvisibilitypriority).
48
+ */
49
+ export type ToolbarItemVisibilityPriority = 'automatic' | 'low' | 'high';
50
+
51
+ export interface ToolbarItemProps {
52
+ /**
53
+ * The semantic placement of the item within the toolbar.
54
+ * @default 'automatic'
55
+ */
56
+ placement?: ToolbarItemPlacement;
57
+ /**
58
+ * How readily the item gives up its place. Items overflow lowest priority first. `low` and
59
+ * `high` apply on iOS and macOS.
60
+ * @default 'automatic'
61
+ * @platform ios 27.0+
62
+ */
63
+ visibilityPriority?: ToolbarItemVisibilityPriority;
64
+ /**
65
+ * The content of the item.
66
+ */
67
+ children: React.ReactNode;
68
+ }
69
+
21
70
  const ToolbarNativeView: React.ComponentType<ToolbarProps> = requireNativeView(
22
71
  'ExpoUI',
23
72
  'ToolbarView'
@@ -30,6 +79,36 @@ function ToolbarContent(props: ToolbarContentProps) {
30
79
  return <Slot name="content">{props.children}</Slot>;
31
80
  }
32
81
 
82
+ /**
83
+ * A single item in a toolbar, matching SwiftUI's `ToolbarItem`. Place it inside `Toolbar.Content`
84
+ * to control where the item appears.
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * <Toolbar>
89
+ * <Text>Bird description</Text>
90
+ * <Toolbar.Content>
91
+ * <ToolbarItem placement="topBarTrailing">
92
+ * <Button systemImage="square.and.arrow.up" onPress={share} />
93
+ * </ToolbarItem>
94
+ * </Toolbar.Content>
95
+ * </Toolbar>
96
+ * ```
97
+ *
98
+ * @platform ios
99
+ */
100
+ export function ToolbarItem({
101
+ placement = 'automatic',
102
+ visibilityPriority = 'automatic',
103
+ children,
104
+ }: ToolbarItemProps) {
105
+ return (
106
+ <Slot name="item" extraProps={{ placement, visibilityPriority }}>
107
+ {children}
108
+ </Slot>
109
+ );
110
+ }
111
+
33
112
  /**
34
113
  * Adds a toolbar to the view it wraps, matching SwiftUI's `toolbar(content:)`.
35
114
  *
@@ -816,6 +816,24 @@ export const scrollIndicators = (
816
816
  axes: 'vertical' | 'horizontal' | 'both' = 'both'
817
817
  ) => createModifier('scrollIndicators', { visibility, axes });
818
818
 
819
+ /**
820
+ * Sets the style of the scroll edge effect that a scrollable view shows where its content meets
821
+ * a bar, such as a navigation bar or a toolbar.
822
+ * Mirrors SwiftUI's `scrollEdgeEffectStyle(_:for:)` modifier. On versions before iOS 26 it does
823
+ * nothing.
824
+ * @param style - The style of the effect:
825
+ * - `'automatic'`: the system picks the style.
826
+ * - `'hard'`: a bar with a defined edge separates the content.
827
+ * - `'soft'`: the content fades out gradually, without a defined edge.
828
+ * @param edges - The edges where the style applies. Defaults to `'all'`.
829
+ * @platform ios 26.0+
830
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/scrolledgeeffectstyle(_:for:)).
831
+ */
832
+ export const scrollEdgeEffectStyle = (
833
+ style: 'automatic' | 'hard' | 'soft',
834
+ edges: 'all' | 'top' | 'bottom' | 'leading' | 'trailing' | 'horizontal' | 'vertical' = 'all'
835
+ ) => createModifier('scrollEdgeEffectStyle', { style, edges });
836
+
819
837
  export type UnitPointValue =
820
838
  | 'zero'
821
839
  | 'topLeading'
@@ -1783,6 +1801,7 @@ export type BuiltInModifier =
1783
1801
  | ReturnType<typeof scrollDisabled>
1784
1802
  | ReturnType<typeof scrollClipDisabled>
1785
1803
  | ReturnType<typeof scrollIndicators>
1804
+ | ReturnType<typeof scrollEdgeEffectStyle>
1786
1805
  | ReturnType<typeof defaultScrollAnchor>
1787
1806
  | ReturnType<typeof defaultScrollAnchorForRole>
1788
1807
  | ReturnType<typeof scrollTargetBehavior>
@@ -57,6 +57,16 @@ export const presentationDetents = (
57
57
  export const presentationDragIndicator = (visibility: 'automatic' | 'visible' | 'hidden') =>
58
58
  createModifier('presentationDragIndicator', { visibility });
59
59
 
60
+ /**
61
+ * Sets the corner radius of a sheet presentation.
62
+ * @param cornerRadius - The corner radius in points, or `null` to use the system default.
63
+ * @platform ios 16.4+
64
+ * @platform tvos 16.4+
65
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationcornerradius(_:)).
66
+ */
67
+ export const presentationCornerRadius = (cornerRadius: number | null) =>
68
+ createModifier('presentationCornerRadius', { cornerRadius });
69
+
60
70
  /**
61
71
  * Presentation background interaction type.
62
72
  */
@@ -1,3 +1,3 @@
1
1
  export { useNativeState } from '@expo/ui/jetpack-compose';
2
2
 
3
- export type ObservableState<T> = { value: T };
3
+ export type { ObservableState } from './types';
@@ -1,3 +1,3 @@
1
1
  export { useNativeState } from '@expo/ui/swift-ui';
2
2
 
3
- export type ObservableState<T> = { value: T };
3
+ export type { ObservableState } from './types';
@@ -1,6 +1,8 @@
1
1
  import { useRef, useState } from 'react';
2
2
 
3
- export type ObservableState<T> = { value: T };
3
+ import type { ObservableState } from './types';
4
+
5
+ export type { ObservableState };
4
6
 
5
7
  /**
6
8
  * Web polyfill for the native `useNativeState` hook.
@@ -13,14 +15,20 @@ export function useNativeState<T>(initialValue: T): ObservableState<T> {
13
15
 
14
16
  const stateRef = useRef<ObservableState<T> | null>(null);
15
17
  if (stateRef.current === null) {
18
+ const get = () => valRef.current;
19
+ const set = (v: T) => {
20
+ valRef.current = v;
21
+ setVal(v);
22
+ };
16
23
  stateRef.current = {
17
24
  get value() {
18
- return valRef.current;
25
+ return get();
19
26
  },
20
27
  set value(v: T) {
21
- valRef.current = v;
22
- setVal(v);
28
+ set(v);
23
29
  },
30
+ get,
31
+ set,
24
32
  };
25
33
  }
26
34
  return stateRef.current;
@@ -2,6 +2,7 @@ import {
2
2
  background,
3
3
  border,
4
4
  clipShape,
5
+ contentShape,
5
6
  disabled as disabledMod,
6
7
  font,
7
8
  foregroundStyle,
@@ -15,6 +16,7 @@ import {
15
16
  onTapGesture,
16
17
  opacity,
17
18
  padding,
19
+ shapes,
18
20
  type ModifierConfig,
19
21
  } from '@expo/ui/swift-ui/modifiers';
20
22
 
@@ -154,8 +156,9 @@ export function transformToModifiers(
154
156
  // type. The event, lifecycle, and behavior modifiers below are never dropped.
155
157
  mods = omitUserOverridden(mods, extraModifiers);
156
158
 
157
- // Events
158
- if (props.onPress) mods.push(onTapGesture(props.onPress));
159
+ // Events. SwiftUI only hit-tests drawn content, so the `contentShape` lets
160
+ // taps on empty space (for example a `Spacer` in a `Row`) reach `onPress`.
161
+ if (props.onPress) mods.push(contentShape(shapes.rectangle()), onTapGesture(props.onPress));
159
162
 
160
163
  // Lifecycle
161
164
  if (props.onAppear) mods.push(onAppear(props.onAppear));
@@ -111,3 +111,30 @@ export interface UniversalBaseProps {
111
111
  * @docsInline
112
112
  */
113
113
  export type UniversalAlignment = 'start' | 'center' | 'end';
114
+
115
+ /**
116
+ * Observable state created with `useNativeState`.
117
+ *
118
+ * On Android and iOS, the value is shared with native views. A write from the JavaScript thread
119
+ * is applied on the UI thread asynchronously, so a read right after it may still return the
120
+ * previous value. Writes don't re-render the component that created the state.
121
+ *
122
+ * On web, the value is backed by React state. A write is readable immediately and re-renders the
123
+ * component that created the state.
124
+ */
125
+ export type ObservableState<T> = {
126
+ /**
127
+ * The current value.
128
+ */
129
+ value: T;
130
+
131
+ /**
132
+ * Reads the current value. A React Compiler-compliant alternative to reading `.value`.
133
+ */
134
+ get(): T;
135
+
136
+ /**
137
+ * Writes a new value. A React Compiler-compliant alternative to assigning `.value`.
138
+ */
139
+ set(value: T): void;
140
+ };
@@ -1 +0,0 @@
1
- 6b806f321f975d6caff272f29bc91464e74acbb2
@@ -1 +0,0 @@
1
- 6b32ef025930afd41b632295e3d20bed5d52b29001680721148abc18b7dbf3c8
@@ -1 +0,0 @@
1
- 5cdf850cb3e0dd28112d6a77eead05862cd9d3e5a75b0e1da56a032b872378b05770bc5640f69fc904bd58383e1c4c24933da4702029e6f8dba9f9ab000ef4ac
@@ -1 +0,0 @@
1
- aad7ad5ee2eae34a4143404fa774449f0dc7f6a0
@@ -1 +0,0 @@
1
- 69f99c64824f782c36b1e44617e59fd5f5ddb13f92d906007918534cc8a29dfe
@@ -1 +0,0 @@
1
- d1c36be4bda31ef4d9df2b222c12ab6ee240523984bb7c550ede0186ac99aebb95f31695f76b74a8ad68c34615fa3c0d5ef15ee8c5f58c5e8e90e766a6f4d1d2
@@ -1 +0,0 @@
1
- 3af365b8ed7883f229ea41349e15c062f1ad7a63
@@ -1 +0,0 @@
1
- 2a5b61f7e12f0d930fc4d9704f068ee06ff80ab5375dad6d624d0912cd6506bc
@@ -1 +0,0 @@
1
- 174fdfa60779be5d3f06f40ceb2b5cf3f314a9fb30c86b68cd11d17b8ffd42a998995b7509f8b677ad3055437830bef80747a57e3f5c46e24b37779e552bf29e
@@ -1 +0,0 @@
1
- 65fbef30690fc0cfaa52e3d42c99d013090b4afd
@@ -1 +0,0 @@
1
- b1e83cb5f98577ef5af1bcc23b2b95500ab32360b9d0d26735f4da415377f08c
@@ -1 +0,0 @@
1
- f712b1f0ed7ed5e98076cdc5a01320497ceb7e48189f3de78bff0f2d9614e8d86da72e048e154481b1c9d74a03bbc26a76c2776828509c94731938a7b8728d0b