@expo/ui 55.0.9 → 55.0.11

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 (79) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +11 -7
  4. package/android/src/main/java/expo/modules/ui/TextFieldView.kt +326 -0
  5. package/build/jetpack-compose/SlotView.d.ts +7 -0
  6. package/build/jetpack-compose/SlotView.d.ts.map +1 -0
  7. package/build/jetpack-compose/TextField/index.d.ts +177 -0
  8. package/build/jetpack-compose/TextField/index.d.ts.map +1 -0
  9. package/build/jetpack-compose/index.d.ts +1 -1
  10. package/build/swift-ui/SecureField/index.d.ts +9 -20
  11. package/build/swift-ui/SecureField/index.d.ts.map +1 -1
  12. package/build/swift-ui/TextField/index.d.ts +17 -63
  13. package/build/swift-ui/TextField/index.d.ts.map +1 -1
  14. package/build/swift-ui/modifiers/index.d.ts +65 -4
  15. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  16. package/expo-module.config.json +1 -1
  17. package/ios/Modifiers/KeyboardTypeModifier.swift +68 -0
  18. package/ios/Modifiers/LineLimitModifier.swift +29 -0
  19. package/ios/Modifiers/OnSubmitModifier.swift +21 -0
  20. package/ios/Modifiers/ScrollTargetBehaviorModifier.swift +26 -0
  21. package/ios/Modifiers/ScrollTargetLayoutModifier.swift +14 -0
  22. package/ios/Modifiers/TextContentTypeModifier.swift +191 -0
  23. package/ios/Modifiers/TextInputAutocapitalizationModifier.swift +28 -0
  24. package/ios/Modifiers/ViewModifierRegistry.swift +28 -8
  25. package/ios/SecureFieldView.swift +5 -12
  26. package/ios/TextFieldView.swift +26 -94
  27. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.9/expo.modules.ui-55.0.9-sources.jar → 55.0.11/expo.modules.ui-55.0.11-sources.jar} +0 -0
  28. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.md5 +1 -0
  29. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha1 +1 -0
  30. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha256 +1 -0
  31. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha512 +1 -0
  32. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar +0 -0
  33. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.md5 +1 -0
  34. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha1 +1 -0
  35. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha256 +1 -0
  36. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha512 +1 -0
  37. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.9/expo.modules.ui-55.0.9.module → 55.0.11/expo.modules.ui-55.0.11.module} +22 -22
  38. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.md5 +1 -0
  39. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha1 +1 -0
  40. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha256 +1 -0
  41. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha512 +1 -0
  42. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.9/expo.modules.ui-55.0.9.pom → 55.0.11/expo.modules.ui-55.0.11.pom} +1 -1
  43. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.md5 +1 -0
  44. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha1 +1 -0
  45. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha256 +1 -0
  46. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha512 +1 -0
  47. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  48. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  49. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  50. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  51. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  52. package/package.json +2 -2
  53. package/src/jetpack-compose/SlotView.tsx +15 -0
  54. package/src/jetpack-compose/TextField/index.tsx +276 -0
  55. package/src/jetpack-compose/index.ts +1 -1
  56. package/src/swift-ui/SecureField/index.tsx +18 -36
  57. package/src/swift-ui/TextField/index.tsx +30 -91
  58. package/src/swift-ui/modifiers/index.ts +151 -3
  59. package/android/src/main/java/expo/modules/ui/TextInputView.kt +0 -124
  60. package/build/jetpack-compose/TextInput/index.d.ts +0 -105
  61. package/build/jetpack-compose/TextInput/index.d.ts.map +0 -1
  62. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9-sources.jar.md5 +0 -1
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9-sources.jar.sha1 +0 -1
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9-sources.jar.sha256 +0 -1
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9-sources.jar.sha512 +0 -1
  66. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.aar +0 -0
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.aar.md5 +0 -1
  68. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.aar.sha1 +0 -1
  69. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.aar.sha256 +0 -1
  70. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.aar.sha512 +0 -1
  71. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.module.md5 +0 -1
  72. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.module.sha1 +0 -1
  73. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.module.sha256 +0 -1
  74. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.module.sha512 +0 -1
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.pom.md5 +0 -1
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.pom.sha1 +0 -1
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.pom.sha256 +0 -1
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.9/expo.modules.ui-55.0.9.pom.sha512 +0 -1
  79. package/src/jetpack-compose/TextInput/index.tsx +0 -157
