@expo/ui 57.0.22 → 57.0.24
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 +25 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +35 -2
- package/android/src/main/java/expo/modules/ui/DateRangePickerView.kt +35 -2
- package/android/src/main/java/expo/modules/ui/HostView.kt +21 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +2 -2
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +124 -17
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +8 -1
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +13 -1
- package/build/community/bottom-sheet/BottomSheet.ios.d.ts.map +1 -1
- package/build/community/datetime-picker/DateTimePicker.android.d.ts.map +1 -1
- package/build/community/menu/MenuView.android.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +38 -0
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DropdownMenu/index.d.ts +8 -1
- package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -1
- package/build/jetpack-compose/RNHostView/index.d.ts +6 -1
- package/build/jetpack-compose/RNHostView/index.d.ts.map +1 -1
- package/build/swift-ui/Chart/index.d.ts +10 -0
- package/build/swift-ui/Chart/index.d.ts.map +1 -1
- package/build/swift-ui/RNHostView.d.ts +7 -2
- package/build/swift-ui/RNHostView.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +1 -0
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/presentationModifiers.d.ts +17 -1
- package/build/swift-ui/modifiers/presentationModifiers.d.ts.map +1 -1
- package/build/swift-ui/modifiers/searchable.d.ts +84 -0
- package/build/swift-ui/modifiers/searchable.d.ts.map +1 -0
- package/build/types.d.ts +27 -0
- package/build/types.d.ts.map +1 -1
- package/build/universal/ListItem/ListItem.android.d.ts.map +1 -1
- package/build/universal/RNHostView/index.d.ts.map +1 -1
- package/build/universal/RNHostView/types.d.ts +9 -4
- package/build/universal/RNHostView/types.d.ts.map +1 -1
- package/build/utils/matchContents.d.ts +11 -0
- package/build/utils/matchContents.d.ts.map +1 -0
- package/expo-module.config.json +1 -1
- package/ios/ChartView.swift +15 -10
- package/ios/Modifiers/PresentationModifiers.swift +20 -4
- package/ios/Modifiers/SearchToolbarBehaviorModifier.swift +35 -0
- package/ios/Modifiers/SearchableModifier.swift +94 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
- package/ios/Picker/PickerView.swift +9 -7
- package/ios/RNHostView.swift +55 -9
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.22/expo.modules.ui-57.0.22-sources.jar → 57.0.24/expo.modules.ui-57.0.24-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.22/expo.modules.ui-57.0.22.module → 57.0.24/expo.modules.ui-57.0.24.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{57.0.22/expo.modules.ui-57.0.22.pom → 57.0.24/expo.modules.ui-57.0.24.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.24/expo.modules.ui-57.0.24.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 +4 -4
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +7 -6
- package/src/community/datetime-picker/DateTimePicker.android.tsx +4 -0
- package/src/community/menu/MenuView.android.tsx +12 -2
- package/src/jetpack-compose/DatePicker/index.tsx +38 -0
- package/src/jetpack-compose/DropdownMenu/index.tsx +12 -1
- package/src/jetpack-compose/RNHostView/index.tsx +17 -6
- package/src/swift-ui/Chart/index.tsx +10 -0
- package/src/swift-ui/RNHostView.tsx +11 -4
- package/src/swift-ui/modifiers/index.ts +1 -0
- package/src/swift-ui/modifiers/presentationModifiers.ts +18 -2
- package/src/swift-ui/modifiers/searchable.ts +107 -0
- package/src/types.ts +28 -0
- package/src/universal/ListItem/ListItem.android.tsx +7 -2
- package/src/universal/RNHostView/index.tsx +9 -4
- package/src/universal/RNHostView/types.ts +6 -4
- package/src/utils/matchContents.ts +14 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha512 +0 -1
|
@@ -4,6 +4,7 @@ import type { LayoutChangeEvent } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { PresentedContentContext, useIsPresentedInOwnWindow } from '../../PresentedContentContext';
|
|
6
6
|
import type { ModifierConfig } from '../../types';
|
|
7
|
+
import { resolveMatchContents } from '../../utils/matchContents';
|
|
7
8
|
import type { PrimitiveBaseProps } from '../layout';
|
|
8
9
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
9
10
|
|
|
@@ -11,10 +12,12 @@ export interface RNHostProps extends PrimitiveBaseProps {
|
|
|
11
12
|
/**
|
|
12
13
|
* When `true`, the RNHost will update its size in the Jetpack Compose view tree to match the children's size.
|
|
13
14
|
* When `false`, the RNHost will use the size of the parent Jetpack Compose View.
|
|
15
|
+
* Pass an object to choose per axis. For example, `{ vertical: true }` takes the width from the
|
|
16
|
+
* parent and the height from the children, so text wraps and grows vertically.
|
|
14
17
|
* Can be only set once on mount.
|
|
15
18
|
* @default false
|
|
16
19
|
*/
|
|
17
|
-
matchContents?: boolean;
|
|
20
|
+
matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
|
|
18
21
|
/**
|
|
19
22
|
* Called on mount and whenever this view's layout in the React Native view tree changes.
|
|
20
23
|
* With `matchContents`, the reported size is the one measured from the hosted view.
|
|
@@ -30,8 +33,10 @@ export interface RNHostProps extends PrimitiveBaseProps {
|
|
|
30
33
|
modifiers?: ModifierConfig[];
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
type NativeRNHostProps = RNHostProps & {
|
|
36
|
+
type NativeRNHostProps = Omit<RNHostProps, 'matchContents'> & {
|
|
34
37
|
layoutRoot: boolean;
|
|
38
|
+
matchContentsHorizontal: boolean;
|
|
39
|
+
matchContentsVertical: boolean;
|
|
35
40
|
/**
|
|
36
41
|
* Internal. Drives the shadow node's content measurement, see
|
|
37
42
|
* `ExpoViewShadowNode::sizesToContent`.
|
|
@@ -44,13 +49,17 @@ const NativeRNHostView: ComponentType<NativeRNHostProps> = requireNativeView(
|
|
|
44
49
|
);
|
|
45
50
|
|
|
46
51
|
function transformProps(props: RNHostProps, layoutRoot: boolean): NativeRNHostProps {
|
|
47
|
-
const { modifiers, ...restProps } = props;
|
|
52
|
+
const { modifiers, matchContents, ...restProps } = props;
|
|
53
|
+
const { horizontal: matchContentsHorizontal, vertical: matchContentsVertical } =
|
|
54
|
+
resolveMatchContents(matchContents);
|
|
48
55
|
return {
|
|
49
56
|
modifiers,
|
|
50
57
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
51
58
|
...restProps,
|
|
52
59
|
layoutRoot,
|
|
53
|
-
|
|
60
|
+
matchContentsHorizontal,
|
|
61
|
+
matchContentsVertical,
|
|
62
|
+
expoInternalSizeFromChildren: matchContentsHorizontal || matchContentsVertical,
|
|
54
63
|
};
|
|
55
64
|
}
|
|
56
65
|
|
|
@@ -61,12 +70,14 @@ export function RNHostView(props: RNHostProps) {
|
|
|
61
70
|
// is what makes a `Pressable` drop its press on the first finger movement.
|
|
62
71
|
const layoutRoot = useIsPresentedInOwnWindow();
|
|
63
72
|
|
|
73
|
+
const nativeProps = transformProps(props, layoutRoot);
|
|
74
|
+
|
|
64
75
|
return (
|
|
65
76
|
<NativeRNHostView
|
|
66
|
-
{...
|
|
77
|
+
{...nativeProps}
|
|
67
78
|
// `matchContents` can only be used once on mount
|
|
68
79
|
// So we force unmount when it changes to prevent unexpected layout
|
|
69
|
-
key={
|
|
80
|
+
key={`${nativeProps.matchContentsHorizontal}-${nativeProps.matchContentsVertical}`}>
|
|
70
81
|
{/* Reset context here so only nearest RNHostView becomes the layout root for its children, and not any other RNHostView above it in the tree. */}
|
|
71
82
|
<PresentedContentContext.Provider value={false}>
|
|
72
83
|
{props.children}
|
|
@@ -102,6 +102,16 @@ export type PieChartStyle = {
|
|
|
102
102
|
* Space between slices in points.
|
|
103
103
|
*/
|
|
104
104
|
angularInset?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Corner radius of each slice in points. On a donut, half the ring's thickness gives fully rounded ends.
|
|
107
|
+
* @default 0
|
|
108
|
+
*/
|
|
109
|
+
cornerRadius?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Opacity of each slice, from 0 to 1.
|
|
112
|
+
* @default 0.8
|
|
113
|
+
*/
|
|
114
|
+
opacity?: number;
|
|
105
115
|
};
|
|
106
116
|
|
|
107
117
|
/**
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import type { LayoutChangeEvent } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { PresentedContentContext, useIsPresentedInOwnWindow } from '../PresentedContentContext';
|
|
5
|
+
import { resolveMatchContents } from '../utils/matchContents';
|
|
5
6
|
|
|
6
7
|
const RNHostNativeView: React.ComponentType<any> = requireNativeView('ExpoUI', 'RNHostView');
|
|
7
8
|
|
|
@@ -10,10 +11,12 @@ export interface RNHostViewProps {
|
|
|
10
11
|
* When `true`, the RNHost will update its size in the React Native view tree to match the
|
|
11
12
|
* children's size.
|
|
12
13
|
* When `false`, the RNHost will use the size of the parent SwiftUI View.
|
|
14
|
+
* Pass an object to choose per axis. For example, `{ vertical: true }` takes the width from the
|
|
15
|
+
* parent and the height from the children, so text wraps and grows vertically.
|
|
13
16
|
* Can be only set once on mount.
|
|
14
17
|
* @default false
|
|
15
18
|
*/
|
|
16
|
-
matchContents?: boolean;
|
|
19
|
+
matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
|
|
17
20
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
18
21
|
/**
|
|
19
22
|
* The RN View to be hosted.
|
|
@@ -21,21 +24,25 @@ export interface RNHostViewProps {
|
|
|
21
24
|
children: React.ReactElement;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
export function RNHostView(props: RNHostViewProps) {
|
|
27
|
+
export function RNHostView({ matchContents, ...props }: RNHostViewProps) {
|
|
25
28
|
// A sheet or popover presents its content in its own view controller, where the React Native
|
|
26
29
|
// surface root is not an ancestor and so touch dispatches don't work.
|
|
27
30
|
// Hosted content there owns its touches and is the origin it is measured from; native reads
|
|
28
31
|
// this one prop for both.
|
|
29
32
|
const layoutRoot = useIsPresentedInOwnWindow();
|
|
33
|
+
const { horizontal: matchContentsHorizontal, vertical: matchContentsVertical } =
|
|
34
|
+
resolveMatchContents(matchContents);
|
|
30
35
|
|
|
31
36
|
return (
|
|
32
37
|
<RNHostNativeView
|
|
33
38
|
{...props}
|
|
34
39
|
layoutRoot={layoutRoot}
|
|
35
|
-
|
|
40
|
+
matchContentsHorizontal={matchContentsHorizontal}
|
|
41
|
+
matchContentsVertical={matchContentsVertical}
|
|
42
|
+
expoInternalSizeFromChildren={matchContentsHorizontal || matchContentsVertical}
|
|
36
43
|
// `matchContents` can only be used once on mount
|
|
37
44
|
// So we force unmount when it changes to prevent unexpected layout
|
|
38
|
-
key={
|
|
45
|
+
key={`${matchContentsHorizontal}-${matchContentsVertical}`}>
|
|
39
46
|
{/* Reset context here so only nearest RNHostView becomes the layout root for its children, and not any other RNHostView above it in the tree. */}
|
|
40
47
|
<PresentedContentContext.Provider value={false}>
|
|
41
48
|
{props.children}
|
|
@@ -1957,6 +1957,7 @@ export * from './presentationModifiers';
|
|
|
1957
1957
|
export * from './environment';
|
|
1958
1958
|
export type { ShapeStyle } from './shapeStyle';
|
|
1959
1959
|
export * from './scrollPosition';
|
|
1960
|
+
export * from './searchable';
|
|
1960
1961
|
export * from './symbolEffect';
|
|
1961
1962
|
export * from './scrollObservation';
|
|
1962
1963
|
export * from './widgets';
|
|
@@ -130,12 +130,28 @@ export const interactiveDismissDisabled = (isDisabled: boolean = true) =>
|
|
|
130
130
|
*/
|
|
131
131
|
export type PresentationSizingType = 'automatic' | 'fitted' | 'form' | 'page';
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Options for the `presentationSizing` modifier.
|
|
135
|
+
*/
|
|
136
|
+
export type PresentationSizingOptions = {
|
|
137
|
+
/**
|
|
138
|
+
* The axes on which the sheet fits its content. An axis that is not set keeps the size from
|
|
139
|
+
* `sizing`. For example, `{ horizontal: false, vertical: true }` fits the height to the content
|
|
140
|
+
* and lets the system choose the width.
|
|
141
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/presentationsizing/fitted(horizontal:vertical:)).
|
|
142
|
+
*/
|
|
143
|
+
fitted?: { horizontal?: boolean; vertical?: boolean };
|
|
144
|
+
};
|
|
145
|
+
|
|
133
146
|
/**
|
|
134
147
|
* Sets the sizing of a sheet presentation.
|
|
135
148
|
* @param sizing - The sizing behavior to apply.
|
|
149
|
+
* @param options - Additional sizing options.
|
|
136
150
|
* @platform ios 18.0+
|
|
137
151
|
* @platform tvos 18.0+
|
|
138
152
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationsizing(_:)).
|
|
139
153
|
*/
|
|
140
|
-
export const presentationSizing = (
|
|
141
|
-
|
|
154
|
+
export const presentationSizing = (
|
|
155
|
+
sizing: PresentationSizingType,
|
|
156
|
+
options?: PresentationSizingOptions
|
|
157
|
+
) => createModifier('presentationSizing', { sizing, ...options });
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createModifier, createModifierWithEventListener } from './createModifier';
|
|
2
|
+
import { getStateId, type ObservableState } from '../../State';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The placement of a search field in a view hierarchy.
|
|
6
|
+
*
|
|
7
|
+
* - `automatic`: SwiftUI places the search field automatically.
|
|
8
|
+
* - `toolbar`: The search field appears in the toolbar. Falls back to `automatic` on tvOS.
|
|
9
|
+
* - `sidebar`: The search field appears in the sidebar of a navigation view. Falls back to
|
|
10
|
+
* `automatic` on tvOS.
|
|
11
|
+
* - `navigationBarDrawer`: The search field appears in the navigation bar. Falls back to
|
|
12
|
+
* `automatic` on macOS and tvOS.
|
|
13
|
+
*/
|
|
14
|
+
export type SearchFieldPlacement = 'automatic' | 'toolbar' | 'sidebar' | 'navigationBarDrawer';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Marks this view as searchable, which configures the display of a search field.
|
|
18
|
+
*
|
|
19
|
+
* @param text - The text to display and edit in the search field. An `ObservableState<string>`
|
|
20
|
+
* created with `useNativeState`.
|
|
21
|
+
* @param options.placement - The preferred placement of the search field within the containing
|
|
22
|
+
* view hierarchy. Defaults to `automatic`.
|
|
23
|
+
* @param options.prompt - The prompt of the search field, which provides users with guidance on
|
|
24
|
+
* what to search for.
|
|
25
|
+
* @param options.onChange - Fires on the JS thread when the user edits or clears the search field.
|
|
26
|
+
* It does not fire for values written from JavaScript.
|
|
27
|
+
*
|
|
28
|
+
* @platform ios
|
|
29
|
+
* @platform tvos
|
|
30
|
+
* @platform macos
|
|
31
|
+
*
|
|
32
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/searchable(text:placement:prompt:)-18a8f).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const query = useNativeState('');
|
|
37
|
+
*
|
|
38
|
+
* <Host>
|
|
39
|
+
* <NavigationStack>
|
|
40
|
+
* <List
|
|
41
|
+
* modifiers={[
|
|
42
|
+
* searchable(query, {
|
|
43
|
+
* prompt: 'Search agents',
|
|
44
|
+
* onChange: (text) => setFilter(text),
|
|
45
|
+
* }),
|
|
46
|
+
* ]}>
|
|
47
|
+
* {rows.map((row) => (
|
|
48
|
+
* <Text key={row.id}>{row.name}</Text>
|
|
49
|
+
* ))}
|
|
50
|
+
* </List>
|
|
51
|
+
* </NavigationStack>
|
|
52
|
+
* </Host>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export const searchable = (
|
|
56
|
+
text: ObservableState<string>,
|
|
57
|
+
options?: {
|
|
58
|
+
placement?: SearchFieldPlacement;
|
|
59
|
+
prompt?: string;
|
|
60
|
+
onChange?: (text: string) => void;
|
|
61
|
+
}
|
|
62
|
+
) => {
|
|
63
|
+
const params = {
|
|
64
|
+
text: getStateId(text),
|
|
65
|
+
placement: options?.placement,
|
|
66
|
+
prompt: options?.prompt,
|
|
67
|
+
};
|
|
68
|
+
const onChange = options?.onChange;
|
|
69
|
+
if (onChange) {
|
|
70
|
+
return createModifierWithEventListener(
|
|
71
|
+
'searchable',
|
|
72
|
+
(event: { text?: string }) => onChange(event?.text ?? ''),
|
|
73
|
+
params
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return createModifier('searchable', params);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The behavior of a search field in a toolbar.
|
|
81
|
+
*
|
|
82
|
+
* - `automatic`: The automatic behavior.
|
|
83
|
+
* - `minimize`: A search toolbar behavior that prefers rendering a search field as a button-like
|
|
84
|
+
* control. Falls back to `automatic` on macOS and tvOS.
|
|
85
|
+
*/
|
|
86
|
+
export type SearchToolbarBehavior = 'automatic' | 'minimize';
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Configures the behavior for search in the toolbar.
|
|
90
|
+
*
|
|
91
|
+
* On iOS below 26.0, the modifier is a no-op.
|
|
92
|
+
*
|
|
93
|
+
* @param behavior - The search field behavior.
|
|
94
|
+
*
|
|
95
|
+
* @platform ios 26.0+
|
|
96
|
+
* @platform tvos 26.0+
|
|
97
|
+
* @platform macos 26.0+
|
|
98
|
+
*
|
|
99
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/searchtoolbarbehavior(_:)).
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* <List modifiers={[searchable(query), searchToolbarBehavior('minimize')]}>
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export const searchToolbarBehavior = (behavior: SearchToolbarBehavior) =>
|
|
107
|
+
createModifier('searchToolbarBehavior', { behavior });
|
package/src/types.ts
CHANGED
|
@@ -50,3 +50,31 @@ export type DialogProperties = {
|
|
|
50
50
|
*/
|
|
51
51
|
decorFitsSystemWindows?: boolean;
|
|
52
52
|
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Properties for the popup window, matching `PopupProperties` in Compose.
|
|
56
|
+
*/
|
|
57
|
+
export type PopupProperties = {
|
|
58
|
+
/**
|
|
59
|
+
* Whether the popup is focusable. When `true`, the popup receives IME events and key presses,
|
|
60
|
+
* such as the back button.
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
focusable?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the popup can be dismissed by pressing the back button. Has no effect when `focusable` is `false`.
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
dismissOnBackPress?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the popup can be dismissed by clicking outside of its bounds.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
dismissOnClickOutside?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the popup window is clipped to the screen boundaries. Set to `false` to let it extend
|
|
76
|
+
* beyond them, which positions the popup accurately.
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
|
+
clippingEnabled?: boolean;
|
|
80
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListItem as ComposeListItem, Text } from '@expo/ui/jetpack-compose';
|
|
2
|
-
import { clickable } from '@expo/ui/jetpack-compose/modifiers';
|
|
2
|
+
import { clickable, testID as testIDModifier } from '@expo/ui/jetpack-compose/modifiers';
|
|
3
3
|
import { Children, type ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
import { extractListItemSlots } from './ListItemSlots';
|
|
@@ -25,6 +25,7 @@ export function ListItem(props: ListItemProps) {
|
|
|
25
25
|
leading: leadingProp,
|
|
26
26
|
trailing: trailingProp,
|
|
27
27
|
supportingText,
|
|
28
|
+
testID,
|
|
28
29
|
modifiers,
|
|
29
30
|
colors,
|
|
30
31
|
} = props;
|
|
@@ -32,7 +33,11 @@ export function ListItem(props: ListItemProps) {
|
|
|
32
33
|
const leading = slots.leading ?? leadingProp;
|
|
33
34
|
const trailing = slots.trailing ?? trailingProp;
|
|
34
35
|
const supporting = slots.supporting ?? supportingText;
|
|
35
|
-
const itemModifiers = [
|
|
36
|
+
const itemModifiers = [
|
|
37
|
+
...(onPress ? [clickable(onPress)] : []),
|
|
38
|
+
...(testID ? [testIDModifier(testID)] : []),
|
|
39
|
+
...(modifiers ?? []),
|
|
40
|
+
];
|
|
36
41
|
|
|
37
42
|
return (
|
|
38
43
|
<ComposeListItem colors={colors} modifiers={itemModifiers.length ? itemModifiers : undefined}>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { StyleSheet, View } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { resolveMatchContents } from '../../utils/matchContents';
|
|
4
4
|
import { useUniversalLifecycle } from '../hooks';
|
|
5
|
+
import type { RNHostViewProps } from './types';
|
|
5
6
|
|
|
6
7
|
const styles = StyleSheet.create({
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
fillWidth: { width: '100%' },
|
|
9
|
+
fillHeight: { height: '100%' },
|
|
10
|
+
fitWidth: { width: 'fit-content' },
|
|
11
|
+
fitHeight: { height: 'fit-content' },
|
|
9
12
|
hidden: { display: 'none' },
|
|
10
13
|
});
|
|
11
14
|
|
|
@@ -23,13 +26,15 @@ export function RNHostView({
|
|
|
23
26
|
onLayout,
|
|
24
27
|
}: RNHostViewProps) {
|
|
25
28
|
useUniversalLifecycle(onAppear, onDisappear);
|
|
29
|
+
const { horizontal, vertical } = resolveMatchContents(matchContents);
|
|
26
30
|
|
|
27
31
|
return (
|
|
28
32
|
<View
|
|
29
33
|
testID={testID}
|
|
30
34
|
onLayout={onLayout}
|
|
31
35
|
style={[
|
|
32
|
-
|
|
36
|
+
horizontal ? styles.fitWidth : styles.fillWidth,
|
|
37
|
+
vertical ? styles.fitHeight : styles.fillHeight,
|
|
33
38
|
style,
|
|
34
39
|
hidden && styles.hidden,
|
|
35
40
|
]}>
|
|
@@ -8,16 +8,18 @@ import type { UniversalBaseProps } from '../types';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface RNHostViewProps extends UniversalBaseProps {
|
|
10
10
|
/**
|
|
11
|
-
* When `true`, the host updates its size in the
|
|
12
|
-
* the children's size. When `false`, the host uses the size of the parent
|
|
13
|
-
*
|
|
11
|
+
* When `true`, the host updates its size in the SwiftUI or Compose view tree to
|
|
12
|
+
* match the children's size. When `false`, the host uses the size of the parent
|
|
13
|
+
* SwiftUI or Compose view. Pass an object to choose per axis. For example,
|
|
14
|
+
* `{ vertical: true }` takes the width from the parent and the height from the
|
|
15
|
+
* children, so text wraps and grows vertically.
|
|
14
16
|
*
|
|
15
17
|
* Can only be set once on mount; changing it remounts the component.
|
|
16
18
|
* @default false
|
|
17
19
|
* @platform android
|
|
18
20
|
* @platform ios
|
|
19
21
|
*/
|
|
20
|
-
matchContents?: boolean;
|
|
22
|
+
matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
|
|
21
23
|
|
|
22
24
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
23
25
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves `RNHostView`'s `matchContents` prop to one flag per axis.
|
|
3
|
+
*/
|
|
4
|
+
export function resolveMatchContents(
|
|
5
|
+
matchContents: boolean | { vertical?: boolean; horizontal?: boolean } | null | undefined
|
|
6
|
+
): { horizontal: boolean; vertical: boolean } {
|
|
7
|
+
if (matchContents != null && typeof matchContents === 'object') {
|
|
8
|
+
return {
|
|
9
|
+
horizontal: matchContents.horizontal ?? false,
|
|
10
|
+
vertical: matchContents.vertical ?? false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return { horizontal: matchContents ?? false, vertical: matchContents ?? false };
|
|
14
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
67ccc30c75819937df5e850cb742a4ba
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b9f56fabf01aea58b15172683c4a748b8dc3cf55
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e1ff6f3760b8699263fd244601e146335a9f853109153f91be6c98d092a9302e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
81d467c2d81c5fb4545160a5b5563fcf0f6eb3fbb191a507382ad6b0abde41d6c5506edc2281c1e98dee29eb2c861856f8e34d4208972a2dbf2b547c77143627
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar
DELETED
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7220f1074490e12c04ff057048d86124
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d581a4836a4dd119bfc57aca7152c5f7a45911b8
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a869c8586462b852b75439dbfeaa7caef538db6eeff7bac5aee0026215a61a06
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.aar.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
34080b16453bc36824a34471ee76e7da22af80c63cc419ea34d8c2e1e562f72f968ce8faefd5672f33a4c899c0cdf85c2e711318d859ba4d4562b7e0a61482d8
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7fb20f1c978e1a0b3d762c0dd5323bf9
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.module.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
14b81e92a813dd3ff42d0b57bc819fe6fe45dbe9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4f7022f3602a1162d857c67860c42f26d80c57f0955e815776e0d69da62a6b89
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f4323dcdf2bd04112993e148d47b98df0245f0679aedb4965f45646c987da2d513b3a312aba6ca5802a411cc07b8260c3b3a944a30da7e4b9c2d2140e9cc0b78
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bf3cc748e5aba7f0faca9af9cae6ca11
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
64719d73cd6c6e4410f220586d1b900553d8636f
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b1893b9a45c11ca23be9b083040c6c8e42e5dbf2f83388fb2ecb46ebb759ef43
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/57.0.22/expo.modules.ui-57.0.22.pom.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2e7e5260dc6cae8eb8555c1614f8e50394413bd3cc98d8c34ffb9831458a6079516da7c302bac741da5f578dac28c7772d1cf5efd111f007f15639876db47768
|