@expo/ui 0.0.1 → 0.1.0-canary-20250131-5c4e588

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +14 -1
  3. package/android/src/main/java/expo/modules/ui/{SingleChoiceSegmentedControlView.kt → PickerView.kt} +3 -3
  4. package/android/src/main/java/expo/modules/ui/SliderView.kt +86 -0
  5. package/android/src/main/java/expo/modules/ui/SwitchView.kt +55 -0
  6. package/android/src/main/java/expo/modules/ui/button/Button.kt +58 -0
  7. package/build/components/Button/index.d.ts +65 -0
  8. package/build/components/Button/index.d.ts.map +1 -0
  9. package/build/components/Picker/index.d.ts +39 -0
  10. package/build/components/Picker/index.d.ts.map +1 -0
  11. package/build/components/Section/index.d.ts +12 -0
  12. package/build/components/Section/index.d.ts.map +1 -0
  13. package/build/components/Section/index.ios.d.ts +8 -0
  14. package/build/components/Section/index.ios.d.ts.map +1 -0
  15. package/build/components/Slider/index.d.ts +44 -0
  16. package/build/components/Slider/index.d.ts.map +1 -0
  17. package/build/components/Switch/index.d.ts +30 -0
  18. package/build/components/Switch/index.d.ts.map +1 -0
  19. package/build/src/index.d.ts +12 -0
  20. package/build/src/index.d.ts.map +1 -0
  21. package/components/Button/index.tsx +104 -0
  22. package/components/Picker/index.tsx +43 -0
  23. package/components/Section/index.ios.tsx +58 -0
  24. package/components/Section/index.tsx +56 -0
  25. package/components/Slider/index.tsx +66 -0
  26. package/components/Switch/index.tsx +37 -0
  27. package/expo-module.config.json +3 -10
  28. package/ios/Button/Button.swift +48 -0
  29. package/ios/Button/ButtonProps.swift +41 -0
  30. package/ios/ExpoUI.podspec +2 -1
  31. package/ios/ExpoUIModule.swift +5 -1
  32. package/ios/PickerView.swift +49 -0
  33. package/ios/SectionView.swift +27 -0
  34. package/ios/SliderView.swift +50 -0
  35. package/ios/SwitchView.swift +69 -0
  36. package/package.json +3 -4
  37. package/src/index.ts +13 -3
  38. package/tsconfig.json +1 -1
  39. package/build/ExpoUI.types.d.ts +0 -13
  40. package/build/ExpoUI.types.d.ts.map +0 -1
  41. package/build/ExpoUIModule.d.ts +0 -6
  42. package/build/ExpoUIModule.d.ts.map +0 -1
  43. package/build/ExpoUIView.d.ts +0 -4
  44. package/build/ExpoUIView.d.ts.map +0 -1
  45. package/build/index.d.ts +0 -4
  46. package/build/index.d.ts.map +0 -1
  47. package/ios/SingleChoiceSegmentedControlProps.swift +0 -10
  48. package/ios/SingleChoiceSegmentedControlView.swift +0 -29
  49. package/src/ExpoUI.types.ts +0 -8
  50. package/src/ExpoUIModule.ts +0 -5
  51. package/src/ExpoUIView.tsx +0 -10
package/CHANGELOG.md CHANGED
@@ -6,10 +6,15 @@
6
6
 
7
7
  ### 🎉 New features
8
8
 