@@ -607,6 +607,24 @@ export const defaultScrollAnchorForRole = (
607
607
  role: 'initialOffset' | 'sizeChanges' | 'alignment'
608
608
  ) => createModifier('defaultScrollAnchorForRole', { anchor, role });
609
609
 
610
+ /**
611
+ * Sets the scroll snapping behavior for scrollable views.
612
+ * Use with `scrollTargetLayout` on the content container.
613
+ * @param behavior - `'paging'` for container-aligned snapping, `'viewAligned'` for view-aligned snapping.
614
+ * @platform ios 17.0+
615
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/scrolltargetbehavior(_:)).
616
+ */
617
+ export const scrollTargetBehavior = (behavior: 'paging' | 'viewAligned') =>
618
+ createModifier('scrollTargetBehavior', { behavior });
619
+
620
+ /**
621
+ * Configures a layout container as a scroll target layout for view-aligned snapping.
622
+ * Apply to `VStack` or `HStack` inside a `ScrollView`.
623
+ * @platform ios 17.0+
624
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/scrolltargetlayout(isenabled:)).
625
+ */
626
+ export const scrollTargetLayout = () => createModifier('scrollTargetLayout', {});
627
+
610
628
  /**
611
629
  * Disables the move action for a view in a list.
612
630
  * Apply to items within a `ForEach` to prevent them from being moved.
@@ -833,11 +851,31 @@ export const textSelection = (value: boolean) => createModifier('textSelection',
833
851
  */
834
852
  export const lineSpacing = (value: number) => createModifier('lineSpacing', { value });
835
853
  /**
836
- * Sets the maximum number of lines that text can occupy in the view.
837
- * @param limit - The maximum number of lines.
854
+ * Sets the line limit for text in the view.
855
+ *
856
+ * Four variants matching SwiftUI:
857
+ * - `lineLimit()` — no line limit (unlimited lines)
858
+ * - `lineLimit(5)` — max 5 lines
859
+ * - `lineLimit(5, { reservesSpace: true })` — max 5 lines, reserves height even when empty (iOS 16+, tvOS 16+)
860
+ * - `lineLimit({ min: 3, max: 8 })` — range of 3 to 8 lines (iOS 16+, tvOS 16+)
861
+ *
838
862
  * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/linelimit(_:)).
839
863
  */
