@expo/ui 55.0.0-preview.6 → 55.0.0
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 +20 -0
- package/android/build.gradle +27 -8
- package/android/src/main/java/expo/modules/ui/BasicAlertDialogView.kt +26 -0
- package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +12 -37
- package/android/src/main/java/expo/modules/ui/CardView.kt +72 -0
- package/android/src/main/java/expo/modules/ui/CarouselView.kt +2 -5
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +91 -130
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +2 -2
- package/android/src/main/java/expo/modules/ui/DividerView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/DockedSearchBarView.kt +53 -0
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +136 -17
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +59 -0
- package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +63 -0
- package/android/src/main/java/expo/modules/ui/LazyColumnView.kt +95 -0
- package/android/src/main/java/expo/modules/ui/ListItemView.kt +89 -0
- package/android/src/main/java/expo/modules/ui/MaterialShapes.kt +77 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +168 -30
- package/android/src/main/java/expo/modules/ui/PickerView.kt +2 -2
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/PullToRefreshBoxView.kt +40 -0
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +87 -0
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +28 -0
- package/android/src/main/java/expo/modules/ui/SearchBarView.kt +60 -0
- package/android/src/main/java/expo/modules/ui/ShapeView.kt +36 -5
- package/android/src/main/java/expo/modules/ui/SliderView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/SlotView.kt +53 -0
- package/android/src/main/java/expo/modules/ui/SpacerView.kt +15 -0
- package/android/src/main/java/expo/modules/ui/SurfaceView.kt +36 -0
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +24 -4
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +33 -0
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +1 -2
- package/android/src/main/java/expo/modules/ui/TextView.kt +194 -0
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +96 -0
- package/android/src/main/java/expo/modules/ui/Utils.kt +6 -0
- package/android/src/main/java/expo/modules/ui/button/Button.kt +1 -1
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +2 -6
- package/android/src/main/java/expo/modules/ui/convertibles/Alignment.kt +112 -0
- package/android/src/main/java/expo/modules/ui/convertibles/Arrangement.kt +72 -0
- package/android/src/main/java/expo/modules/ui/icon/IconView.kt +159 -0
- package/android/src/main/java/expo/modules/ui/icon/ResourceIdHelper.kt +47 -0
- package/android/src/main/java/expo/modules/ui/icon/VectorIconLoader.kt +369 -0
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +1 -1
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts +22 -0
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +40 -0
- package/build/jetpack-compose/Card/index.d.ts.map +1 -0
- package/build/jetpack-compose/Carousel/index.d.ts.map +1 -1
- package/build/jetpack-compose/Chip/index.d.ts +0 -4
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +1 -12
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Divider/index.d.ts.map +1 -1
- package/build/jetpack-compose/DockedSearchBar/index.d.ts +30 -0
- package/build/jetpack-compose/DockedSearchBar/index.d.ts.map +1 -0
- package/build/jetpack-compose/ExpoUIModule.d.ts +2 -0
- package/build/jetpack-compose/ExpoUIModule.d.ts.map +1 -0
- package/build/jetpack-compose/FilterChip/index.d.ts +49 -0
- package/build/jetpack-compose/FilterChip/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +41 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -0
- package/build/jetpack-compose/Icon/index.d.ts +112 -0
- package/build/jetpack-compose/Icon/index.d.ts.map +1 -0
- package/build/jetpack-compose/IconButton/index.d.ts +0 -4
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/LazyColumn/index.d.ts +55 -0
- package/build/jetpack-compose/LazyColumn/index.d.ts.map +1 -0
- package/build/jetpack-compose/ListItem/index.d.ts +81 -0
- package/build/jetpack-compose/ListItem/index.d.ts.map +1 -0
- package/build/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.d.ts +2 -0
- package/build/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.d.ts.map +1 -0
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts +34 -0
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts.map +1 -0
- package/build/jetpack-compose/Picker/index.d.ts +0 -6
- package/build/jetpack-compose/Picker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts +31 -0
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts.map +1 -0
- package/build/jetpack-compose/RNHostView/index.d.ts +28 -0
- package/build/jetpack-compose/RNHostView/index.d.ts.map +1 -0
- package/build/jetpack-compose/RadioButton/index.d.ts +20 -0
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SearchBar/index.d.ts +47 -0
- package/build/jetpack-compose/SearchBar/index.d.ts.map +1 -0
- package/build/jetpack-compose/Shape/index.d.ts +29 -2
- package/build/jetpack-compose/Shape/index.d.ts.map +1 -1
- package/build/jetpack-compose/Slider/index.d.ts +1 -9
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Spacer/index.d.ts +22 -0
- package/build/jetpack-compose/Spacer/index.d.ts.map +1 -0
- package/build/jetpack-compose/Surface/index.d.ts +44 -0
- package/build/jetpack-compose/Surface/index.d.ts.map +1 -0
- package/build/jetpack-compose/Switch/index.d.ts +17 -9
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/Text/index.d.ts +182 -0
- package/build/jetpack-compose/Text/index.d.ts.map +1 -0
- package/build/jetpack-compose/TextButton/index.d.ts +29 -0
- package/build/jetpack-compose/TextButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +54 -0
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/index.d.ts +20 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/layout.d.ts +16 -19
- package/build/jetpack-compose/layout.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/createModifier.d.ts +18 -0
- package/build/jetpack-compose/modifiers/createModifier.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers/index.d.ts +133 -41
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/utils.d.ts +15 -0
- package/build/jetpack-compose/modifiers/utils.d.ts.map +1 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts +47 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -0
- package/build/swift-ui/ScrollView/index.d.ts +16 -0
- package/build/swift-ui/ScrollView/index.d.ts.map +1 -0
- package/build/swift-ui/index.d.ts +2 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +12 -3
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/expo-module.config.json +2 -1
- package/ios/ColorPickerView.swift +2 -2
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +65 -0
- package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +26 -0
- package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +15 -0
- package/ios/Convertibles/VisibilityOptions.swift +19 -0
- package/ios/ExpoUIModule.swift +5 -0
- package/ios/Modifiers/ForegroundStyleModifier.swift +124 -0
- package/ios/Modifiers/PresentationModifiers.swift +1 -18
- package/ios/Modifiers/ViewModifierRegistry.swift +30 -121
- package/ios/ScrollViewComponent.swift +23 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module → 55.0.0/expo.modules.ui-55.0.0.module} +46 -28
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom → 55.0.0/expo.modules.ui-55.0.0.pom} +36 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.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 +5 -3
- package/src/jetpack-compose/AlertDialog/index.tsx +11 -1
- package/src/jetpack-compose/BasicAlertDialog/index.tsx +51 -0
- package/src/jetpack-compose/Button/index.tsx +13 -1
- package/src/jetpack-compose/Card/index.tsx +62 -0
- package/src/jetpack-compose/Carousel/index.tsx +7 -1
- package/src/jetpack-compose/Chip/index.tsx +14 -7
- package/src/jetpack-compose/ContextMenu/index.tsx +5 -2
- package/src/jetpack-compose/DatePicker/index.tsx +5 -5
- package/src/jetpack-compose/Divider/index.tsx +13 -2
- package/src/jetpack-compose/DockedSearchBar/index.tsx +78 -0
- package/src/jetpack-compose/ExpoUIModule.ts +3 -0
- package/src/jetpack-compose/FilterChip/index.tsx +89 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +90 -0
- package/src/jetpack-compose/Icon/index.tsx +144 -0
- package/src/jetpack-compose/IconButton/index.tsx +5 -5
- package/src/jetpack-compose/LazyColumn/index.tsx +82 -0
- package/src/jetpack-compose/ListItem/index.tsx +129 -0
- package/src/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.ts +22 -0
- package/src/jetpack-compose/ModalBottomSheet/index.tsx +61 -0
- package/src/jetpack-compose/Picker/index.tsx +6 -5
- package/src/jetpack-compose/Progress/index.tsx +14 -4
- package/src/jetpack-compose/PullToRefreshBox/index.tsx +66 -0
- package/src/jetpack-compose/RNHostView/index.tsx +56 -0
- package/src/jetpack-compose/RadioButton/index.tsx +48 -0
- package/src/jetpack-compose/SearchBar/index.tsx +96 -0
- package/src/jetpack-compose/Shape/index.tsx +65 -22
- package/src/jetpack-compose/Slider/index.tsx +6 -5
- package/src/jetpack-compose/Spacer/index.tsx +43 -0
- package/src/jetpack-compose/Surface/index.tsx +66 -0
- package/src/jetpack-compose/Switch/index.tsx +43 -8
- package/src/jetpack-compose/Text/index.tsx +274 -0
- package/src/jetpack-compose/TextButton/index.tsx +55 -0
- package/src/jetpack-compose/TextInput/index.tsx +5 -4
- package/src/jetpack-compose/ToggleButton/index.tsx +83 -0
- package/src/jetpack-compose/index.ts +21 -1
- package/src/jetpack-compose/layout.tsx +55 -70
- package/src/jetpack-compose/modifiers/createModifier.ts +27 -0
- package/src/jetpack-compose/modifiers/index.ts +204 -83
- package/src/jetpack-compose/modifiers/utils.ts +30 -0
- package/src/swift-ui/ConfirmationDialog/index.tsx +98 -0
- package/src/swift-ui/ScrollView/index.tsx +34 -0
- package/src/swift-ui/index.tsx +2 -0
- package/src/swift-ui/modifiers/index.ts +19 -3
- package/src/ts-declarations/react-native-assets.d.ts +31 -0
- package/build/jetpack-compose/BottomSheet/index.d.ts +0 -21
- package/build/jetpack-compose/BottomSheet/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha512 +0 -1
- package/src/jetpack-compose/BottomSheet/index.tsx +0 -46
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { ExpoModifier } from '../../types';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
|
|
6
|
+
export type HorizontalFloatingToolbarProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The variant of the horizontal floating toolbar.
|
|
9
|
+
* @default 'standard'
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'standard' | 'vibrant';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The children of the component.
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Modifiers for the component.
|
|
20
|
+
*/
|
|
21
|
+
modifiers?: ExpoModifier[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type FloatingActionButtonProps = {
|
|
25
|
+
/**
|
|
26
|
+
* A callback that is called when the button is pressed.
|
|
27
|
+
*/
|
|
28
|
+
onPress?: () => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The children of the component.
|
|
32
|
+
*/
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type NativeHorizontalFloatingToolbarProps = HorizontalFloatingToolbarProps & {};
|
|
37
|
+
|
|
38
|
+
type NativeSlotViewProps = {
|
|
39
|
+
slotName: string;
|
|
40
|
+
onSlotEvent?: () => void;
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const HorizontalFloatingToolbarNativeView: React.ComponentType<NativeHorizontalFloatingToolbarProps> =
|
|
45
|
+
requireNativeView('ExpoUI', 'HorizontalFloatingToolbarView');
|
|
46
|
+
|
|
47
|
+
// Internal slot marker component - not exported
|
|
48
|
+
const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
|
|
49
|
+
'ExpoUI',
|
|
50
|
+
'SlotView'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* FloatingActionButton component for HorizontalFloatingToolbar.
|
|
55
|
+
* This component marks its children to be rendered in the FAB slot.
|
|
56
|
+
*/
|
|
57
|
+
export function HorizontalFloatingToolbarFloatingActionButton(props: FloatingActionButtonProps) {
|
|
58
|
+
return (
|
|
59
|
+
<SlotNativeView slotName="floatingActionButton" onSlotEvent={props.onPress}>
|
|
60
|
+
{props.children}
|
|
61
|
+
</SlotNativeView>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function transformHorizontalFloatingToolbarProps(
|
|
66
|
+
props: HorizontalFloatingToolbarProps
|
|
67
|
+
): NativeHorizontalFloatingToolbarProps {
|
|
68
|
+
const { modifiers, ...restProps } = props;
|
|
69
|
+
return {
|
|
70
|
+
modifiers,
|
|
71
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
72
|
+
...restProps,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Renders a `HorizontalFloatingToolbar` component.
|
|
78
|
+
* A horizontal toolbar that floats above content, typically used for action buttons.
|
|
79
|
+
*/
|
|
80
|
+
function HorizontalFloatingToolbar(props: HorizontalFloatingToolbarProps) {
|
|
81
|
+
return (
|
|
82
|
+
<HorizontalFloatingToolbarNativeView {...transformHorizontalFloatingToolbarProps(props)}>
|
|
83
|
+
{props.children}
|
|
84
|
+
</HorizontalFloatingToolbarNativeView>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
HorizontalFloatingToolbar.FloatingActionButton = HorizontalFloatingToolbarFloatingActionButton;
|
|
89
|
+
|
|
90
|
+
export { HorizontalFloatingToolbar };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import {
|
|
3
|
+
type ColorValue,
|
|
4
|
+
type ImageSourcePropType,
|
|
5
|
+
type ImageResolvedAssetSource,
|
|
6
|
+
Image,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { ExpoModifier } from '../../types';
|
|
10
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
11
|
+
|
|
12
|
+
export type IconProps = {
|
|
13
|
+
/**
|
|
14
|
+
* The source of the icon. Can be a URI string or the result of `require()`.
|
|
15
|
+
* On Android, supports XML vector drawables loaded via Metro bundler.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Icon source={require('./assets/home.xml')} />
|
|
20
|
+
* <Icon source={{ uri: 'file:///path/to/icon.xml' }} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
source: ImageSourcePropType;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The tint color to apply to the icon.
|
|
27
|
+
* Accepts hex strings, named colors, or RGB arrays.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Icon source={require('./assets/star.xml')} tintColor="#007AFF" />
|
|
32
|
+
* <Icon source={require('./assets/star.xml')} tintColor="blue" />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
tintColor?: ColorValue;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The size of the icon in density-independent pixels (dp).
|
|
39
|
+
* If not specified, the icon will use its intrinsic size.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Icon source={require('./assets/settings.xml')} size={24} />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
size?: number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Accessibility label for the icon.
|
|
50
|
+
* Used by screen readers to describe the icon to users.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Icon
|
|
55
|
+
* source={require('./assets/settings.xml')}
|
|
56
|
+
* contentDescription="Settings icon"
|
|
57
|
+
* />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
contentDescription?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Modifiers for the component.
|
|
64
|
+
* Allows you to apply layout and styling modifiers to the icon.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* <Icon
|
|
69
|
+
* source={require('./assets/icon.xml')}
|
|
70
|
+
* modifiers={[
|
|
71
|
+
* padding(8),
|
|
72
|
+
* background('lightgray')
|
|
73
|
+
* ]}
|
|
74
|
+
* />
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
modifiers?: ExpoModifier[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
83
|
+
export type NativeIconProps = Omit<IconProps, 'source'> & {
|
|
84
|
+
source: ImageResolvedAssetSource;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const IconNativeView: React.ComponentType<NativeIconProps> = requireNativeView(
|
|
88
|
+
'ExpoUI',
|
|
89
|
+
'IconView'
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
function transformIconProps(props: IconProps): NativeIconProps {
|
|
93
|
+
const { source, modifiers, ...restProps } = props;
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
modifiers,
|
|
97
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
98
|
+
...restProps,
|
|
99
|
+
source: Image.resolveAssetSource(source),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Displays an icon from an XML vector drawable or other image source.
|
|
105
|
+
*
|
|
106
|
+
* The Icon component renders vector graphics and images with support for
|
|
107
|
+
* tinting, sizing, and accessibility features. On Android, it natively
|
|
108
|
+
* supports XML vector drawables loaded via Metro bundler using `require()`.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* Basic usage:
|
|
112
|
+
* ```tsx
|
|
113
|
+
* import { Icon } from 'expo-ui';
|
|
114
|
+
*
|
|
115
|
+
* <Icon source={require('./assets/home.xml')} />
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* With styling:
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <Icon
|
|
122
|
+
* source={require('./assets/settings.xml')}
|
|
123
|
+
* size={24}
|
|
124
|
+
* tintColor="#007AFF"
|
|
125
|
+
* contentDescription="Settings icon"
|
|
126
|
+
* />
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* With modifiers:
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <Icon
|
|
133
|
+
* source={require('./assets/star.xml')}
|
|
134
|
+
* size={32}
|
|
135
|
+
* modifiers={[
|
|
136
|
+
* padding(8),
|
|
137
|
+
* background('lightgray')
|
|
138
|
+
* ]}
|
|
139
|
+
* />
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export function Icon(props: IconProps) {
|
|
143
|
+
return <IconNativeView {...transformIconProps(props)} />;
|
|
144
|
+
}
|
|
@@ -4,6 +4,7 @@ import { type ColorValue } from 'react-native';
|
|
|
4
4
|
import { ExpoModifier, ViewEvent } from '../../types';
|
|
5
5
|
import { ButtonElementColors } from '../Button';
|
|
6
6
|
import { parseJSXShape, ShapeJSXElement, ShapeRecordProps } from '../Shape';
|
|
7
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* The built-in button styles available on Android.
|
|
@@ -59,13 +60,12 @@ const IconButtonNativeView: React.ComponentType<NativeIconButtonProps> = require
|
|
|
59
60
|
'IconButton'
|
|
60
61
|
);
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
export function transformIconButtonProps(props: IconButtonProps): NativeIconButtonProps {
|
|
66
|
-
const { children, onPress, shape, ...restProps } = props;
|
|
63
|
+
function transformIconButtonProps(props: IconButtonProps): NativeIconButtonProps {
|
|
64
|
+
const { children, onPress, shape, modifiers, ...restProps } = props;
|
|
67
65
|
|
|
68
66
|
return {
|
|
67
|
+
modifiers,
|
|
68
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
69
69
|
...restProps,
|
|
70
70
|
children,
|
|
71
71
|
shape: parseJSXShape(shape),
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { ExpoModifier } from '../../types';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Content padding values for LazyColumn.
|
|
8
|
+
*/
|
|
9
|
+
export type ContentPadding = {
|
|
10
|
+
/**
|
|
11
|
+
* Start padding in dp.
|
|
12
|
+
*/
|
|
13
|
+
start?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Top padding in dp.
|
|
16
|
+
*/
|
|
17
|
+
top?: number;
|
|
18
|
+
/**
|
|
19
|
+
* End padding in dp.
|
|
20
|
+
*/
|
|
21
|
+
end?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Bottom padding in dp.
|
|
24
|
+
*/
|
|
25
|
+
bottom?: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type LazyColumnProps = {
|
|
29
|
+
/**
|
|
30
|
+
* The content to display inside the lazy column.
|
|
31
|
+
*/
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* The vertical arrangement of items.
|
|
35
|
+
* Can be a preset string or an object with `spacedBy` to specify spacing in dp.
|
|
36
|
+
* @example
|
|
37
|
+
* verticalArrangement="center"
|
|
38
|
+
* verticalArrangement={{ spacedBy: 8 }}
|
|
39
|
+
*/
|
|
40
|
+
verticalArrangement?:
|
|
41
|
+
| 'top'
|
|
42
|
+
| 'bottom'
|
|
43
|
+
| 'center'
|
|
44
|
+
| 'spaceBetween'
|
|
45
|
+
| 'spaceAround'
|
|
46
|
+
| 'spaceEvenly'
|
|
47
|
+
| { spacedBy: number };
|
|
48
|
+
/**
|
|
49
|
+
* The horizontal alignment of items.
|
|
50
|
+
*/
|
|
51
|
+
horizontalAlignment?: 'start' | 'end' | 'center';
|
|
52
|
+
/**
|
|
53
|
+
* Content padding in dp.
|
|
54
|
+
*/
|
|
55
|
+
contentPadding?: ContentPadding;
|
|
56
|
+
/**
|
|
57
|
+
* Modifiers for the component.
|
|
58
|
+
*/
|
|
59
|
+
modifiers?: ExpoModifier[];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type NativeLazyColumnProps = LazyColumnProps;
|
|
63
|
+
const LazyColumnNativeView: React.ComponentType<NativeLazyColumnProps> = requireNativeView(
|
|
64
|
+
'ExpoUI',
|
|
65
|
+
'LazyColumnView'
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
function transformProps(props: LazyColumnProps): NativeLazyColumnProps {
|
|
69
|
+
const { modifiers, ...restProps } = props;
|
|
70
|
+
return {
|
|
71
|
+
modifiers,
|
|
72
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
73
|
+
...restProps,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A lazy column component that efficiently displays a vertically scrolling list.
|
|
79
|
+
*/
|
|
80
|
+
export function LazyColumn(props: LazyColumnProps) {
|
|
81
|
+
return <LazyColumnNativeView {...transformProps(props)} />;
|
|
82
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { type ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ExpoModifier } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Colors for list item's core elements.
|
|
9
|
+
*/
|
|
10
|
+
export type ListItemColors = {
|
|
11
|
+
containerColor?: ColorValue;
|
|
12
|
+
headlineColor?: ColorValue;
|
|
13
|
+
leadingIconColor?: ColorValue;
|
|
14
|
+
trailingIconColor?: ColorValue;
|
|
15
|
+
supportingColor?: ColorValue;
|
|
16
|
+
overlineColor?: ColorValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ListItemProps = {
|
|
20
|
+
/**
|
|
21
|
+
* The main text content of the list item.
|
|
22
|
+
*/
|
|
23
|
+
headline: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional supporting text displayed below the headline.
|
|
26
|
+
*/
|
|
27
|
+
supportingText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional overline text displayed above the headline.
|
|
30
|
+
*/
|
|
31
|
+
overlineText?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The background color of the list item.
|
|
34
|
+
*/
|
|
35
|
+
color?: ColorValue;
|
|
36
|
+
/**
|
|
37
|
+
* Colors for list item's core elements.
|
|
38
|
+
*/
|
|
39
|
+
colors?: ListItemColors;
|
|
40
|
+
/**
|
|
41
|
+
* Callback that is called when the list item is pressed.
|
|
42
|
+
*/
|
|
43
|
+
onPress?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Modifiers for the component.
|
|
46
|
+
*/
|
|
47
|
+
modifiers?: ExpoModifier[];
|
|
48
|
+
/**
|
|
49
|
+
* Children containing Leading and Trailing slots.
|
|
50
|
+
*/
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type LeadingProps = {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type TrailingProps = {
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type SupportingContentProps = {
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type NativeListItemProps = Omit<ListItemProps, 'onPress'> & {
|
|
67
|
+
onPress?: () => void;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type NativeSlotViewProps = {
|
|
71
|
+
slotName: string;
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const ListItemNativeView: React.ComponentType<NativeListItemProps> = requireNativeView(
|
|
76
|
+
'ExpoUI',
|
|
77
|
+
'ListItemView'
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
|
|
81
|
+
'ExpoUI',
|
|
82
|
+
'SlotView'
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Leading content slot for ListItem.
|
|
87
|
+
*/
|
|
88
|
+
export function ListItemLeading(props: LeadingProps) {
|
|
89
|
+
return <SlotNativeView slotName="leading">{props.children}</SlotNativeView>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Trailing content slot for ListItem.
|
|
94
|
+
*/
|
|
95
|
+
export function ListItemTrailing(props: TrailingProps) {
|
|
96
|
+
return <SlotNativeView slotName="trailing">{props.children}</SlotNativeView>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Custom supporting content slot for ListItem.
|
|
101
|
+
* When provided, this takes precedence over the `supportingText` prop.
|
|
102
|
+
* @platform android
|
|
103
|
+
*/
|
|
104
|
+
export function ListItemSupportingContent(props: SupportingContentProps) {
|
|
105
|
+
return <SlotNativeView slotName="supportingContent">{props.children}</SlotNativeView>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A list item component following Material 3 design guidelines.
|
|
110
|
+
*/
|
|
111
|
+
function ListItemComponent(props: ListItemProps) {
|
|
112
|
+
const { children, modifiers, onPress, ...restProps } = props;
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<ListItemNativeView
|
|
116
|
+
modifiers={modifiers}
|
|
117
|
+
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
118
|
+
{...restProps}
|
|
119
|
+
onPress={onPress}>
|
|
120
|
+
{children}
|
|
121
|
+
</ListItemNativeView>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ListItemComponent.Leading = ListItemLeading;
|
|
126
|
+
ListItemComponent.Trailing = ListItemTrailing;
|
|
127
|
+
ListItemComponent.SupportingContent = ListItemSupportingContent;
|
|
128
|
+
|
|
129
|
+
export { ListItemComponent as ListItem };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Image } from 'react-native';
|
|
2
|
+
import type AssetSourceResolver from 'react-native/Libraries/Image/AssetSourceResolver';
|
|
3
|
+
|
|
4
|
+
// @ts-expect-error: addCustomSourceTransformer type is not exported
|
|
5
|
+
if (typeof Image.resolveAssetSource.addCustomSourceTransformer === 'function') {
|
|
6
|
+
// @ts-expect-error: addCustomSourceTransformer type is not exported
|
|
7
|
+
Image.resolveAssetSource.addCustomSourceTransformer((resolver: AssetSourceResolver) => {
|
|
8
|
+
if (
|
|
9
|
+
process.env.EXPO_OS === 'android' &&
|
|
10
|
+
resolver.asset.type === 'xml' &&
|
|
11
|
+
resolver.serverUrl != null &&
|
|
12
|
+
resolver.serverUrl !== ''
|
|
13
|
+
) {
|
|
14
|
+
// react-native's resolveAssetSource doesn't allow xml assets to be resolved from the server.
|
|
15
|
+
// We support material symbols using compose PathParser because material symbols are mainly paths.
|
|
16
|
+
// We have to patch the resolver to allow xml assets to be resolved from the server.
|
|
17
|
+
// https://github.com/facebook/react-native/blob/758a3db449d770214883ba8d15da4856ca997bff/packages/react-native/Libraries/Image/AssetSourceResolver.js#L69-L85
|
|
18
|
+
return resolver.assetServerURL();
|
|
19
|
+
}
|
|
20
|
+
return resolver.defaultAsset();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { type ExpoModifier, type ViewEvent } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
|
+
|
|
7
|
+
export type ModalBottomSheetProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The children of the `ModalBottomSheet` component.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function that is called when the bottom sheet is dismissed.
|
|
14
|
+
*/
|
|
15
|
+
onDismissRequest: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Immediately opens the bottom sheet in full screen.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
skipPartiallyExpanded?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Modifiers for the component.
|
|
23
|
+
*/
|
|
24
|
+
modifiers?: ExpoModifier[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type NativeModalBottomSheetProps = Omit<ModalBottomSheetProps, 'onDismissRequest'> &
|
|
28
|
+
ViewEvent<'onDismissRequest', void>;
|
|
29
|
+
|
|
30
|
+
const ModalBottomSheetNativeView: React.ComponentType<NativeModalBottomSheetProps> =
|
|
31
|
+
requireNativeView('ExpoUI', 'ModalBottomSheetView');
|
|
32
|
+
|
|
33
|
+
function transformProps(props: ModalBottomSheetProps): NativeModalBottomSheetProps {
|
|
34
|
+
const { modifiers, onDismissRequest, ...restProps } = props;
|
|
35
|
+
return {
|
|
36
|
+
modifiers,
|
|
37
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
38
|
+
...restProps,
|
|
39
|
+
skipPartiallyExpanded: props.skipPartiallyExpanded ?? false,
|
|
40
|
+
onDismissRequest: () => {
|
|
41
|
+
onDismissRequest?.();
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Material Design modal bottom sheet.
|
|
48
|
+
*/
|
|
49
|
+
export function ModalBottomSheet(props: ModalBottomSheetProps) {
|
|
50
|
+
return <ModalBottomSheetNativeView {...transformProps(props)} />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use `ModalBottomSheet` instead.
|
|
55
|
+
*/
|
|
56
|
+
export const BottomSheet = ModalBottomSheet;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use `ModalBottomSheetProps` instead.
|
|
60
|
+
*/
|
|
61
|
+
export type BottomSheetProps = ModalBottomSheetProps;
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { ExpoModifier } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Colors for picker's core elements.
|
|
@@ -63,12 +64,12 @@ const PickerNativeView: React.ComponentType<PickerProps> = requireNativeView(
|
|
|
63
64
|
|
|
64
65
|
type NativePickerProps = PickerProps;
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*/
|
|
69
|
-
export function transformPickerProps(props: PickerProps): NativePickerProps {
|
|
67
|
+
function transformPickerProps(props: PickerProps): NativePickerProps {
|
|
68
|
+
const { modifiers, ...restProps } = props;
|
|
70
69
|
return {
|
|
71
|
-
|
|
70
|
+
modifiers,
|
|
71
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
72
|
+
...restProps,
|
|
72
73
|
variant: props.variant ?? 'segmented',
|
|
73
74
|
elementColors: props.elementColors
|
|
74
75
|
? props.elementColors
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { ExpoModifier } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
|
|
6
7
|
export type ProgressElementColors = {
|
|
7
8
|
/**
|
|
@@ -63,30 +64,39 @@ const NativeProgressView: React.ComponentType<NativeProgressProps> = requireNati
|
|
|
63
64
|
'ProgressView'
|
|
64
65
|
);
|
|
65
66
|
|
|
67
|
+
function transformProps(props: CircularProgressProps | LinearProgressProps): NativeProgressProps {
|
|
68
|
+
const { modifiers, ...restProps } = props;
|
|
69
|
+
return {
|
|
70
|
+
modifiers,
|
|
71
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
72
|
+
...restProps,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
/**
|
|
67
77
|
* Renders a `CircularProgress` component.
|
|
68
78
|
*/
|
|
69
79
|
export function CircularProgress(props: CircularProgressProps) {
|
|
70
|
-
return <NativeProgressView {...props} variant="circular" />;
|
|
80
|
+
return <NativeProgressView {...transformProps(props)} variant="circular" />;
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
/**
|
|
74
84
|
* Renders a `LinearProgress` component.
|
|
75
85
|
*/
|
|
76
86
|
export function LinearProgress(props: LinearProgressProps) {
|
|
77
|
-
return <NativeProgressView {...props} variant="linear" />;
|
|
87
|
+
return <NativeProgressView {...transformProps(props)} variant="linear" />;
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
/**
|
|
81
91
|
* Renders a `CircularWavyProgress` component with wavy animation.
|
|
82
92
|
*/
|
|
83
93
|
export function CircularWavyProgress(props: CircularProgressProps) {
|
|
84
|
-
return <NativeProgressView {...props} variant="circularWavy" />;
|
|
94
|
+
return <NativeProgressView {...transformProps(props)} variant="circularWavy" />;
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
/**
|
|
88
98
|
* Renders a `LinearWavyProgress` component with wavy animation.
|
|
89
99
|
*/
|
|
90
100
|
export function LinearWavyProgress(props: LinearProgressProps) {
|
|
91
|
-
return <NativeProgressView {...props} variant="linearWavy" />;
|
|
101
|
+
return <NativeProgressView {...transformProps(props)} variant="linearWavy" />;
|
|
92
102
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { type ViewEvent, type ExpoModifier } from '../../types';
|
|
4
|
+
import { align } from '../modifiers';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
|
+
|
|
7
|
+
export type PullToRefreshBoxProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the content is refreshing.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
isRefreshing?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback to call when the content is refreshed.
|
|
15
|
+
*/
|
|
16
|
+
onRefresh?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Modifiers for the component.
|
|
19
|
+
*/
|
|
20
|
+
modifiers?: ExpoModifier[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Modifiers for the loading indicator.
|
|
24
|
+
* @default [align('topCenter'), padding(0, 10, 0, 0)]
|
|
25
|
+
*/
|
|
26
|
+
loadingIndicatorModifiers?: ExpoModifier[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The content to refresh.
|
|
30
|
+
*/
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type NativePullToRefreshBoxProps = Omit<PullToRefreshBoxProps, 'onRefresh'> &
|
|
35
|
+
ViewEvent<'onRefresh', void>;
|
|
36
|
+
|
|
37
|
+
const NativePullToRefreshBoxView: React.ComponentType<NativePullToRefreshBoxProps> =
|
|
38
|
+
requireNativeView('ExpoUI', 'PullToRefreshBoxView');
|
|
39
|
+
|
|
40
|
+
function transformProps(props: PullToRefreshBoxProps): NativePullToRefreshBoxProps {
|
|
41
|
+
const { isRefreshing, modifiers, onRefresh, ...restProps } = props;
|
|
42
|
+
|
|
43
|
+
const loadingIndicatorModifiers = props.loadingIndicatorModifiers ?? [
|
|
44
|
+
align('topCenter'),
|
|
45
|
+
// padding(0, 10, 0, 0),
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
modifiers,
|
|
50
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
51
|
+
...restProps,
|
|
52
|
+
isRefreshing: isRefreshing ?? false,
|
|
53
|
+
onRefresh: () => {
|
|
54
|
+
onRefresh?.();
|
|
55
|
+
},
|
|
56
|
+
loadingIndicatorModifiers,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Renders a `PullToRefreshBox` component.
|
|
62
|
+
* A box that allows the user to pull down to refresh the content.
|
|
63
|
+
*/
|
|
64
|
+
export function PullToRefreshBox(props: PullToRefreshBoxProps) {
|
|
65
|
+
return <NativePullToRefreshBoxView {...transformProps(props)} />;
|
|
66
|
+
}
|