9
+ - Add Button component.([#34340](https://github.com/expo/expo/pull/34340) by [@behenate](https://github.com/behenate))
10
+ - Apple TV support and source restructure. ([#34532](https://github.com/expo/expo/pull/34532) by [@douglowder](https://github.com/douglowder))
11
+
9
12
  ### 🐛 Bug fixes
10
13
 
11
14
  ### 💡 Others
12
15
 
16
+ - [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
17
+
13
18
  ## 0.0.1 — 2025-01-21
14
19
 
15
20
  ### 💡 Others
@@ -2,14 +2,27 @@ package expo.modules.ui
2
2
 
3
3
  import expo.modules.kotlin.modules.Module
4
4
  import expo.modules.kotlin.modules.ModuleDefinition
5
+ import expo.modules.ui.button.Button
5
6
 
6
7
  class ExpoUIModule : Module() {
7
8
  override fun definition() = ModuleDefinition {
8
9
  Name("ExpoUI")
9
10
 
10
11
  // Defines a single view for now – a single choice segmented control
11
- View(SingleChoiceSegmentedControlView::class) {
12
+ View(PickerView::class) {
12
13
  Events("onOptionSelected")
13
14
  }
15
+
16
+ View(SwitchView::class) {
17
+ Events("onCheckedChanged")
18
+ }
19
+
20
+ View(Button::class) {
21
+ Events("onButtonPressed")
22
+ }
23
+
24
+ View(SliderView::class) {
25
+ Events("onValueChanged")
26
+ }
14
27
  }
15
28
  }
@@ -14,13 +14,13 @@ import androidx.compose.runtime.remember
14
14
  import expo.modules.kotlin.AppContext
15
15
  import expo.modules.kotlin.views.ComposeProps
16
16
 
17
- data class SegmentedControlProps(
17
+ data class PickerProps(
18
18
  val options: MutableState<Array<String>> = mutableStateOf(emptyArray()),
19
19
  val selectedIndex: MutableState<Int?> = mutableStateOf(null)
20
20
  ) : ComposeProps
21
21
 
22
- class SingleChoiceSegmentedControlView(context: Context, appContext: AppContext) : ExpoComposeView<SegmentedControlProps>(context, appContext) {
23
- override val props = SegmentedControlProps()
22
+ class PickerView(context: Context, appContext: AppContext) : ExpoComposeView<PickerProps>(context, appContext) {
23
+ override val props = PickerProps()
24
24
  private val onOptionSelected by EventDispatcher()
25
25
 
26
26
  init {
@@ -0,0 +1,86 @@
1
+ package expo.modules.ui
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import android.os.Build
6
+ import androidx.annotation.RequiresApi
7
+ import androidx.compose.material3.SegmentedButton
8
+ import androidx.compose.material3.SegmentedButtonDefaults
9
+ import expo.modules.kotlin.viewevent.EventDispatcher
10
+ import expo.modules.kotlin.views.ExpoComposeView
11
+ import androidx.compose.material3.SingleChoiceSegmentedButtonRow
12
+ import androidx.compose.material3.Slider
13
+ import androidx.compose.material3.SliderDefaults
14
+ import androidx.compose.material3.Text
15
+ import androidx.compose.runtime.MutableState
16
+ import androidx.compose.runtime.getValue
17
+ import androidx.compose.runtime.mutableFloatStateOf
18
+ import androidx.compose.runtime.mutableIntStateOf
19
+ import androidx.compose.runtime.mutableStateOf
20
+ import androidx.compose.runtime.remember
21
+ import androidx.compose.ui.Modifier
22
+ import androidx.compose.ui.draw.alpha
23
+ import expo.modules.kotlin.AppContext
24
+ import expo.modules.kotlin.records.Field
25
+ import expo.modules.kotlin.records.Record
26
+ import expo.modules.kotlin.views.ComposeProps
27
+
28
+ class SliderColors : Record {
29
+ @Field
30
+ val thumbColor: Color? = null
31
+ @Field
32
+ val activeTrackColor: Color? = null
33
+ @Field
34
+ val inactiveTrackColor: Color? = null
35
+ @Field
36
+ val activeTickColor: Color? = null
37
+ @Field
38
+ val inactiveTickColor: Color? = null
39
+ }
40
+
41
+ fun convertColor(color: Color?): androidx.compose.ui.graphics.Color? {
42
+ return color?.let {
43
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
44
+ androidx.compose.ui.graphics.Color(it.red(), it.green(), it.blue(), it.alpha())
45
+ } else {
46
+ null
47
+ }
48
+ }
49
+ }
50
+
51
+ data class SliderProps(
52
+ val value: MutableState<Float> = mutableFloatStateOf(0.0f),
53
+ val min: MutableState<Float> = mutableFloatStateOf(0.0f),
54
+ val max: MutableState<Float> = mutableFloatStateOf(1.0f),
55
+ val steps: MutableState<Int> = mutableIntStateOf(0),
56
+ val colors: MutableState<SliderColors> = mutableStateOf(SliderColors())
57
+ ): ComposeProps
58
+
59
+ class SliderView(context: Context, appContext: AppContext) : ExpoComposeView<SliderProps>(context, appContext) {
60
+ override val props = SliderProps()
61
+ private val onValueChanged by EventDispatcher()
62
+
63
+ init {
64
+ setContent {
65
+ val (value) = props.value
66
+ val (min) = props.min
67
+ val (max) = props.max
68
+ val (steps) = props.steps
69
+ Slider(
70
+ value = value.coerceAtLeast(min).coerceAtMost(max),
71
+ valueRange = min..max,
72
+ steps = steps,
73
+ onValueChange = {
74
+ onValueChanged(mapOf("value" to it))
75
+ },
76
+ colors = SliderDefaults.colors(
77
+ thumbColor = convertColor(props.colors.value.thumbColor) ?: SliderDefaults.colors().thumbColor,
78
+ activeTrackColor = convertColor(props.colors.value.activeTrackColor) ?: SliderDefaults.colors().activeTrackColor,
79
+ inactiveTrackColor = convertColor(props.colors.value.inactiveTrackColor) ?: SliderDefaults.colors().inactiveTrackColor,
80
+ activeTickColor = convertColor(props.colors.value.activeTickColor) ?: SliderDefaults.colors().activeTickColor,
81
+ inactiveTickColor = convertColor(props.colors.value.inactiveTickColor) ?: SliderDefaults.colors().inactiveTickColor,
82
+ )
83
+ )
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,55 @@
1
+ package expo.modules.ui
2
+
3
+ import android.content.Context
4
+ import androidx.compose.material3.Checkbox
5
+ import expo.modules.kotlin.viewevent.EventDispatcher
6
+ import expo.modules.kotlin.views.ExpoComposeView
7
+ import androidx.compose.material3.Switch
8
+ import androidx.compose.material3.Button
9
+ import androidx.compose.runtime.Composable
10
+ import androidx.compose.runtime.MutableState
11
+ import androidx.compose.runtime.mutableStateOf
12
+ import expo.modules.kotlin.AppContext
13
+ import expo.modules.kotlin.views.ComposeProps
14
+
15
+ data class SwitchProps(
16
+ val checked: MutableState<Boolean> = mutableStateOf(false),
17
+ val variant: MutableState<String> = mutableStateOf("switch")
18
+ ): ComposeProps
19
+
20
+ class SwitchView(context: Context, appContext: AppContext) : ExpoComposeView<SwitchProps>(context, appContext) {
21
+ override val props = SwitchProps()
22
+ private val onCheckedChanged by EventDispatcher()
23
+
24
+ init {
25
+ setContent {
26
+ val (checked) = props.checked
27
+ val (variant) = props.variant
28
+ val onCheckedChange = { checked: Boolean ->
29
+ onCheckedChanged(mapOf("checked" to checked))
30
+ }
31
+
32
+ @Composable
33
+ fun SwitchComposable() {
34
+ Switch(
35
+ checked = checked,
36
+ onCheckedChange = onCheckedChange
37
+ )
38
+ }
39
+
40
+ @Composable
41
+ fun CheckboxComposable() {
42
+ Checkbox(
43
+ checked = checked,
44
+ onCheckedChange = onCheckedChange
45
+ )
46
+ }
47
+
48
+ if (variant == "switch") {
49
+ SwitchComposable()
50
+ } else {
51
+ CheckboxComposable()
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,58 @@
1
+ package expo.modules.ui.button
2
+
3
+ import android.content.Context
4
+ import androidx.compose.foundation.layout.RowScope
5
+ import androidx.compose.material3.ElevatedButton
6
+ import androidx.compose.material3.FilledTonalButton
7
+ import androidx.compose.material3.OutlinedButton
8
+ import expo.modules.kotlin.viewevent.EventDispatcher
9
+ import expo.modules.kotlin.views.ExpoComposeView
10
+ import androidx.compose.material3.Text
11
+ import androidx.compose.material3.TextButton
12
+ import androidx.compose.runtime.Composable
13
+ import androidx.compose.runtime.MutableState
14
+ import androidx.compose.runtime.getValue
15
+ import androidx.compose.runtime.mutableStateOf
16
+ import androidx.compose.runtime.remember
17
+ import expo.modules.kotlin.AppContext
18
+ import expo.modules.kotlin.views.ComposeProps
19
+
20
+ enum class ButtonVariant(val value: String) {
21
+ DEFAULT("default"),
22
+ BORDERED("bordered"),
23
+ BORDERLESS("borderless"),
24
+ OUTLINED("outlined"),
25
+ ELEVATED("elevated")
26
+ }
27
+
28
+ data class ButtonProps(
29
+ val text: MutableState<String> = mutableStateOf(""),
30
+ val variant: MutableState<ButtonVariant?> = mutableStateOf(ButtonVariant.DEFAULT)
31
+ ) : ComposeProps
32
+
33
+ @Composable
34
+ fun StyledButton(style: ButtonVariant, onPress: () -> Unit, content: @Composable (RowScope.() -> Unit)) {
35
+ when (style) {
36
+ ButtonVariant.DEFAULT -> androidx.compose.material3.Button(onPress, content = content)
37
+ ButtonVariant.BORDERED -> FilledTonalButton(onPress, content = content)
38
+ ButtonVariant.BORDERLESS -> TextButton(onPress, content = content)
39
+ ButtonVariant.OUTLINED -> OutlinedButton(onPress, content = content)
40
+ ButtonVariant.ELEVATED -> ElevatedButton(onPress, content = content)
41
+ else -> androidx.compose.material3.Button(onPress, content = content)
42
+ }
43
+ }
44
+
45
+ class Button(context: Context, appContext: AppContext) : ExpoComposeView<ButtonProps>(context, appContext) {
46
+ override val props = ButtonProps()
47
+ private val onButtonPressed by EventDispatcher<Unit>()
48
+
49
+ init {
50
+ setContent {
51
+ val variant by remember { props.variant }
52
+ val text by remember { props.text }
53
+ StyledButton(variant ?: ButtonVariant.DEFAULT, { onButtonPressed.invoke(Unit) }) {
54
+ Text(text)
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,65 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ /**
3
+ * The role of the button.
4
+ * - `default` - The default button role.
5
+ * - `cancel` - A button that cancels the current operation.
6
+ * - `destructive` - A button that deletes data or performs a destructive action.
7
+ * @platform ios
8
+ */
9
+ export type ButtonRole = 'default' | 'cancel' | 'destructive';
10
+ /**
11
+ * The built-in button styles available on iOS and Android.
12
+ * Common styles:
13
+ * - `default` - The default system button style.
14
+ * - `bordered` - A button with a light fill. On Android equivalent to `FilledTonalButton`.
15
+ * - `borderless` - A button with no background or border. On Android equivalent to `TextButton`.
16
+ * Apple-only styles:
17
+ * - `borderedProminent` - A bordered button with a prominent appearance.
18
+ * - `plain` - A button with no border or background and a less prominent text.
19
+ * MacOS-only styles:
20
+ * - `accessoryBar` - A button style for accessory bars.
21
+ * - `accessoryBarAction` - A button style for accessory bar actions.
22
+ * - `card` - A button style for cards.
23
+ * - `link` - A button style for links.
24
+ * Android-only styles:
25
+ * - `outlined` - A button with an outline.
26
+ * - `elevated` - A filled button with a shadow.
27
+ *
28
+ * @platform android
29
+ * @platform ios
30
+ */
31
+ export type ButtonVariant = 'default' | 'bordered' | 'plain' | 'borderedProminent' | 'borderless' | 'accessoryBar' | 'accessoryBarAction' | 'card' | 'link' | 'outlined' | 'elevated';
32
+ export type ButtonProps = {
33
+ /**
34
+ * The text to display inside the button.
35
+ */
36
+ text: string;
37
+ /**
38
+ * A callback that is called when the button is pressed.
39
+ */
40
+ onPress?: () => void;
41
+ /**
42
+ * A string describing the system image to display in the button.
43
+ * @platform ios
44
+ */
45
+ systemImage?: string;
46
+ /**
47
+ * Indicated the role of the button.
48
+ * @platform ios
49
+ */
50
+ role?: ButtonRole;
51
+ /**
52
+ * The button variant.
53
+ */
54
+ variant?: ButtonVariant;
55
+ /**
56
+ * Additional styles to apply to the button.
57
+ */
58
+ style?: StyleProp<ViewStyle>;
59
+ };
60
+ export type NativeButtonProps = Omit<Omit<ButtonProps, 'role'>, 'onPress'> & {
61
+ buttonRole?: ButtonRole;
62
+ onButtonPressed?: () => void;
63
+ };
64
+ export declare function Button(props: ButtonProps): import("react").JSX.Element;
65
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Button/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,GAErB,SAAS,GACT,UAAU,GACV,OAAO,GAEP,mBAAmB,GACnB,YAAY,GAEZ,cAAc,GACd,oBAAoB,GACpB,MAAM,GACN,MAAM,GAEN,UAAU,GACV,UAAU,CAAC;AAEf,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG;IAC3E,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAOF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAaxC"}
@@ -0,0 +1,39 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ /**
3
+ * Props for the Picker component.
4
+ */
5
+ export type PickerProps = {
6
+ /**
7
+ * An array of options to be displayed in the picker.
8
+ */
9
+ options: string[];
10
+ /**
11
+ * The index of the currently selected option.
12
+ */
13
+ selectedIndex: number | null;
14
+ /**
15
+ * A label displayed on the picker when in `menu` variant inside a form section on iOS.
16
+ * @platform iOS
17
+ */
18
+ label?: string;
19
+ /**
20
+ * Callback function that is called when an option is selected.
21
+ */
22
+ onOptionSelected?: (event: {
23
+ nativeEvent: {
24
+ index: number;
25
+ label: string;
26
+ };
27
+ }) => void;
28
+ /**
29
+ * The variant of the picker, which determines its appearance and behavior.
30
+ * The 'wheel' and 'menu' variants are iOS only.
31
+ */
32
+ variant: 'wheel' | 'segmented' | 'menu';
33
+ /**
34
+ * Optional style to apply to the picker component.
35
+ */
36
+ style?: StyleProp<ViewStyle>;
37
+ };
38
+ export declare function Picker(props: PickerProps): import("react").JSX.Element;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Picker/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACtF;;;OAGG;IACH,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAOF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export type SectionProps = {
4
+ style?: StyleProp<ViewStyle>;
5
+ title: string;
6
+ children: any;
7
+ };
8
+ export declare function Section({ title, children }: {
9
+ title: string;
10
+ children: React.ReactNode;
11
+ }): React.JSX.Element;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Section/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAkBF,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBA8BxF"}
@@ -0,0 +1,8 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ export type SectionProps = {
3
+ title: string;
4
+ style?: StyleProp<ViewStyle>;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare function Section(props: SectionProps): import("react").JSX.Element;
8
+ //# sourceMappingURL=index.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.ios.d.ts","sourceRoot":"","sources":["../../../components/Section/index.ios.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAWF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAsC1C"}
@@ -0,0 +1,44 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ export type SliderProps = {
3
+ /**
4
+ * Custom styles for the slider component.
5
+ */
6
+ style?: StyleProp<ViewStyle>;
7
+ /**
8
+ * The current value of the slider.
9
+ * @default 0
10
+ */
11
+ value?: number;
12
+ /**
13
+ * The number of steps between the minimum and maximum values. 0 signifies infinite steps.
14
+ * @default 0
15
+ */
16
+ steps?: number;
17
+ /**
18
+ * The mininum value of the slider. Updating this value does not trigger callbacks if the current value is below `min`.
19
+ * @default 0
20
+ */
21
+ min?: number;
22
+ /**
23
+ * The maximum value of the slider. Updating this value does not trigger callbacks if the current value is above `max`.
24
+ * @default 1
25
+ */
26
+ max?: number;
27
+ /**
28
+ * Colors for slider's core elements.
29
+ * @platform android
30
+ */
31
+ colors?: {
32
+ thumbColor?: string;
33
+ activeTrackColor?: string;
34
+ inactiveTrackColor?: string;
35
+ activeTickColor?: string;
36
+ inactiveTickColor?: string;
37
+ };
38
+ /**
39
+ * Callback triggered on dragging along the slider.
40
+ */
41
+ onValueChange?: (value: number) => void;
42
+ };
43
+ export declare function Slider(props: SliderProps): import("react").JSX.Element;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Slider/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAMF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAcxC"}
@@ -0,0 +1,30 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ export type SwitchProps = {
3
+ /**
4
+ * Indicates whether the switch is checked.
5
+ */
6
+ checked: boolean;
7
+ /**
8
+ * Label for the switch.
9
+ * @platform android
10
+ */
11
+ label?: string;
12
+ /**
13
+ * Type of the switch component. Can be 'checkbox', 'switch', or 'button'. The 'button' style is iOS only.
14
+ */
15
+ variant: 'checkbox' | 'switch' | 'button';
16
+ /**
17
+ * Callback function that is called when the checked state changes.
18
+ */
19
+ onCheckedChanged: (event: {
20
+ nativeEvent: {
21
+ checked: boolean;
22
+ };
23
+ }) => void;
24
+ /**
25
+ * Optional style for the switch component.
26
+ */
27
+ style?: StyleProp<ViewStyle>;
28
+ };
29
+ export declare function Switch(props: SwitchProps): import("react").JSX.Element;
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Switch/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE1C;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACzE;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAOF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
@@ -0,0 +1,12 @@
1
+ export type { Switch, SwitchProps } from '../components/Switch';
2
+ export type { Picker, PickerProps } from '../components/Picker';
3
+ export type { Button, ButtonProps } from '../components/Button';
4
+ export type { Section, SectionProps } from '../components/Section';
5
+ export type { Slider, SliderProps } from '../components/Slider';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export type ViewEvent<Name extends string, Data extends object> = Record<Name, (event: {
10
+ nativeEvent: Data;
11
+ }) => void>;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,MAAM,CACtE,IAAI,EACJ,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,KAAK,IAAI,CACvC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ /**
5
+ * The role of the button.
6
+ * - `default` - The default button role.
7
+ * - `cancel` - A button that cancels the current operation.
8
+ * - `destructive` - A button that deletes data or performs a destructive action.
9
+ * @platform ios
10
+ */
11
+ export type ButtonRole = 'default' | 'cancel' | 'destructive';
12
+
13
+ /**
14
+ * The built-in button styles available on iOS and Android.
15
+ * Common styles:
16
+ * - `default` - The default system button style.
17
+ * - `bordered` - A button with a light fill. On Android equivalent to `FilledTonalButton`.
18
+ * - `borderless` - A button with no background or border. On Android equivalent to `TextButton`.
19
+ * Apple-only styles:
20
+ * - `borderedProminent` - A bordered button with a prominent appearance.
21
+ * - `plain` - A button with no border or background and a less prominent text.
22
+ * MacOS-only styles:
23
+ * - `accessoryBar` - A button style for accessory bars.
24
+ * - `accessoryBarAction` - A button style for accessory bar actions.
25
+ * - `card` - A button style for cards.
26
+ * - `link` - A button style for links.
27
+ * Android-only styles:
28
+ * - `outlined` - A button with an outline.
29
+ * - `elevated` - A filled button with a shadow.
30
+ *
31
+ * @platform android
32
+ * @platform ios
33
+ */
34
+ export type ButtonVariant =
35
+ // Common
36
+ | 'default'
37
+ | 'bordered'
38
+ | 'plain'
39
+ // Apple-only
40
+ | 'borderedProminent'
41
+ | 'borderless'
42
+ // MacOS-only;
43
+ | 'accessoryBar'
44
+ | 'accessoryBarAction'
45
+ | 'card'
46
+ | 'link'
47
+ // Android-only;
48
+ | 'outlined'
49
+ | 'elevated';
50
+
51
+ export type ButtonProps = {
52
+ /**
53
+ * The text to display inside the button.
54
+ */
55
+ text: string;
56
+ /**
57
+ * A callback that is called when the button is pressed.
58
+ */
59
+ onPress?: () => void;
60
+ /**
61
+ * A string describing the system image to display in the button.
62
+ * @platform ios
63
+ */
64
+ systemImage?: string;
65
+ /**
66
+ * Indicated the role of the button.
67
+ * @platform ios
68
+ */
69
+ role?: ButtonRole;
70
+ /**
71
+ * The button variant.
72
+ */
73
+ variant?: ButtonVariant;
74
+ /**
75
+ * Additional styles to apply to the button.
76
+ */
77
+ style?: StyleProp<ViewStyle>;
78
+ };
79
+
80
+ // We have to work around the `role` and `onPress` props being reserved by React Native.
81
+ export type NativeButtonProps = Omit<Omit<ButtonProps, 'role'>, 'onPress'> & {
82
+ buttonRole?: ButtonRole;
83
+ onButtonPressed?: () => void;
84
+ };
85
+
86
+ const ButtonNativeView: React.ComponentType<NativeButtonProps> = requireNativeView(
87
+ 'ExpoUI',
88
+ 'Button'
89
+ );
90
+
91
+ export function Button(props: ButtonProps) {
92
+ // We have to work around the `role` and `onPress` props being reserved by React Native.
93
+ const restProps = { ...props, role: null, onPress: null };
94
+
95
+ // Min height from https://m3.material.io/components/buttons/specs, minWidth
96
+ return (
97
+ <ButtonNativeView
98
+ style={[{ minWidth: 80, minHeight: 40 }, props.style]}
99
+ buttonRole={props.role}
100
+ onButtonPressed={props.onPress}
101
+ {...restProps}
102
+ />
103
+ );
104
+ }
@@ -0,0 +1,43 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ /**
5
+ * Props for the Picker component.
6
+ */
7
+ export type PickerProps = {
8
+ /**
9
+ * An array of options to be displayed in the picker.
10
+ */
11
+ options: string[];
12
+ /**
13
+ * The index of the currently selected option.
14
+ */
15
+ selectedIndex: number | null;
16
+ /**
17
+ * A label displayed on the picker when in `menu` variant inside a form section on iOS.
18
+ * @platform iOS
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Callback function that is called when an option is selected.
23
+ */
24
+ onOptionSelected?: (event: { nativeEvent: { index: number; label: string } }) => void;
25
+ /**
26
+ * The variant of the picker, which determines its appearance and behavior.
27
+ * The 'wheel' and 'menu' variants are iOS only.
28
+ */
29
+ variant: 'wheel' | 'segmented' | 'menu';
30
+ /**
31
+ * Optional style to apply to the picker component.
32
+ */
33
+ style?: StyleProp<ViewStyle>;
34
+ };
35
+
36
+ const PickerNativeView: React.ComponentType<PickerProps> = requireNativeView(
37
+ 'ExpoUI',
38
+ 'PickerView'
39
+ );
40
+
41
+ export function Picker(props: PickerProps) {
42
+ return <PickerNativeView {...props} />;
43
+ }