840
- export const lineLimit = (limit?: number) => createModifier('lineLimit', { limit });
864
+ export function lineLimit(): ModifierConfig;
865
+ export function lineLimit(limit: number, options?: { reservesSpace?: boolean }): ModifierConfig;
866
+ export function lineLimit(range: { min: number; max: number }): ModifierConfig;
867
+ export function lineLimit(
868
+ limitOrRange?: number | { min: number; max: number },
869
+ options?: { reservesSpace?: boolean }
870
+ ): ModifierConfig {
871
+ if (typeof limitOrRange === 'object' && limitOrRange !== null) {
872
+ return createModifier('lineLimit', { min: limitOrRange.min, max: limitOrRange.max });
873
+ }
874
+ return createModifier('lineLimit', {
875
+ limit: limitOrRange,
876
+ reservesSpace: options?.reservesSpace,
877
+ });
878
+ }
841
879
  /**
842
880
  * Sets the header prominence for this view.
843
881
  * @param prominence - The prominence to apply.
@@ -999,6 +1037,109 @@ export const submitLabel = (
999
1037
  submitLabel: 'continue' | 'done' | 'go' | 'join' | 'next' | 'return' | 'route' | 'search' | 'send'
1000
1038
  ) => createModifier('submitLabel', { submitLabel });
1001
1039
 
1040
+ /**
1041
+ * Sets the keyboard type for text input views.
1042
+ * @param keyboardType - The type of keyboard to display.
1043
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/keyboardtype(_:)).
1044
+ */
1045
+ export const keyboardType = (
1046
+ keyboardType:
1047
+ | 'default'
1048
+ | 'email-address'
1049
+ | 'numeric'
1050
+ | 'phone-pad'
1051
+ | 'ascii-capable'
1052
+ | 'numbers-and-punctuation'
1053
+ | 'url'
1054
+ | 'name-phone-pad'
1055
+ | 'decimal-pad'
1056
+ | 'twitter'
1057
+ | 'web-search'
1058
+ | 'ascii-capable-number-pad'
1059
+ ) => createModifier('keyboardType', { keyboardType });
1060
+
1061
+ /**
1062
+ * Disables autocorrection for text input views.
1063
+ * @param disabled - Whether autocorrection is disabled. Defaults to `true`.
1064
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/autocorrectiondisabled(_:)).
1065
+ */
1066
+ export const autocorrectionDisabled = (disabled: boolean = true) =>
1067
+ createModifier('autocorrectionDisabled', { disabled });
1068
+
1069
+ /**
1070
+ * Adds an action to perform when the user submits a value to this view (e.g. pressing return in a text field).
1071
+ * @param handler - Function to call on submit.
1072
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/onsubmit(of:_:)).
1073
+ */
1074
+ export const onSubmit = (handler: () => void) =>
1075
+ createModifierWithEventListener('onSubmit', handler);
1076
+
1077
+ /**
1078
+ * Sets how often the shift key in the keyboard is automatically enabled.
1079
+ * @param autocapitalization - The autocapitalization behavior.
1080
+ * @platform ios 15.0+
1081
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/textinputautocapitalization(_:)).
1082
+ */
1083
+ export const textInputAutocapitalization = (
1084
+ autocapitalization: 'never' | 'words' | 'sentences' | 'characters'
1085
+ ) => createModifier('textInputAutocapitalization', { autocapitalization });
1086
+
1087
+ /**
1088
+ * Sets the text content type for input text, which the system uses to offer
1089
+ * suggestions (like autofill) while the user enters text.
1090
+ * @param textContentType - The semantic meaning of the text input area.
1091
+ * @platform ios 13.0+
1092
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/textcontenttype(_:)-ufdv).
1093
+ */
1094
+ export const textContentType = (
1095
+ textContentType:
1096
+ | 'URL'
1097
+ | 'namePrefix'
1098
+ | 'name'
1099
+ | 'nameSuffix'
1100
+ | 'givenName'
1101
+ | 'middleName'
1102
+ | 'familyName'
1103
+ | 'nickname'
1104
+ | 'organizationName'
1105
+ | 'jobTitle'
1106
+ | 'location'
1107
+ | 'fullStreetAddress'
1108
+ | 'streetAddressLine1'
1109
+ | 'streetAddressLine2'
1110
+ | 'addressCity'
1111
+ | 'addressCityAndState'
1112
+ | 'addressState'
1113
+ | 'postalCode'
1114
+ | 'sublocality'
1115
+ | 'countryName'
1116
+ | 'username'
1117
+ | 'password'
1118
+ | 'newPassword'
1119
+ | 'oneTimeCode'
1120
+ | 'emailAddress'
1121
+ | 'telephoneNumber'
1122
+ | 'cellularEID'
1123
+ | 'cellularIMEI'
1124
+ | 'creditCardNumber'
1125
+ | 'creditCardExpiration'
1126
+ | 'creditCardExpirationMonth'
1127
+ | 'creditCardExpirationYear'
1128
+ | 'creditCardSecurityCode'
1129
+ | 'creditCardType'
1130
+ | 'creditCardName'
1131
+ | 'creditCardGivenName'
1132
+ | 'creditCardMiddleName'
1133
+ | 'creditCardFamilyName'
1134
+ | 'birthdate'
1135
+ | 'birthdateDay'
1136
+ | 'birthdateMonth'
1137
+ | 'birthdateYear'
1138
+ | 'dateTime'
1139
+ | 'flightNumber'
1140
+ | 'shipmentTrackingNumber'
1141
+ ) => createModifier('textContentType', { textContentType });
1142
+
1002
1143
  /**
1003
1144
  * Sets the content transition type for a view.
1004
1145
  * Useful for animating changes in text content, especially numeric text.
@@ -1130,6 +1271,8 @@ export type BuiltInModifier =
1130
1271
  | ReturnType<typeof scrollDisabled>
1131
1272
  | ReturnType<typeof defaultScrollAnchor>
1132
1273
  | ReturnType<typeof defaultScrollAnchorForRole>
1274
+ | ReturnType<typeof scrollTargetBehavior>
1275
+ | ReturnType<typeof scrollTargetLayout>
1133
1276
  | ReturnType<typeof moveDisabled>
1134
1277
  | ReturnType<typeof deleteDisabled>
1135
1278
  | ReturnType<typeof environment>
@@ -1156,6 +1299,11 @@ export type BuiltInModifier =
1156
1299
  | ReturnType<typeof gridColumnAlignment>
1157
1300
  | ReturnType<typeof gridCellAnchor>
1158
1301
  | ReturnType<typeof submitLabel>
1302
+ | ReturnType<typeof keyboardType>
1303
+ | ReturnType<typeof autocorrectionDisabled>
1304
+ | ReturnType<typeof onSubmit>
1305
+ | ReturnType<typeof textInputAutocapitalization>
1306
+ | ReturnType<typeof textContentType>
1159
1307
  | ReturnType<typeof datePickerStyle>
1160
1308
  | ReturnType<typeof progressViewStyle>
1161
1309
  | ReturnType<typeof gaugeStyle>
@@ -1,124 +0,0 @@
1
- package expo.modules.ui
2
-
3
- import android.annotation.SuppressLint
4
- import android.content.Context
5
- import androidx.compose.foundation.text.KeyboardOptions
6
- import androidx.compose.material3.OutlinedTextField
7
- import androidx.compose.material3.Text
8
- import androidx.compose.material3.TextField
9
- import androidx.compose.runtime.Composable
10
- import androidx.compose.runtime.MutableState
11
- import androidx.compose.runtime.mutableStateOf
12
- import androidx.compose.ui.text.input.KeyboardCapitalization
13
- import androidx.compose.ui.text.input.KeyboardType
14
- import expo.modules.kotlin.AppContext
15
- import expo.modules.kotlin.types.Enumerable
16
- import expo.modules.kotlin.viewevent.EventDispatcher
17
- import expo.modules.kotlin.views.ComposableScope
18
- import expo.modules.kotlin.views.ComposeProps
19
- import expo.modules.kotlin.views.ExpoComposeView
20
-
21
- enum class TextInputViewVariant(val value: String) : Enumerable {
22
- FILLED("filled"),
23
- OUTLINED("outlined"),
24
- }
25
-
26
- data class TextInputProps(
27
- val defaultValue: MutableState<String> = mutableStateOf(""),
28
- val placeholder: MutableState<String> = mutableStateOf(""),
29
- val variant: MutableState<TextInputViewVariant> = mutableStateOf(TextInputViewVariant.FILLED),
30
- val multiline: MutableState<Boolean> = mutableStateOf(false),
31
- val numberOfLines: MutableState<Int?> = mutableStateOf(null),
32
- val keyboardType: MutableState<String> = mutableStateOf("default"),
33
- val autocorrection: MutableState<Boolean> = mutableStateOf(true),
34
- val autoCapitalize: MutableState<String> = mutableStateOf("none"),
35
- val modifiers: MutableState<ModifierList> = mutableStateOf(emptyList()),
36
- ) : ComposeProps
37
-
38
- private fun String.keyboardType(): KeyboardType {
39
- return when (this) {
40
- "default" -> KeyboardType.Text
41
- "numeric" -> KeyboardType.Number
42
- "email-address" -> KeyboardType.Email
43
- "phone-pad" -> KeyboardType.Phone
44
- "decimal-pad" -> KeyboardType.Decimal
45
- "password" -> KeyboardType.Password
46
- "ascii-capable" -> KeyboardType.Ascii
47
- "url" -> KeyboardType.Uri
48
- "number-password" -> KeyboardType.NumberPassword
49
- else -> KeyboardType.Text
50
- }
51
- }
52
-
53
- private fun String.autoCapitalize(): KeyboardCapitalization {
54
- return when (this) {
55
- "characters" -> KeyboardCapitalization.Characters
56
- "none" -> KeyboardCapitalization.None
57
- "sentences" -> KeyboardCapitalization.Sentences
58
- "unspecified" -> KeyboardCapitalization.Unspecified
59
- "words" -> KeyboardCapitalization.Words
60
- else -> KeyboardCapitalization.None
61
- }
62
- }
63
-
64
- @SuppressLint("ViewConstructor")
65
- class TextInputView(context: Context, appContext: AppContext) :
66
- ExpoComposeView<TextInputProps>(context, appContext) {
67
- override val props = TextInputProps()
68
- private val onValueChanged by EventDispatcher()
69
-
70
- private val textState = mutableStateOf<String?>(null)
71
-
72
- var text: String?
73
- get() = textState.value
74
- set(value) {
75
- textState.value = value
76
- onValueChanged(mapOf("value" to (value ?: "")))
77
- }
78
-
79
- @Composable
80
- override fun ComposableScope.Content() {
81
- val value = textState.value ?: props.defaultValue.value
82
- val onValueChange: (String) -> Unit = {
83
- textState.value = it
84
- onValueChanged(mapOf("value" to it))
85
- }
86
- val placeholder: @Composable () -> Unit = { Text(props.placeholder.value) }
87
- val maxLines = if (props.multiline.value) props.numberOfLines.value ?: Int.MAX_VALUE else 1
88
- val singleLine = !props.multiline.value
89
- val keyboardOptions = KeyboardOptions.Default.copy(
90
- keyboardType = props.keyboardType.value.keyboardType(),
91
- autoCorrectEnabled = props.autocorrection.value,
92
- capitalization = props.autoCapitalize.value.autoCapitalize()
93
- )
94
- val labelSlotView = findChildSlotView(this@TextInputView, "label")
95
- val label: (@Composable () -> Unit)? = labelSlotView?.let {
96
- { with(ComposableScope()) { with(it) { Content() } } }
97
- }
98
- val modifier = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, this@Content, globalEventDispatcher)
99
-
100
- if (props.variant.value == TextInputViewVariant.OUTLINED) {
101
- OutlinedTextField(
102
- value = value,
103
- onValueChange = onValueChange,
104
- placeholder = placeholder,
105
- maxLines = maxLines,
106
- singleLine = singleLine,
107
- keyboardOptions = keyboardOptions,
108
- label = label,
109
- modifier = modifier
110
- )
111
- } else {
112
- TextField(
113
- value = value,
114
- onValueChange = onValueChange,
115
- placeholder = placeholder,
116
- maxLines = maxLines,
117
- singleLine = singleLine,
118
- keyboardOptions = keyboardOptions,
119
- label = label,
120
- modifier = modifier
121
- )
122
- }
123
- }
124
- }
@@ -1,105 +0,0 @@
1
- import { Ref } from 'react';
2
- import { ExpoModifier, ViewEvent } from '../../types';
3
- /**
4
- * @hidden Not used anywhere yet.
5
- */
6
- export type TextInputRole = 'default' | 'cancel' | 'destructive';
7
- export type TextInputRef = {
8
- setText: (newText: string) => Promise<void>;
9
- };
10
- export type TextInputVariant = 'filled' | 'outlined';
11
- export type TextInputProps = {
12
- /**
13
- * Can be used for imperatively setting text on the TextInput component.
14
- */
15
- ref?: Ref<TextInputRef>;
16
- /**
17
- * Initial value that the TextInput displays when being mounted. As the TextInput is an uncontrolled component, change the key prop if you need to change the text value.
18
- */
19
- defaultValue?: string;
20
- /**
21
- * The visual style of the text input field.
22
- * - `filled` - A text field with a filled background (default).
23
- * - `outlined` - A text field with a transparent background and a border outline.
24
- * @default filled
25
- * @platform android
26
- */
27
- variant?: TextInputVariant;
28
- /**
29
- * A callback triggered when user types in text into the TextInput.
30
- */
31
- onChangeText: (value: string) => void;
32
- /**
33
- * If true, the text input can be multiple lines.
34
- * While the content will wrap, there's no keyboard button to insert a new line.
35
- */
36
- multiline?: boolean;
37
- /**
38
- * The number of lines to display when `multiline` is set to true.
39
- * If the number of lines in the view is above this number, the view scrolls.
40
- * @default undefined, which means unlimited lines.
41
- */
42
- numberOfLines?: number;
43
- /**
44
- * Determines which keyboard to open. For example, `'numeric'`.
45
- *
46
- * Available options:
47
- * - default
48
- * - numeric
49
- * - email-address
50
- * - phone-pad
51
- * - decimal-pad
52
- * - ascii-capable
53
- * - url
54
- * - password
55
- * - password-numeric
56
- *
57
- * @default default
58
- */
59
- keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'ascii-capable' | 'url' | 'decimal-pad';
60
- /**
61
- * If true, autocorrection is enabled.
62
- * @default true
63
- */
64
- autocorrection?: boolean;
65
- /**
66
- * Options to request software keyboard to capitalize the text. Applies to languages which has upper-case and lower-case letters.
67
- *
68
- * Available options:
69
- * - `characters`: Capitalize all characters.
70
- * - `none`: Do not auto-capitalize text.
71
- * - `sentences`: Capitalize the first character of each sentence.
72
- * - `unspecified`: Capitalization behavior is not specified.
73
- * - `words`: Capitalize the first character of every word.
74
- * @default none
75
- * @platform android
76
- */
77
- autoCapitalize?: 'characters' | 'none' | 'sentences' | 'unspecified' | 'words';
78
- /**
79
- * Placeholder text shown inside the field when empty and focused.
80
- *
81
- */
82
- placeholder?: string;
83
- /** Modifiers for the component */
84
- modifiers?: ExpoModifier[];
85
- /**
86
- * Slot children (e.g. `TextInput.Label`).
87
- */
88
- children?: React.ReactNode;
89
- };
90
- export type NativeTextInputProps = Omit<TextInputProps, 'onChangeText' | 'children'> & {
91
- children?: React.ReactNode;
92
- } & ViewEvent<'onValueChanged', {
93
- value: string;
94
- }>;
95
- /**
96
- * Renders a `TextInput` component.
97
- */
98
- declare function TextInputComponent(props: TextInputProps): import("react").JSX.Element;
99
- declare namespace TextInputComponent {
100
- var Label: (props: {
101
- children: React.ReactNode;
102
- }) => import("react").JSX.Element;
103
- }
104
- export { TextInputComponent as TextInput };
105
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/TextInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAatD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEjE,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EACT,SAAS,GACT,eAAe,GACf,SAAS,GACT,WAAW,GACX,eAAe,GACf,KAAK,GACL,aAAa,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,GAAG,OAAO,CAAC;IAC/E;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,UAAU,CAAC,GAAG;IACrF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,GAAG,SAAS,CAAC,gBAAgB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AA+BnD;;GAEG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAAE,cAAc,+BAEhD;kBAFQ,kBAAkB;uBAPL;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;AAanD,OAAO,EAAE,kBAAkB,IAAI,SAAS,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- 0fb41718cf502bf1bd5bfeefef2497a791ec4067
@@ -1 +0,0 @@
1
- 6f17f489b1f61bda39b7219a16731839a2436678e8e1258f862b6f126229a160
@@ -1 +0,0 @@
1
- d9c690394b14a26e66a9e2520000d48ab9d98163b4495ff3acf0be27d3c285e3f3c11a4e9843c124d9bbf1d8da51064956af5f3fd7f11e4775ef5d6d32a2487b
@@ -1 +0,0 @@
1
- 476bb1e92103b2fde36a36bb0b3af37e
@@ -1 +0,0 @@
1
- 47a9ad9a4255f9c8a380708a52ffe51ccba93762
@@ -1 +0,0 @@
1
- 0cc100bb063457e6e0be298e51fd87edbe497d86fcf01f7f4e32b83ba71ee443
@@ -1 +0,0 @@
1
- 6eabbcc0f2c5ca30426dc5325e8d02ee5cd43c5c2d3660996b29d5344b609532e4cc79251162be6974dcc54c5722c50b54d59ce0ea8b422db6c1efb5a460c830
@@ -1 +0,0 @@
1
- 306436c3ff7f3c30b53ee8b940945dabbc36b24d
@@ -1 +0,0 @@
1
- b8df9570f0f933ef85bb704ff46e2cbc9dc22892920f4e0adb47b986365f9b3f
@@ -1 +0,0 @@
1
- c8d4a472bf73c83cae71aa7db7153a20c0a13aac6301c5755c0564e5ee24ea4032ba731a5f413e012476378fc5bcc9b911dbcd8e08c78e4b5e07a34227ed18af
@@ -1 +0,0 @@
1
- 9b6d657a7af4fd33a7830403a95485f8
@@ -1 +0,0 @@
1
- 1d3a9a8f13d6441cda844651c174746d39b381be
@@ -1 +0,0 @@
1
- 527c9694e0973613a33f52492c60646d29299008884ac08ac7bccfec640286dd
@@ -1 +0,0 @@
1
- 250fc082bf23c5d924a4df3ceb01525ce618d9ac449c6ed6140fde52215afbda4ab114fa249ba0b24de739942e810567f69adbf412d57e1423480c4c865cc8a7
@@ -1,157 +0,0 @@
1
- import { requireNativeView } from 'expo';
2
- import { Ref } from 'react';
3
-
4
- import { ExpoModifier, ViewEvent } from '../../types';
5
- import { createViewModifierEventListener } from '../modifiers/utils';
6
-
7
- type SlotNativeViewProps = {
8
- slotName: string;
9
- children: React.ReactNode;
10
- };
11
-
12
- const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
13
- 'ExpoUI',
14
- 'SlotView'
15
- );
16
-
17
- /**
18
- * @hidden Not used anywhere yet.
19
- */
20
- export type TextInputRole = 'default' | 'cancel' | 'destructive';
21
-
22
- export type TextInputRef = {
23
- setText: (newText: string) => Promise<void>;
24
- };
25
-
26
- export type TextInputVariant = 'filled' | 'outlined';
27
-
28
- export type TextInputProps = {
29
- /**
30
- * Can be used for imperatively setting text on the TextInput component.
31
- */
32
- ref?: Ref<TextInputRef>;
33
- /**
34
- * Initial value that the TextInput displays when being mounted. As the TextInput is an uncontrolled component, change the key prop if you need to change the text value.
35
- */
36
- defaultValue?: string;
37
- /**
38
- * The visual style of the text input field.
39
- * - `filled` - A text field with a filled background (default).
40
- * - `outlined` - A text field with a transparent background and a border outline.
41
- * @default filled
42
- * @platform android
43
- */
44
- variant?: TextInputVariant;
45
- /**
46
- * A callback triggered when user types in text into the TextInput.
47
- */
48
- onChangeText: (value: string) => void;
49
- /**
50
- * If true, the text input can be multiple lines.
51
- * While the content will wrap, there's no keyboard button to insert a new line.
52
- */
53
- multiline?: boolean;
54
- /**
55
- * The number of lines to display when `multiline` is set to true.
56
- * If the number of lines in the view is above this number, the view scrolls.
57
- * @default undefined, which means unlimited lines.
58
- */
59
- numberOfLines?: number;
60
- /**
61
- * Determines which keyboard to open. For example, `'numeric'`.
62
- *
63
- * Available options:
64
- * - default
65
- * - numeric
66
- * - email-address
67
- * - phone-pad
68
- * - decimal-pad
69
- * - ascii-capable
70
- * - url
71
- * - password
72
- * - password-numeric
73
- *
74
- * @default default
75
- */
76
- keyboardType?:
77
- | 'default'
78
- | 'email-address'
79
- | 'numeric'
80
- | 'phone-pad'
81
- | 'ascii-capable'
82
- | 'url'
83
- | 'decimal-pad';
84
- /**
85
- * If true, autocorrection is enabled.
86
- * @default true
87
- */
88
- autocorrection?: boolean;
89
- /**
90
- * Options to request software keyboard to capitalize the text. Applies to languages which has upper-case and lower-case letters.
91
- *
92
- * Available options:
93
- * - `characters`: Capitalize all characters.
94
- * - `none`: Do not auto-capitalize text.
95
- * - `sentences`: Capitalize the first character of each sentence.
96
- * - `unspecified`: Capitalization behavior is not specified.
97
- * - `words`: Capitalize the first character of every word.
98
- * @default none
99
- * @platform android
100
- */
101
- autoCapitalize?: 'characters' | 'none' | 'sentences' | 'unspecified' | 'words';
102
- /**
103
- * Placeholder text shown inside the field when empty and focused.
104
- *
105
- */
106
- placeholder?: string;
107
- /** Modifiers for the component */
108
- modifiers?: ExpoModifier[];
109
- /**
110
- * Slot children (e.g. `TextInput.Label`).
111
- */
112
- children?: React.ReactNode;
113
- };
114
-
115
- export type NativeTextInputProps = Omit<TextInputProps, 'onChangeText' | 'children'> & {
116
- children?: React.ReactNode;
117
- } & ViewEvent<'onValueChanged', { value: string }>;
118
-
119
- // We have to work around the `role` and `onPress` props being reserved by React Native.
120
- const TextInputNativeView: React.ComponentType<NativeTextInputProps> = requireNativeView(
121
- 'ExpoUI',
122
- 'TextInputView'
123
- );
124
-
125
- function transformTextInputProps(props: TextInputProps): NativeTextInputProps {
126
- const { modifiers, children, ...restProps } = props;
127
- return {
128
- modifiers,
129
- ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
130
- ...restProps,
131
- children,
132
- onValueChanged: (event) => {
133
- props.onChangeText?.(event.nativeEvent.value);
134
- },
135
- };
136
- }
137
-
138
- /**
139
- * A label slot for `TextInput`.
140
- * The label floats above the text field when focused or filled.
141
- *
142
- * @platform android
143
- */
144
- function Label(props: { children: React.ReactNode }) {
145
- return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
146
- }
147
-
148
- /**
149
- * Renders a `TextInput` component.
150
- */
151
- function TextInputComponent(props: TextInputProps) {
152
- return <TextInputNativeView {...transformTextInputProps(props)} />;
153
- }
154
-
155
- TextInputComponent.Label = Label;
156
-
157
- export { TextInputComponent as TextInput };