@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,56 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { ExpoModifier } from '../../types';
|
|
5
|
+
import { PrimitiveBaseProps } from '../layout';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
|
+
|
|
8
|
+
interface RNHostProps extends PrimitiveBaseProps {
|
|
9
|
+
/**
|
|
10
|
+
* When true, the RNHost will update its size in the Jetpack Compose view tree to match the children's size.
|
|
11
|
+
* When false, the RNHost will use the size of the parent Jetpack Compose View.
|
|
12
|
+
* Can be only set once on mount.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
matchContents?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The RN View to be hosted.
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactElement;
|
|
20
|
+
/**
|
|
21
|
+
* Modifiers for the component.
|
|
22
|
+
*/
|
|
23
|
+
modifiers?: ExpoModifier[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* When true, the RNHost will enable vertical scrolling.
|
|
27
|
+
* @see Official [Jetpack Compose documentation](androidx.compose.ui.Modifier).verticalScroll(androidx.compose.foundation.ScrollState,kotlin.Boolean,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean)
|
|
28
|
+
*/
|
|
29
|
+
verticalScrollEnabled?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type NativeRNHostProps = RNHostProps;
|
|
33
|
+
const NativeRNHostView: React.ComponentType<NativeRNHostProps> = requireNativeView(
|
|
34
|
+
'ExpoUI',
|
|
35
|
+
'RNHostView'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
function transformProps(props: RNHostProps): NativeRNHostProps {
|
|
39
|
+
const { modifiers, ...restProps } = props;
|
|
40
|
+
return {
|
|
41
|
+
modifiers,
|
|
42
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
43
|
+
...restProps,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function RNHostView(props: RNHostProps) {
|
|
48
|
+
return (
|
|
49
|
+
<NativeRNHostView
|
|
50
|
+
{...transformProps(props)}
|
|
51
|
+
// `matchContents` can only be used once on mount
|
|
52
|
+
// So we force unmount when it changes to prevent unexpected layout
|
|
53
|
+
key={props.matchContents ? 'matchContents' : 'noMatchContents'}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { type ExpoModifier, type ViewEvent } from '../../types';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
|
|
6
|
+
export type RadioButtonProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the radio button is selected.
|
|
9
|
+
*/
|
|
10
|
+
selected: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Callback that is called when the radio button is clicked.
|
|
13
|
+
*/
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Modifiers for the component.
|
|
17
|
+
*/
|
|
18
|
+
modifiers?: ExpoModifier[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type NativeRadioButtonProps = Omit<RadioButtonProps, 'onClick'> & {
|
|
22
|
+
nativeClickable: boolean;
|
|
23
|
+
} & ViewEvent<'onNativeClick', void>;
|
|
24
|
+
|
|
25
|
+
const RadioButtonNativeView: React.ComponentType<NativeRadioButtonProps> = requireNativeView(
|
|
26
|
+
'ExpoUI',
|
|
27
|
+
'RadioButtonView'
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
function transformProps(props: RadioButtonProps): NativeRadioButtonProps {
|
|
31
|
+
const { modifiers, onClick, ...restProps } = props;
|
|
32
|
+
return {
|
|
33
|
+
modifiers,
|
|
34
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
35
|
+
...restProps,
|
|
36
|
+
nativeClickable: onClick != null,
|
|
37
|
+
onNativeClick: () => {
|
|
38
|
+
onClick?.();
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A Material Design radio button.
|
|
45
|
+
*/
|
|
46
|
+
export function RadioButton(props: RadioButtonProps) {
|
|
47
|
+
return <RadioButtonNativeView {...transformProps(props)} />;
|
|
48
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { type ExpoModifier, type ViewEvent } from '../../types';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
|
|
6
|
+
export type SearchBarProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Callback function that is called when the search text is submitted.
|
|
9
|
+
*/
|
|
10
|
+
onSearch?: (searchText: string) => void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Modifiers for the component.
|
|
14
|
+
*/
|
|
15
|
+
modifiers?: ExpoModifier[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The children of the component.
|
|
19
|
+
*/
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type PlaceholderProps = {
|
|
24
|
+
/**
|
|
25
|
+
* The children of the component.
|
|
26
|
+
*/
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type ExpandedFullScreenSearchBarProps = {
|
|
31
|
+
/**
|
|
32
|
+
* The children of the component.
|
|
33
|
+
*/
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type NativeSearchBarProps = Omit<SearchBarProps, 'onSearch'> &
|
|
38
|
+
ViewEvent<'onSearch', { value: string }>;
|
|
39
|
+
|
|
40
|
+
type NativeSlotViewProps = {
|
|
41
|
+
slotName: string;
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const SearchBarNativeView: React.ComponentType<NativeSearchBarProps> = requireNativeView(
|
|
46
|
+
'ExpoUI',
|
|
47
|
+
'SearchBarView'
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Internal slot marker component - not exported
|
|
51
|
+
const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
|
|
52
|
+
'ExpoUI',
|
|
53
|
+
'SlotView'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Placeholder component for SearchBar.
|
|
58
|
+
* This component marks its children to be rendered in the placeholder slot.
|
|
59
|
+
*/
|
|
60
|
+
export function SearchBarPlaceholder(props: PlaceholderProps) {
|
|
61
|
+
return <SlotNativeView slotName="placeholder">{props.children}</SlotNativeView>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* ExpandedFullScreenSearchBar component for SearchBar.
|
|
66
|
+
* This component marks its children to be rendered in the expanded full-screen search bar.
|
|
67
|
+
*/
|
|
68
|
+
export function ExpandedFullScreenSearchBar(props: ExpandedFullScreenSearchBarProps) {
|
|
69
|
+
return <SlotNativeView slotName="expandedFullScreenSearchBar">{props.children}</SlotNativeView>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function transformSearchBarProps(props: SearchBarProps): NativeSearchBarProps {
|
|
73
|
+
const { modifiers, onSearch, ...restProps } = props;
|
|
74
|
+
return {
|
|
75
|
+
modifiers,
|
|
76
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
77
|
+
...restProps,
|
|
78
|
+
onSearch: (event) => {
|
|
79
|
+
onSearch?.(event.nativeEvent.value);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Renders a `SearchBar` component.
|
|
86
|
+
*/
|
|
87
|
+
function SearchBar(props: SearchBarProps) {
|
|
88
|
+
return (
|
|
89
|
+
<SearchBarNativeView {...transformSearchBarProps(props)}>{props.children}</SearchBarNativeView>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
SearchBar.Placeholder = SearchBarPlaceholder;
|
|
94
|
+
SearchBar.ExpandedFullScreenSearchBar = ExpandedFullScreenSearchBar;
|
|
95
|
+
|
|
96
|
+
export { SearchBar };
|
|
@@ -2,8 +2,38 @@ 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
|
-
type ShapeType =
|
|
7
|
+
type ShapeType =
|
|
8
|
+
| 'star'
|
|
9
|
+
| 'pillStar'
|
|
10
|
+
| 'pill'
|
|
11
|
+
| 'circle'
|
|
12
|
+
| 'rectangle'
|
|
13
|
+
| 'polygon'
|
|
14
|
+
| 'roundedCorner';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Corner radii for RoundedCorner shape.
|
|
18
|
+
*/
|
|
19
|
+
export type CornerRadii = {
|
|
20
|
+
/**
|
|
21
|
+
* Top-start corner radius in dp.
|
|
22
|
+
*/
|
|
23
|
+
topStart?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Top-end corner radius in dp.
|
|
26
|
+
*/
|
|
27
|
+
topEnd?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Bottom-start corner radius in dp.
|
|
30
|
+
*/
|
|
31
|
+
bottomStart?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Bottom-end corner radius in dp.
|
|
34
|
+
*/
|
|
35
|
+
bottomEnd?: number;
|
|
36
|
+
};
|
|
7
37
|
|
|
8
38
|
export type ShapeProps = {
|
|
9
39
|
/**
|
|
@@ -31,6 +61,10 @@ export type ShapeProps = {
|
|
|
31
61
|
* @default 1.0
|
|
32
62
|
*/
|
|
33
63
|
radius?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Corner radii for RoundedCorner shape. Values are in dp.
|
|
66
|
+
*/
|
|
67
|
+
cornerRadii?: CornerRadii;
|
|
34
68
|
/** Color of the shape */
|
|
35
69
|
color?: ColorValue;
|
|
36
70
|
/**
|
|
@@ -46,7 +80,13 @@ type NativeShapeProps = Omit<ShapeProps, 'modifiers'> & {
|
|
|
46
80
|
|
|
47
81
|
export type ShapeRecordProps = Pick<
|
|
48
82
|
NativeShapeProps,
|
|
49
|
-
|
|
83
|
+
| 'cornerRounding'
|
|
84
|
+
| 'smoothing'
|
|
85
|
+
| 'verticesCount'
|
|
86
|
+
| 'innerRadius'
|
|
87
|
+
| 'radius'
|
|
88
|
+
| 'cornerRadii'
|
|
89
|
+
| 'type'
|
|
50
90
|
>;
|
|
51
91
|
|
|
52
92
|
const ShapeNativeView: React.ComponentType<NativeShapeProps> = requireNativeView(
|
|
@@ -54,48 +94,49 @@ const ShapeNativeView: React.ComponentType<NativeShapeProps> = requireNativeView
|
|
|
54
94
|
'ShapeView'
|
|
55
95
|
);
|
|
56
96
|
|
|
97
|
+
function transformProps(props: ShapeProps): Omit<NativeShapeProps, 'type'> {
|
|
98
|
+
const { modifiers, ...restProps } = props;
|
|
99
|
+
return {
|
|
100
|
+
modifiers,
|
|
101
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
102
|
+
...restProps,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
57
106
|
export type ShapeJSXElement = React.ReactElement<NativeShapeProps> & {
|
|
58
107
|
__expo_shape_jsx_element_marker: true;
|
|
59
108
|
};
|
|
60
109
|
|
|
61
110
|
function Star(props: ShapeProps) {
|
|
62
|
-
return (
|
|
63
|
-
<ShapeNativeView {...props} modifiers={props?.modifiers} type="star" />
|
|
64
|
-
) as ShapeJSXElement;
|
|
111
|
+
return (<ShapeNativeView {...transformProps(props)} type="star" />) as ShapeJSXElement;
|
|
65
112
|
}
|
|
66
113
|
|
|
67
114
|
function PillStar(props: ShapeProps) {
|
|
68
|
-
return (
|
|
69
|
-
<ShapeNativeView {...props} modifiers={props?.modifiers} type="pillStar" />
|
|
70
|
-
) as ShapeJSXElement;
|
|
115
|
+
return (<ShapeNativeView {...transformProps(props)} type="pillStar" />) as ShapeJSXElement;
|
|
71
116
|
}
|
|
72
117
|
|
|
73
118
|
function Pill(props: Pick<ShapeProps, 'smoothing' | 'color' | 'modifiers'>) {
|
|
74
|
-
return (
|
|
75
|
-
<ShapeNativeView {...props} modifiers={props?.modifiers} type="pill" />
|
|
76
|
-
) as ShapeJSXElement;
|
|
119
|
+
return (<ShapeNativeView {...transformProps(props)} type="pill" />) as ShapeJSXElement;
|
|
77
120
|
}
|
|
78
121
|
|
|
79
122
|
function Circle(props: Pick<ShapeProps, 'radius' | 'verticesCount' | 'color' | 'modifiers'>) {
|
|
80
|
-
return (
|
|
81
|
-
<ShapeNativeView {...props} modifiers={props?.modifiers} type="circle" />
|
|
82
|
-
) as ShapeJSXElement;
|
|
123
|
+
return (<ShapeNativeView {...transformProps(props)} type="circle" />) as ShapeJSXElement;
|
|
83
124
|
}
|
|
84
125
|
|
|
85
126
|
function Rectangle(
|
|
86
127
|
props: Pick<ShapeProps, 'smoothing' | 'cornerRounding' | 'color' | 'modifiers'>
|
|
87
128
|
) {
|
|
88
|
-
return (
|
|
89
|
-
<ShapeNativeView {...props} modifiers={props?.modifiers} type="rectangle" />
|
|
90
|
-
) as ShapeJSXElement;
|
|
129
|
+
return (<ShapeNativeView {...transformProps(props)} type="rectangle" />) as ShapeJSXElement;
|
|
91
130
|
}
|
|
92
131
|
|
|
93
132
|
function Polygon(
|
|
94
133
|
props: Pick<ShapeProps, 'smoothing' | 'cornerRounding' | 'verticesCount' | 'color' | 'modifiers'>
|
|
95
134
|
) {
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
|
|
135
|
+
return (<ShapeNativeView {...transformProps(props)} type="polygon" />) as ShapeJSXElement;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function RoundedCorner(props: Pick<ShapeProps, 'cornerRadii' | 'color' | 'modifiers'>) {
|
|
139
|
+
return (<ShapeNativeView {...transformProps(props)} type="roundedCorner" />) as ShapeJSXElement;
|
|
99
140
|
}
|
|
100
141
|
|
|
101
142
|
export const Shape = {
|
|
@@ -105,12 +146,14 @@ export const Shape = {
|
|
|
105
146
|
Circle,
|
|
106
147
|
Rectangle,
|
|
107
148
|
Polygon,
|
|
149
|
+
RoundedCorner,
|
|
108
150
|
};
|
|
109
151
|
|
|
110
152
|
export function parseJSXShape(shape: ShapeJSXElement): ShapeRecordProps;
|
|
111
153
|
export function parseJSXShape(shape?: ShapeJSXElement): ShapeRecordProps | undefined;
|
|
112
154
|
export function parseJSXShape(shape?: ShapeJSXElement): ShapeRecordProps | undefined {
|
|
113
155
|
if (!shape) return undefined;
|
|
114
|
-
const { cornerRounding, smoothing, verticesCount, innerRadius, radius, type } =
|
|
115
|
-
|
|
156
|
+
const { cornerRounding, smoothing, verticesCount, innerRadius, radius, cornerRadii, type } =
|
|
157
|
+
shape.props;
|
|
158
|
+
return { cornerRounding, smoothing, verticesCount, innerRadius, radius, cornerRadii, type };
|
|
116
159
|
}
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { ExpoModifier, ViewEvent } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Colors for slider's core elements.
|
|
@@ -64,12 +65,12 @@ const SliderNativeView: React.ComponentType<NativeSliderProps> = requireNativeVi
|
|
|
64
65
|
'SliderView'
|
|
65
66
|
);
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
export function transformSliderProps(props: SliderProps): NativeSliderProps {
|
|
68
|
+
function transformSliderProps(props: SliderProps): NativeSliderProps {
|
|
69
|
+
const { modifiers, ...restProps } = props;
|
|
71
70
|
return {
|
|
72
|
-
|
|
71
|
+
modifiers,
|
|
72
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
73
|
+
...restProps,
|
|
73
74
|
min: props.min ?? 0,
|
|
74
75
|
max: props.max ?? 1,
|
|
75
76
|
steps: props.steps ?? 0,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { ExpoModifier } from '../../types';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
|
|
6
|
+
export type SpacerProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Modifiers for the component. Use weight() modifier to make the spacer flexible.
|
|
9
|
+
*/
|
|
10
|
+
modifiers?: ExpoModifier[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type NativeSpacerProps = SpacerProps;
|
|
14
|
+
const SpacerNativeView: React.ComponentType<SpacerProps> = requireNativeView(
|
|
15
|
+
'ExpoUI',
|
|
16
|
+
'SpacerView'
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
function transformProps(props: SpacerProps): NativeSpacerProps {
|
|
20
|
+
const { modifiers, ...restProps } = props;
|
|
21
|
+
return {
|
|
22
|
+
modifiers,
|
|
23
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
24
|
+
...restProps,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A spacer component that fills available space.
|
|
30
|
+
* Use with the weight() modifier to create flexible spacing in Row or Column layouts.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Row>
|
|
35
|
+
* <Text>Left</Text>
|
|
36
|
+
* <Spacer modifiers={[weight(1)]} />
|
|
37
|
+
* <Text>Right</Text>
|
|
38
|
+
* </Row>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function Spacer(props: SpacerProps) {
|
|
42
|
+
return <SpacerNativeView {...transformProps(props)} />;
|
|
43
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ColorValue } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { type ExpoModifier } from '../../types';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
|
+
|
|
8
|
+
export type SurfaceProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The content to display inside the surface.
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The background color of the surface.
|
|
15
|
+
* Defaults to `MaterialTheme.colorScheme.surface`.
|
|
16
|
+
*/
|
|
17
|
+
color?: ColorValue;
|
|
18
|
+
/**
|
|
19
|
+
* The color of the content inside the surface.
|
|
20
|
+
* Defaults to `contentColorFor(color)`.
|
|
21
|
+
*/
|
|
22
|
+
contentColor?: ColorValue;
|
|
23
|
+
/**
|
|
24
|
+
* The tonal elevation of the surface, which affects its background color
|
|
25
|
+
* based on the color scheme. Value in dp.
|
|
26
|
+
*
|
|
27
|
+
* @default 0
|
|
28
|
+
*/
|
|
29
|
+
tonalElevation?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The shadow elevation of the surface. Value in dp.
|
|
32
|
+
*
|
|
33
|
+
* @default 0
|
|
34
|
+
*/
|
|
35
|
+
shadowElevation?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Modifiers for the component.
|
|
38
|
+
*/
|
|
39
|
+
modifiers?: ExpoModifier[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type NativeSurfaceProps = SurfaceProps;
|
|
43
|
+
|
|
44
|
+
const SurfaceNativeView: React.ComponentType<NativeSurfaceProps> = requireNativeView(
|
|
45
|
+
'ExpoUI',
|
|
46
|
+
'SurfaceView'
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
function transformProps(props: SurfaceProps): NativeSurfaceProps {
|
|
50
|
+
const { modifiers, ...restProps } = props;
|
|
51
|
+
return {
|
|
52
|
+
modifiers,
|
|
53
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
54
|
+
...restProps,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A Material Design surface container. Surface is responsible for:
|
|
60
|
+
* - Clipping content to the shape
|
|
61
|
+
* - Applying background color based on tonal elevation
|
|
62
|
+
* - Providing content color to its children
|
|
63
|
+
*/
|
|
64
|
+
export function Surface(props: SurfaceProps) {
|
|
65
|
+
return <SurfaceNativeView {...transformProps(props)} />;
|
|
66
|
+
}
|
|
@@ -2,6 +2,8 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { NativeSyntheticEvent, type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { ExpoModifier } from '../../types';
|
|
5
|
+
import { ExpoUIModule } from '../ExpoUIModule';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
7
|
|
|
6
8
|
// @docsMissing
|
|
7
9
|
/**
|
|
@@ -58,6 +60,12 @@ export type SwitchProps = {
|
|
|
58
60
|
* Modifiers for the component.
|
|
59
61
|
*/
|
|
60
62
|
modifiers?: ExpoModifier[];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Children containing ThumbContent slot.
|
|
66
|
+
* @platform android
|
|
67
|
+
*/
|
|
68
|
+
children?: React.ReactNode;
|
|
61
69
|
} & (SwitchSwitchVariantProps | SwitchCheckboxVariantProps | SwitchButtonVariantProps);
|
|
62
70
|
|
|
63
71
|
export type SwitchSwitchVariantProps = {
|
|
@@ -87,11 +95,33 @@ type NativeSwitchProps = Omit<SwitchProps, 'onValueChange'> & {
|
|
|
87
95
|
onValueChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
|
|
88
96
|
};
|
|
89
97
|
|
|
98
|
+
type NativeSlotViewProps = {
|
|
99
|
+
slotName: string;
|
|
100
|
+
children: React.ReactNode;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type ThumbContentProps = {
|
|
104
|
+
children: React.ReactNode;
|
|
105
|
+
};
|
|
106
|
+
|
|
90
107
|
const SwitchNativeView: React.ComponentType<NativeSwitchProps> = requireNativeView(
|
|
91
108
|
'ExpoUI',
|
|
92
109
|
'SwitchView'
|
|
93
110
|
);
|
|
94
111
|
|
|
112
|
+
const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
|
|
113
|
+
'ExpoUI',
|
|
114
|
+
'SlotView'
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Custom content to be displayed inside the switch thumb.
|
|
119
|
+
* @platform android
|
|
120
|
+
*/
|
|
121
|
+
export function SwitchThumbContent(props: ThumbContentProps) {
|
|
122
|
+
return <SlotNativeView slotName="thumbContent">{props.children}</SlotNativeView>;
|
|
123
|
+
}
|
|
124
|
+
|
|
95
125
|
function getElementColors(props: SwitchProps) {
|
|
96
126
|
if (props.variant === 'button') {
|
|
97
127
|
return undefined;
|
|
@@ -110,21 +140,26 @@ function getElementColors(props: SwitchProps) {
|
|
|
110
140
|
return props.elementColors;
|
|
111
141
|
}
|
|
112
142
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*/
|
|
116
|
-
export function transformSwitchProps(props: SwitchProps): NativeSwitchProps {
|
|
143
|
+
function transformSwitchProps(props: SwitchProps): Omit<NativeSwitchProps, 'children'> {
|
|
144
|
+
const { modifiers, children, ...restProps } = props;
|
|
117
145
|
return {
|
|
118
|
-
|
|
146
|
+
modifiers,
|
|
147
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
148
|
+
...restProps,
|
|
119
149
|
variant: props.variant ?? 'switch',
|
|
120
150
|
elementColors: getElementColors(props),
|
|
121
151
|
color: props.color,
|
|
122
152
|
onValueChange: ({ nativeEvent: { value } }) => {
|
|
123
153
|
props?.onValueChange?.(value);
|
|
124
154
|
},
|
|
125
|
-
} as NativeSwitchProps
|
|
155
|
+
} as Omit<NativeSwitchProps, 'children'>;
|
|
126
156
|
}
|
|
127
157
|
|
|
128
|
-
|
|
129
|
-
return <SwitchNativeView {...transformSwitchProps(props)}
|
|
158
|
+
function SwitchComponent(props: SwitchProps) {
|
|
159
|
+
return <SwitchNativeView {...transformSwitchProps(props)}>{props.children}</SwitchNativeView>;
|
|
130
160
|
}
|
|
161
|
+
|
|
162
|
+
SwitchComponent.ThumbContent = SwitchThumbContent;
|
|
163
|
+
SwitchComponent.DefaultIconSize = ExpoUIModule.SwitchDefaultIconSize;
|
|
164
|
+
|
|
165
|
+
export { SwitchComponent as Switch };
|