@expo/ui 56.0.8 → 56.0.10
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 +35 -1
- package/CLAUDE.md +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +49 -6
- package/android/src/main/java/expo/modules/ui/HorizontalPagerView.kt +97 -16
- package/android/src/main/java/expo/modules/ui/LoadingView.kt +80 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +31 -3
- package/android/src/main/java/expo/modules/ui/SnackbarView.kt +126 -0
- package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +2 -0
- package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +10 -0
- package/assets/keyboard_arrow_down.xml +10 -0
- package/build/State/index.d.ts +6 -0
- package/build/State/index.d.ts.map +1 -0
- package/build/State/useNativeState.d.ts +32 -3
- package/build/State/useNativeState.d.ts.map +1 -1
- package/build/community/bottom-sheet/BottomSheet.ios.d.ts.map +1 -1
- package/build/community/pager-view/PagerView.android.d.ts +7 -0
- package/build/community/pager-view/PagerView.android.d.ts.map +1 -0
- package/build/community/pager-view/PagerView.d.ts +8 -0
- package/build/community/pager-view/PagerView.d.ts.map +1 -0
- package/build/community/pager-view/PagerView.ios.d.ts +15 -0
- package/build/community/pager-view/PagerView.ios.d.ts.map +1 -0
- package/build/community/pager-view/index.d.ts +3 -0
- package/build/community/pager-view/index.d.ts.map +1 -0
- package/build/community/pager-view/types.d.ts +128 -0
- package/build/community/pager-view/types.d.ts.map +1 -0
- package/build/community/segmented-control/vendor/SegmentsSeparators.d.ts.map +1 -1
- package/build/jetpack-compose/HorizontalPager/index.d.ts +27 -0
- package/build/jetpack-compose/HorizontalPager/index.d.ts.map +1 -1
- package/build/jetpack-compose/Host/index.d.ts +1 -0
- package/build/jetpack-compose/Host/index.d.ts.map +1 -1
- package/build/jetpack-compose/LoadingIndicator/index.d.ts +41 -0
- package/build/jetpack-compose/LoadingIndicator/index.d.ts.map +1 -0
- package/build/jetpack-compose/Snackbar/index.d.ts +94 -0
- package/build/jetpack-compose/Snackbar/index.d.ts.map +1 -0
- package/build/jetpack-compose/SyncSwitch/index.d.ts +1 -1
- package/build/jetpack-compose/SyncSwitch/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextField/index.d.ts +1 -1
- package/build/jetpack-compose/TextField/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +3 -2
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +6 -2
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/BottomSheet/index.d.ts +5 -1
- package/build/swift-ui/BottomSheet/index.d.ts.map +1 -1
- package/build/swift-ui/Host/index.d.ts +1 -0
- package/build/swift-ui/Host/index.d.ts.map +1 -1
- package/build/swift-ui/ScrollView/index.d.ts +30 -0
- package/build/swift-ui/ScrollView/index.d.ts.map +1 -1
- package/build/swift-ui/SecureField/index.d.ts +1 -1
- package/build/swift-ui/SecureField/index.d.ts.map +1 -1
- package/build/swift-ui/SyncToggle/index.d.ts +1 -1
- package/build/swift-ui/SyncToggle/index.d.ts.map +1 -1
- package/build/swift-ui/TextField/index.d.ts +1 -1
- package/build/swift-ui/TextField/index.d.ts.map +1 -1
- package/build/swift-ui/index.d.ts +2 -2
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +25 -15
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/scrollObservation.d.ts +52 -0
- package/build/swift-ui/modifiers/scrollObservation.d.ts.map +1 -0
- package/build/swift-ui/modifiers/scrollPosition.d.ts +1 -1
- package/build/swift-ui/modifiers/scrollPosition.d.ts.map +1 -1
- package/build/swift-ui/modifiers/symbolEffect.d.ts +1 -1
- package/build/swift-ui/modifiers/symbolEffect.d.ts.map +1 -1
- package/build/swift-ui/withAnimation.d.ts +26 -0
- package/build/swift-ui/withAnimation.d.ts.map +1 -0
- package/build/universal/BottomSheet/index.android.d.ts +1 -1
- package/build/universal/BottomSheet/index.android.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.d.ts +1 -1
- package/build/universal/BottomSheet/index.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts.map +1 -1
- package/build/universal/BottomSheet/types.d.ts +27 -0
- package/build/universal/BottomSheet/types.d.ts.map +1 -1
- package/build/universal/Checkbox/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.android.d.ts +8 -0
- package/build/universal/Collapsible/index.android.d.ts.map +1 -0
- package/build/universal/Collapsible/index.d.ts +8 -0
- package/build/universal/Collapsible/index.d.ts.map +1 -0
- package/build/universal/Collapsible/index.ios.d.ts +7 -0
- package/build/universal/Collapsible/index.ios.d.ts.map +1 -0
- package/build/universal/Collapsible/types.d.ts +23 -0
- package/build/universal/Collapsible/types.d.ts.map +1 -0
- package/build/universal/Column/index.d.ts.map +1 -1
- package/build/universal/Host/index.d.ts +5 -18
- package/build/universal/Host/index.d.ts.map +1 -1
- package/build/universal/Host/types.d.ts +72 -0
- package/build/universal/Host/types.d.ts.map +1 -0
- package/build/universal/List/index.android.d.ts +9 -0
- package/build/universal/List/index.android.d.ts.map +1 -0
- package/build/universal/List/index.d.ts +8 -0
- package/build/universal/List/index.d.ts.map +1 -0
- package/build/universal/List/index.ios.d.ts +8 -0
- package/build/universal/List/index.ios.d.ts.map +1 -0
- package/build/universal/List/types.d.ts +26 -0
- package/build/universal/List/types.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.android.d.ts +8 -0
- package/build/universal/ListItem/ListItem.android.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.d.ts +9 -0
- package/build/universal/ListItem/ListItem.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.ios.d.ts +8 -0
- package/build/universal/ListItem/ListItem.ios.d.ts.map +1 -0
- package/build/universal/ListItem/ListItemSlots.d.ts +21 -0
- package/build/universal/ListItem/ListItemSlots.d.ts.map +1 -0
- package/build/universal/ListItem/index.d.ts +10 -0
- package/build/universal/ListItem/index.d.ts.map +1 -0
- package/build/universal/ListItem/types.d.ts +59 -0
- package/build/universal/ListItem/types.d.ts.map +1 -0
- package/build/universal/Picker/Picker.android.d.ts +9 -0
- package/build/universal/Picker/Picker.android.d.ts.map +1 -0
- package/build/universal/Picker/Picker.d.ts +8 -0
- package/build/universal/Picker/Picker.d.ts.map +1 -0
- package/build/universal/Picker/Picker.ios.d.ts +9 -0
- package/build/universal/Picker/Picker.ios.d.ts.map +1 -0
- package/build/universal/Picker/PickerItem.d.ts +9 -0
- package/build/universal/Picker/PickerItem.d.ts.map +1 -0
- package/build/universal/Picker/index.d.ts +8 -0
- package/build/universal/Picker/index.d.ts.map +1 -0
- package/build/universal/Picker/types.d.ts +69 -0
- package/build/universal/Picker/types.d.ts.map +1 -0
- package/build/universal/RNHostView/index.android.d.ts +7 -0
- package/build/universal/RNHostView/index.android.d.ts.map +1 -0
- package/build/universal/RNHostView/index.d.ts +7 -0
- package/build/universal/RNHostView/index.d.ts.map +1 -0
- package/build/universal/RNHostView/index.ios.d.ts +7 -0
- package/build/universal/RNHostView/index.ios.d.ts.map +1 -0
- package/build/universal/RNHostView/types.d.ts +23 -0
- package/build/universal/RNHostView/types.d.ts.map +1 -0
- package/build/universal/Switch/index.d.ts.map +1 -1
- package/build/universal/TextInput/index.d.ts.map +1 -1
- package/build/universal/index.d.ts +5 -0
- package/build/universal/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +4 -1
- package/ios/ExpoUIModule.swift +47 -4
- package/ios/HostView.swift +21 -18
- package/ios/Modifiers/AnimationConfig.swift +109 -0
- package/ios/Modifiers/FontModifier.swift +72 -20
- package/ios/Modifiers/ScrollObservationModifiers.swift +107 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +9 -112
- package/ios/State/ObservableState.swift +12 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8-sources.jar → 56.0.10/expo.modules.ui-56.0.10-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.module → 56.0.10/expo.modules.ui-56.0.10.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.pom → 56.0.10/expo.modules.ui-56.0.10.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.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 +7 -3
- package/src/State/index.ts +10 -0
- package/src/State/useNativeState.ts +71 -3
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +0 -17
- package/src/community/pager-view/PagerView.android.tsx +223 -0
- package/src/community/pager-view/PagerView.ios.tsx +267 -0
- package/src/community/pager-view/PagerView.tsx +14 -0
- package/src/community/pager-view/index.tsx +13 -0
- package/src/community/pager-view/types.tsx +137 -0
- package/src/community/picker/Picker.android.tsx +1 -1
- package/src/community/segmented-control/vendor/SegmentsSeparators.tsx +3 -6
- package/src/jetpack-compose/HorizontalPager/index.tsx +89 -18
- package/src/jetpack-compose/Host/index.tsx +1 -0
- package/src/jetpack-compose/LoadingIndicator/index.tsx +91 -0
- package/src/jetpack-compose/Snackbar/index.tsx +135 -0
- package/src/jetpack-compose/SyncSwitch/index.tsx +1 -3
- package/src/jetpack-compose/TextField/index.tsx +1 -4
- package/src/jetpack-compose/index.ts +3 -2
- package/src/jetpack-compose/modifiers/index.ts +5 -2
- package/src/swift-ui/BottomSheet/index.tsx +32 -15
- package/src/swift-ui/Host/index.tsx +1 -0
- package/src/swift-ui/ScrollView/index.tsx +33 -0
- package/src/swift-ui/SecureField/index.tsx +1 -4
- package/src/swift-ui/SyncToggle/index.tsx +1 -3
- package/src/swift-ui/TextField/index.tsx +1 -4
- package/src/swift-ui/index.tsx +2 -3
- package/src/swift-ui/modifiers/index.ts +37 -14
- package/src/swift-ui/modifiers/scrollObservation.ts +80 -0
- package/src/swift-ui/modifiers/scrollPosition.ts +1 -2
- package/src/swift-ui/modifiers/symbolEffect.ts +1 -2
- package/src/swift-ui/withAnimation.ts +71 -0
- package/src/ts-declarations/react-native-web.d.ts +7 -0
- package/src/universal/BottomSheet/index.android.tsx +58 -11
- package/src/universal/BottomSheet/index.ios.tsx +40 -20
- package/src/universal/BottomSheet/index.tsx +49 -4
- package/src/universal/BottomSheet/types.ts +25 -0
- package/src/universal/Checkbox/index.tsx +14 -2
- package/src/universal/Collapsible/index.android.tsx +72 -0
- package/src/universal/Collapsible/index.ios.tsx +16 -0
- package/src/universal/Collapsible/index.tsx +71 -0
- package/src/universal/Collapsible/types.ts +25 -0
- package/src/universal/Column/index.tsx +3 -1
- package/src/universal/Host/index.tsx +9 -10
- package/src/universal/Host/types.ts +70 -0
- package/src/universal/List/index.android.tsx +44 -0
- package/src/universal/List/index.ios.tsx +19 -0
- package/src/universal/List/index.tsx +26 -0
- package/src/universal/List/types.ts +28 -0
- package/src/universal/ListItem/ListItem.android.tsx +52 -0
- package/src/universal/ListItem/ListItem.ios.tsx +58 -0
- package/src/universal/ListItem/ListItem.tsx +77 -0
- package/src/universal/ListItem/ListItemSlots.tsx +66 -0
- package/src/universal/ListItem/index.ts +15 -0
- package/src/universal/ListItem/types.ts +67 -0
- package/src/universal/Picker/Picker.android.tsx +69 -0
- package/src/universal/Picker/Picker.ios.tsx +45 -0
- package/src/universal/Picker/Picker.tsx +52 -0
- package/src/universal/Picker/PickerItem.tsx +27 -0
- package/src/universal/Picker/index.ts +11 -0
- package/src/universal/Picker/types.ts +79 -0
- package/src/universal/RNHostView/index.android.tsx +33 -0
- package/src/universal/RNHostView/index.ios.tsx +12 -0
- package/src/universal/RNHostView/index.tsx +39 -0
- package/src/universal/RNHostView/types.ts +25 -0
- package/src/universal/Switch/index.tsx +7 -2
- package/src/universal/TextInput/index.tsx +12 -2
- package/src/universal/index.ts +5 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha512 +0 -1
- package/src/community/bottom-sheet/CLAUDE.md +0 -55
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { StyleSheet, unstable_createElement, type ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { extractPickerItems } from './PickerItem';
|
|
5
|
+
import type { PickerItemValue, PickerProps } from './types';
|
|
6
|
+
|
|
7
|
+
const Select = (props: Omit<ComponentProps<'select'>, 'style'> & { style?: ViewProps['style'] }) =>
|
|
8
|
+
unstable_createElement('select', props);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A single-selection input.
|
|
12
|
+
* Declare options via `<Picker.Item label value />` children.
|
|
13
|
+
*/
|
|
14
|
+
export function Picker<T extends PickerItemValue>({
|
|
15
|
+
selectedValue,
|
|
16
|
+
onValueChange,
|
|
17
|
+
enabled = true,
|
|
18
|
+
children,
|
|
19
|
+
testID,
|
|
20
|
+
}: PickerProps<T>) {
|
|
21
|
+
const items = extractPickerItems<T>(children);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Select
|
|
25
|
+
disabled={!enabled}
|
|
26
|
+
value={String(selectedValue)}
|
|
27
|
+
onChange={(e) => {
|
|
28
|
+
const index = e.target.selectedIndex;
|
|
29
|
+
const item = items[index];
|
|
30
|
+
if (item) onValueChange(item.value);
|
|
31
|
+
}}
|
|
32
|
+
style={styles.select}
|
|
33
|
+
data-testid={testID}>
|
|
34
|
+
{items.map((item) => (
|
|
35
|
+
<option key={String(item.value)} value={String(item.value)}>
|
|
36
|
+
{item.label}
|
|
37
|
+
</option>
|
|
38
|
+
))}
|
|
39
|
+
</Select>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const styles = StyleSheet.create({
|
|
44
|
+
select: {
|
|
45
|
+
fontFamily:
|
|
46
|
+
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
margin: 0,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export * from './types';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Children, isValidElement, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ExtractedPickerItem, PickerItemProps, PickerItemValue } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Data-only option marker for [`Picker`](#picker).
|
|
7
|
+
* Used via the compound API: `<Picker.Item label="…" value={…} />`.
|
|
8
|
+
*/
|
|
9
|
+
export function PickerItem<T extends PickerItemValue>(_props: PickerItemProps<T>): null {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Walk `<Picker>` children and extract each `<Picker.Item>`'s props.
|
|
14
|
+
// Non-`PickerItem` children are ignored.
|
|
15
|
+
export function extractPickerItems<T extends PickerItemValue>(
|
|
16
|
+
children: ReactNode
|
|
17
|
+
): ExtractedPickerItem<T>[] {
|
|
18
|
+
return Children.toArray(children)
|
|
19
|
+
.filter(
|
|
20
|
+
(child): child is ReactElement<PickerItemProps<T>> =>
|
|
21
|
+
isValidElement(child) && child.type === PickerItem
|
|
22
|
+
)
|
|
23
|
+
.map((child) => ({
|
|
24
|
+
label: child.props.label,
|
|
25
|
+
value: child.props.value,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Picker as PickerBase } from './Picker';
|
|
2
|
+
import { PickerItem } from './PickerItem';
|
|
3
|
+
import type { PickerItemProps, PickerItemValue } from './types';
|
|
4
|
+
|
|
5
|
+
const Picker = PickerBase as typeof PickerBase & {
|
|
6
|
+
Item: <T extends PickerItemValue>(props: PickerItemProps<T>) => null;
|
|
7
|
+
};
|
|
8
|
+
Picker.Item = PickerItem;
|
|
9
|
+
|
|
10
|
+
export { Picker };
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The type of values a [`Picker.Item`](#pickeritem) can carry.
|
|
5
|
+
*/
|
|
6
|
+
export type PickerItemValue = string | number;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Visual appearance of the picker.
|
|
10
|
+
*
|
|
11
|
+
* - `'menu'` — Compact button that opens a popup/dropdown on tap.
|
|
12
|
+
* Cross-platform default.
|
|
13
|
+
* - `'wheel'` — Scrollable rotor UI that's always visible inline.
|
|
14
|
+
* iOS only; on Android and web this falls back to the platform's default dropdown.
|
|
15
|
+
*/
|
|
16
|
+
export type PickerAppearance = 'wheel' | 'menu';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props for the [`Picker.Item`](#pickeritem) component.
|
|
20
|
+
* A data-only marker used to declare options inside a [`Picker`](#picker).
|
|
21
|
+
*/
|
|
22
|
+
export interface PickerItemProps<T extends PickerItemValue = PickerItemValue> {
|
|
23
|
+
/**
|
|
24
|
+
* Display text for this option.
|
|
25
|
+
*/
|
|
26
|
+
label: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Value passed to `onValueChange` when this option is selected.
|
|
30
|
+
*/
|
|
31
|
+
value: T;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for the [`Picker`](#picker) component, a single-selection input.
|
|
36
|
+
*/
|
|
37
|
+
export interface PickerProps<T extends PickerItemValue = PickerItemValue> {
|
|
38
|
+
/**
|
|
39
|
+
* The currently selected value.
|
|
40
|
+
* Must match the `value` of one of the `<Picker.Item>` children.
|
|
41
|
+
*/
|
|
42
|
+
selectedValue: T;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Called when the user selects an option.
|
|
46
|
+
*/
|
|
47
|
+
onValueChange: (value: T) => void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Visual appearance of the picker.
|
|
51
|
+
* See [`PickerAppearance`](#pickerappearance).
|
|
52
|
+
* @default 'menu'
|
|
53
|
+
*/
|
|
54
|
+
appearance?: PickerAppearance;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether the picker accepts input.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `<Picker.Item>` children that declare the available options.
|
|
64
|
+
*/
|
|
65
|
+
children?: ReactNode;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Identifier used to locate the component in end-to-end tests.
|
|
69
|
+
*/
|
|
70
|
+
testID?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Internal: extracted item data from `<Picker.Item>` children.
|
|
75
|
+
*/
|
|
76
|
+
export interface ExtractedPickerItem<T extends PickerItemValue = PickerItemValue> {
|
|
77
|
+
label: string;
|
|
78
|
+
value: T;
|
|
79
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RNHostView as ComposeRNHostView } from '@expo/ui/jetpack-compose';
|
|
2
|
+
|
|
3
|
+
import { transformToModifiers } from '../transformStyle';
|
|
4
|
+
import type { RNHostViewProps } from './types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hosts React Native views inside Jetpack Compose views.
|
|
8
|
+
*/
|
|
9
|
+
export function RNHostView({
|
|
10
|
+
children,
|
|
11
|
+
matchContents,
|
|
12
|
+
style,
|
|
13
|
+
onAppear,
|
|
14
|
+
onDisappear,
|
|
15
|
+
disabled,
|
|
16
|
+
hidden,
|
|
17
|
+
testID,
|
|
18
|
+
modifiers: extraModifiers,
|
|
19
|
+
}: RNHostViewProps) {
|
|
20
|
+
const modifiers = transformToModifiers(
|
|
21
|
+
style,
|
|
22
|
+
{ onAppear, onDisappear, disabled, hidden, testID },
|
|
23
|
+
extraModifiers
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ComposeRNHostView matchContents={matchContents} modifiers={modifiers}>
|
|
28
|
+
{children}
|
|
29
|
+
</ComposeRNHostView>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export * from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RNHostView as SwiftUIRNHostView } from '@expo/ui/swift-ui';
|
|
2
|
+
|
|
3
|
+
import type { RNHostViewProps } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hosts React Native views inside SwiftUI views.
|
|
7
|
+
*/
|
|
8
|
+
export function RNHostView({ children, matchContents }: RNHostViewProps) {
|
|
9
|
+
return <SwiftUIRNHostView matchContents={matchContents}>{children}</SwiftUIRNHostView>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export * from './types';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { RNHostViewProps } from './types';
|
|
4
|
+
import { useUniversalLifecycle } from '../hooks';
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
fillParent: { width: '100%', height: '100%' },
|
|
8
|
+
matchContents: { width: 'fit-content', height: 'fit-content' },
|
|
9
|
+
hidden: { display: 'none' },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Hosts React Native views inside Jetpack Compose or SwiftUI views.
|
|
14
|
+
*/
|
|
15
|
+
export function RNHostView({
|
|
16
|
+
children,
|
|
17
|
+
style,
|
|
18
|
+
onAppear,
|
|
19
|
+
onDisappear,
|
|
20
|
+
hidden = false,
|
|
21
|
+
testID,
|
|
22
|
+
matchContents = false,
|
|
23
|
+
}: RNHostViewProps) {
|
|
24
|
+
useUniversalLifecycle(onAppear, onDisappear);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View
|
|
28
|
+
testID={testID}
|
|
29
|
+
style={[
|
|
30
|
+
matchContents ? styles.matchContents : styles.fillParent,
|
|
31
|
+
style,
|
|
32
|
+
hidden && styles.hidden,
|
|
33
|
+
]}>
|
|
34
|
+
{children}
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export * from './types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { UniversalBaseProps } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props for the [`RNHostView`](#rnhostview) component.
|
|
7
|
+
*/
|
|
8
|
+
export interface RNHostViewProps extends UniversalBaseProps {
|
|
9
|
+
/**
|
|
10
|
+
* When `true`, the host updates its size in the native view tree to match
|
|
11
|
+
* the children's size. When `false`, the host uses the size of the parent
|
|
12
|
+
* native view.
|
|
13
|
+
*
|
|
14
|
+
* Can only be set once on mount; changing it remounts the component.
|
|
15
|
+
* @default false
|
|
16
|
+
* @platform android
|
|
17
|
+
* @platform ios
|
|
18
|
+
*/
|
|
19
|
+
matchContents?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The React Native view to host.
|
|
23
|
+
*/
|
|
24
|
+
children: ReactElement;
|
|
25
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Switch as RNSwitch, View, Text, StyleSheet } from 'react-native';
|
|
1
|
+
import { Switch as RNSwitch, View, Text, StyleSheet, useColorScheme } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import type { SwitchProps } from './types';
|
|
4
4
|
|
|
@@ -12,16 +12,21 @@ const styles = StyleSheet.create({
|
|
|
12
12
|
disabled: {
|
|
13
13
|
opacity: 0.5,
|
|
14
14
|
},
|
|
15
|
+
darkText: {
|
|
16
|
+
color: '#fff',
|
|
17
|
+
},
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* A toggle control that switches between on and off states.
|
|
19
22
|
*/
|
|
20
23
|
export function Switch({ value, onValueChange, label, disabled = false, testID }: SwitchProps) {
|
|
24
|
+
const isDark = useColorScheme() === 'dark';
|
|
25
|
+
|
|
21
26
|
if (label) {
|
|
22
27
|
return (
|
|
23
28
|
<View style={[styles.view, disabled && styles.disabled]}>
|
|
24
|
-
<Text>{label}</Text>
|
|
29
|
+
<Text style={isDark && styles.darkText}>{label}</Text>
|
|
25
30
|
<RNSwitch value={value} onValueChange={onValueChange} disabled={disabled} testID={testID} />
|
|
26
31
|
</View>
|
|
27
32
|
);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { TextInput as RNTextInput } from 'react-native';
|
|
2
|
+
import { TextInput as RNTextInput, StyleSheet, useColorScheme } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useNativeState } from '../State';
|
|
5
5
|
import type { TextInputProps } from './types';
|
|
6
6
|
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
darkInput: { color: '#fff' },
|
|
9
|
+
});
|
|
10
|
+
|
|
7
11
|
export function TextInput({
|
|
8
12
|
ref,
|
|
9
13
|
value,
|
|
@@ -41,6 +45,7 @@ export function TextInput({
|
|
|
41
45
|
onSelectionChange,
|
|
42
46
|
selectTextOnFocus,
|
|
43
47
|
}: TextInputProps) {
|
|
48
|
+
const isDark = useColorScheme() === 'dark';
|
|
44
49
|
const initialFallbackRef = useRef(defaultValue ?? '');
|
|
45
50
|
const fallback = useNativeState<string>(initialFallbackRef.current);
|
|
46
51
|
const state = value ?? fallback;
|
|
@@ -93,7 +98,12 @@ export function TextInput({
|
|
|
93
98
|
returnKeyType={returnKeyType}
|
|
94
99
|
enterKeyHint={enterKeyHint}
|
|
95
100
|
cursorColor={cursorColor}
|
|
96
|
-
style={[
|
|
101
|
+
style={[
|
|
102
|
+
isDark && styles.darkInput,
|
|
103
|
+
style,
|
|
104
|
+
textStyle,
|
|
105
|
+
textAlign && textAlign !== 'auto' ? { textAlign } : null,
|
|
106
|
+
]}
|
|
97
107
|
onSubmitEditing={onSubmitEditing ? (e) => onSubmitEditing(e.nativeEvent.text) : undefined}
|
|
98
108
|
onFocus={onFocus ? () => onFocus() : undefined}
|
|
99
109
|
onBlur={onBlur ? () => onBlur() : undefined}
|
package/src/universal/index.ts
CHANGED
|
@@ -8,8 +8,13 @@ export * from './Switch';
|
|
|
8
8
|
export * from './Slider';
|
|
9
9
|
export * from './Checkbox';
|
|
10
10
|
export * from './BottomSheet';
|
|
11
|
+
export * from './Collapsible';
|
|
11
12
|
export * from './FieldGroup';
|
|
12
13
|
export * from './Icon';
|
|
14
|
+
export * from './List';
|
|
15
|
+
export * from './ListItem';
|
|
16
|
+
export * from './Picker';
|
|
17
|
+
export * from './RNHostView';
|
|
13
18
|
export * from './Spacer';
|
|
14
19
|
export * from './State';
|
|
15
20
|
export { TextInput, type TextInputProps, type TextInputRef } from './TextInput';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7f944d9b9a5ef111622ffba70c2e3dce
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fed75afc6bc0231fa3cf65ec40bfbbbec4ee7203
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
23ba3e9f955c4fbbc30d2d18e007b303692c56ab229f64092e2a21417c7b6fb3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8e7857cfe9376c2a4fdda8902bdaa2c516b53b38366623f8b474f2dc518b39d7988490e8ef011302ec9443d0e60823ba61dadc4b2a2a836e0c576ee81ab817c8
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7d65df12a162b1158d8d3b62582b8ce9
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2d7e475d6bf490db454783e814b6d7bdf3a3656a
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
16d55d07ff8c3287a906b606ab76bf0e2757895d0cf7777a97588daed1804943
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8111a057a0454d1b10993b2fa75487a3c81d9a991aea915c827f4be17e240bac8114a7e3f7d4403302f97f68e255a52d3348f1cc83529dcba5bcb31b67295542
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2ed0dabca454aed6a93eaaf5149b9688
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
03025ed3157b46b01ba571a909f21eac4feb3a7e
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ab31c528b625bc59841826409dd7bb7cdbc0d5f409ff8dcb190880cec1c1d986
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e559c715dcb00aa217865d1b2633bc4f317bfef47174d2ee9234d17e31869732a44099f5c73d66d93218315e30a1a1249f1198f21b41c1adf25381cbc64b31f1
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
67b190dc510cd26d89740fe8532bc2ba
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a8b115099ec51743ae12b97d7b21cc1d3f91f8ae
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bb1b7c427fd33b05ff5660ecd4d87f5c8c657c22196d808b5c5cb7d5cad63ce2
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1014f718571005419a686ac582920962ece0cbca9e308306868688a483a99935ce2f34ad1f08130f08dc36decf7787e3886bf79848d9409818fd1398d4ec4c17
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# `@expo/ui/community/bottom-sheet`
|
|
2
|
-
|
|
3
|
-
Drop-in replacement for `@gorhom/bottom-sheet` using native platform bottom sheets.
|
|
4
|
-
|
|
5
|
-
## Architecture
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
index.tsx Barrel exports, BottomSheetModal wrapper, BottomSheetView (flex stripping)
|
|
9
|
-
context.tsx Shared BottomSheetContext (methods) + BottomSheetInternalContext (fitToContents)
|
|
10
|
-
types.ts gorhom-compatible type definitions with @remarks TSDoc
|
|
11
|
-
BottomSheet.ios.tsx SwiftUI .sheet() + presentationDetents
|
|
12
|
-
BottomSheet.android.tsx Material3 ModalBottomSheet + expand()/partialExpand()
|
|
13
|
-
BottomSheet.tsx vaul drawer (web default)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Platform implementations
|
|
17
|
-
|
|
18
|
-
- **iOS**: Wraps `swift-ui/BottomSheet` + `Group` (presentation modifiers) + `RNHostView`. Two-state pattern (`isMounted`/`isPresented`) for animated close — `isPresented→false` triggers native dismiss animation, then `onIsPresentedChange` fires to unmount. When `fitToContents` is active, `presentationDetents` modifier is skipped so native `fitToContents` measures content height.
|
|
19
|
-
|
|
20
|
-
- **Android**: Wraps `jetpack-compose/ModalBottomSheet` + `RNHostView`. Native module exposes `hide()`, `expand()`, `partialExpand()` on `ModalBottomSheetView`. Only 2 snap states: partial (~50%) and expanded. `snapToIndex(0)` calls `partialExpand()`, `snapToIndex(lastIndex)` calls `expand()`. Uses `isOpenRef` to avoid stale closures in the stable `methods` object.
|
|
21
|
-
|
|
22
|
-
- **Web**: Uses [vaul](https://github.com/emilkowalski/vaul) (Radix Dialog-based drawer). Controlled via `open` prop — always mounted, vaul handles open/close animation. Snap point heights controlled via CSS `height` + `transition` on the content div (vaul's own snap system doesn't work well with controlled `open`). `fitToContents` always true on web — `BottomSheetView` strips `flex` styles so vaul measures content naturally.
|
|
23
|
-
|
|
24
|
-
### Native bridge pattern
|
|
25
|
-
|
|
26
|
-
Each native platform follows: `Host matchContents` → native sheet → `RNHostView` → `View` → children.
|
|
27
|
-
- `Host`: bridges React Native → native (SwiftUI/Compose)
|
|
28
|
-
- `RNHostView`: bridges native → React Native (embeds RN views inside native sheet)
|
|
29
|
-
- `matchContents`: when `fitToContents`, RNHostView reports natural content height instead of filling available space
|
|
30
|
-
|
|
31
|
-
### Callback refs pattern
|
|
32
|
-
|
|
33
|
-
All three platforms use `useRef` for `onChange`/`onClose`/`onDismiss` callbacks to keep `useMemo`/`useCallback` closures stable. Without this, parent re-renders (from callback invocations) would recreate the `methods` object, destabilizing context consumers and causing native view re-renders. The `fireCloseCallbacks` helper deduplicates close logic.
|
|
34
|
-
|
|
35
|
-
## BottomSheet vs BottomSheetModal
|
|
36
|
-
|
|
37
|
-
`BottomSheet` defaults `index={0}` (open on mount). `BottomSheetModal` is a wrapper in `index.tsx` that forces `index={-1}` (closed) and overrides `present()` to open at the target snap index. Both share the same platform component underneath.
|
|
38
|
-
|
|
39
|
-
TypeScript declaration merging (`const BottomSheet` + `type BottomSheet`) allows `useRef<BottomSheet>` and `useRef<BottomSheetModal>` to resolve to `BottomSheetMethods` without a separate type import.
|
|
40
|
-
|
|
41
|
-
## BottomSheetView flex stripping
|
|
42
|
-
|
|
43
|
-
When `fitToContents` is active (no snap points), `BottomSheetView` strips `flex`/`flexGrow`/`flexShrink`/`flexBasis` from its style via `BottomSheetInternalContext`. This is needed because gorhom examples always use `<BottomSheetView style={{ flex: 1 }}>`, but `flex: 1` reports zero intrinsic height — breaking native `fitToContents` measurement which needs the content's natural height.
|
|
44
|
-
|
|
45
|
-
## What's NOT supported
|
|
46
|
-
|
|
47
|
-
- `BottomSheetBackdrop`, `BottomSheetHandle`, `BottomSheetFooter` (not exported — native/vaul handles these)
|
|
48
|
-
- `animatedIndex` / `animatedPosition` shared values
|
|
49
|
-
- Custom handle/backdrop/background component rendering (only show/hide control)
|
|
50
|
-
- `BottomSheetVirtualizedList`, `BottomSheetFlashList`, `BottomSheetDraggableView`
|
|
51
|
-
- Combining `enableDynamicSizing` with explicit `snapPoints` (native iOS `fitToContents` and `presentationDetents` are mutually exclusive)
|
|
52
|
-
|
|
53
|
-
## TSDoc convention
|
|
54
|
-
|
|
55
|
-
Every prop that differs from `@gorhom/bottom-sheet` behavior has a `@remarks` tag. No-op props include: "This prop is accepted for API compatibility but has no effect."
|