@expo/ui 55.0.10 → 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 (75) hide show
  1. package/CHANGELOG.md +7 -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 +35 -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/ViewModifierRegistry.swift +12 -8
  21. package/ios/SecureFieldView.swift +5 -12
  22. package/ios/TextFieldView.swift +26 -94
  23. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.10/expo.modules.ui-55.0.10-sources.jar → 55.0.11/expo.modules.ui-55.0.11-sources.jar} +0 -0
  24. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.md5 +1 -0
  25. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha1 +1 -0
  26. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha256 +1 -0
  27. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11-sources.jar.sha512 +1 -0
  28. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar +0 -0
  29. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.md5 +1 -0
  30. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha1 +1 -0
  31. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha256 +1 -0
  32. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.aar.sha512 +1 -0
  33. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.10/expo.modules.ui-55.0.10.module → 55.0.11/expo.modules.ui-55.0.11.module} +22 -22
  34. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.md5 +1 -0
  35. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha1 +1 -0
  36. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha256 +1 -0
  37. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.module.sha512 +1 -0
  38. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.10/expo.modules.ui-55.0.10.pom → 55.0.11/expo.modules.ui-55.0.11.pom} +1 -1
  39. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.md5 +1 -0
  40. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha1 +1 -0
  41. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha256 +1 -0
  42. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.11/expo.modules.ui-55.0.11.pom.sha512 +1 -0
  43. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  44. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  45. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  46. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  47. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  48. package/package.json +2 -2
  49. package/src/jetpack-compose/SlotView.tsx +15 -0
  50. package/src/jetpack-compose/TextField/index.tsx +276 -0
  51. package/src/jetpack-compose/index.ts +1 -1
  52. package/src/swift-ui/SecureField/index.tsx +18 -36
  53. package/src/swift-ui/TextField/index.tsx +30 -91
  54. package/src/swift-ui/modifiers/index.ts +63 -3
  55. package/android/src/main/java/expo/modules/ui/TextInputView.kt +0 -124
  56. package/build/jetpack-compose/TextInput/index.d.ts +0 -105
  57. package/build/jetpack-compose/TextInput/index.d.ts.map +0 -1
  58. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10-sources.jar.md5 +0 -1
  59. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10-sources.jar.sha1 +0 -1
  60. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10-sources.jar.sha256 +0 -1
  61. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10-sources.jar.sha512 +0 -1
  62. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.aar +0 -0
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.aar.md5 +0 -1
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.aar.sha1 +0 -1
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.aar.sha256 +0 -1
  66. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.aar.sha512 +0 -1
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.module.md5 +0 -1
  68. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.module.sha1 +0 -1
  69. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.module.sha256 +0 -1
  70. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.module.sha512 +0 -1
  71. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.pom.md5 +0 -1
  72. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.pom.sha1 +0 -1
  73. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.pom.sha256 +0 -1
  74. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.10/expo.modules.ui-55.0.10.pom.sha512 +0 -1
  75. package/src/jetpack-compose/TextInput/index.tsx +0 -157
package/CHANGELOG.md CHANGED
@@ -10,6 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 55.0.11 — 2026-04-09
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - [iOS] Match `TextField` and `SecureField` API with SwiftUI: replaced `multiline`, `numberOfLines`, `allowNewlines` with `axis` prop. Moved `keyboardType`, `autocorrectionDisabled`, `onSubmit` from props to modifier registry. Renamed events `onValueChanged` → `onValueChange`, `onFocusChanged` → `onFocusChange`, `onSelectionChanged` → `onSelectionChange`. Removed hardcoded `fixedSize`. Added `LineLimitModifier` with `reservesSpace` and range support. Added `OnSubmitModifier` and `KeyboardTypeModifier`. ([#44549](https://github.com/expo/expo/pull/44549) by [@nishan](https://github.com/intergalacticspacehighway))
18
+ - [android] Match `TextField` API to native Compose: renamed `TextInput` to `TextField`/`OutlinedTextField`, replaced individual keyboard props with `keyboardOptions`/`keyboardActions` matching `KeyboardOptions`/`KeyboardActions`, added `enabled`, `readOnly`, `isError`, `singleLine`, `maxLines`, `minLines`, `shape`, `colors`. Added composable slots: `placeholder`, `leadingIcon`, `trailingIcon`, `prefix`, `suffix`, `supportingText`. Added imperative `focus()`/`blur()` and `onFocusChanged` event. ([#44545](https://github.com/expo/expo/pull/44545) by [@nishan](https://github.com/intergalacticspacehighway))
19
+
13
20
  ## 55.0.10 — 2026-04-07
14
21
 
15
22
  _This version does not introduce any user-facing changes._
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
12
12
  apply plugin: 'org.jetbrains.kotlin.plugin.compose'
13
13
 
14
14
  group = 'expo.modules.ui'
15
- version = '55.0.10'
15
+ version = '55.0.11'
16
16
 
17
17
  android {
18
18
  namespace "expo.modules.ui"
19
19
  defaultConfig {
20
20
  versionCode 1
21
- versionName "55.0.10"
21
+ versionName "55.0.11"
22
22
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23
23
  }
24
24
  buildFeatures {
@@ -71,16 +71,20 @@ class ExpoUIModule : Module() {
71
71
 
72
72
  View(RNHostView::class)
73
73
 
74
- View(TextInputView::class) {
75
- Events("onValueChanged")
76
- Prop("defaultValue", "") { view: TextInputView, text: String ->
77
- if (view.text == null) {
78
- view.text = text
79
- }
74
+ View(TextFieldView::class) {
75
+ Events("onValueChange", "onFocusChanged", "onKeyboardAction")
76
+ Prop("defaultValue", "") { view: TextFieldView, text: String ->
77
+ if (view.text == null) { view.text = text }
80
78
  }
81
- AsyncFunction("setText") { view: TextInputView, text: String ->
79
+ AsyncFunction("setText") { view: TextFieldView, text: String ->
82
80
  view.text = text
83
81
  }
82
+ AsyncFunction("focus") { view: TextFieldView ->
83
+ view.focus()
84
+ }
85
+ AsyncFunction("blur") { view: TextFieldView ->
86
+ view.blur()
87
+ }
84
88
  }
85
89
 
86
90
  View(SlotView::class) {
@@ -0,0 +1,326 @@
1
+ package expo.modules.ui
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.content.Context
5
+ import android.graphics.Color
6
+ import androidx.compose.foundation.text.KeyboardActions
7
+ import androidx.compose.foundation.text.KeyboardOptions
8
+ import androidx.compose.material3.OutlinedTextField
9
+ import androidx.compose.material3.OutlinedTextFieldDefaults
10
+ import androidx.compose.material3.TextField
11
+ import androidx.compose.material3.TextFieldColors
12
+ import androidx.compose.material3.TextFieldDefaults
13
+ import androidx.compose.runtime.Composable
14
+ import androidx.compose.runtime.LaunchedEffect
15
+ import androidx.compose.runtime.MutableState
16
+ import androidx.compose.runtime.mutableStateOf
17
+ import androidx.compose.ui.focus.FocusManager
18
+ import androidx.compose.ui.focus.FocusRequester
19
+ import androidx.compose.ui.focus.focusRequester
20
+ import androidx.compose.ui.focus.onFocusChanged
21
+ import androidx.compose.ui.platform.LocalFocusManager
22
+ import androidx.compose.ui.text.input.ImeAction
23
+ import androidx.compose.ui.text.input.KeyboardCapitalization
24
+ import androidx.compose.ui.text.input.KeyboardType
25
+ import expo.modules.kotlin.AppContext
26
+ import expo.modules.kotlin.records.Field
27
+ import expo.modules.kotlin.records.Record
28
+ import expo.modules.kotlin.types.Enumerable
29
+ import expo.modules.kotlin.viewevent.EventDispatcher
30
+ import expo.modules.kotlin.views.ComposableScope
31
+ import expo.modules.kotlin.views.ComposeProps
32
+ import expo.modules.kotlin.views.ExpoComposeView
33
+
34
+ // region Records
35
+
36
+ enum class TextFieldVariant(val value: String) : Enumerable {
37
+ FILLED("filled"),
38
+ OUTLINED("outlined"),
39
+ }
40
+
41
+ data class TextFieldKeyboardOptionsRecord(
42
+ @Field val capitalization: String? = null,
43
+ @Field val autoCorrectEnabled: Boolean? = null,
44
+ @Field val keyboardType: String? = null,
45
+ @Field val imeAction: String? = null,
46
+ ) : Record
47
+
48
+ data class TextFieldColorsRecord(
49
+ // Text
50
+ @Field val focusedTextColor: Color? = null,
51
+ @Field val unfocusedTextColor: Color? = null,
52
+ @Field val disabledTextColor: Color? = null,
53
+ @Field val errorTextColor: Color? = null,
54
+ // Container
55
+ @Field val focusedContainerColor: Color? = null,
56
+ @Field val unfocusedContainerColor: Color? = null,
57
+ @Field val disabledContainerColor: Color? = null,
58
+ @Field val errorContainerColor: Color? = null,
59
+ // Cursor
60
+ @Field val cursorColor: Color? = null,
61
+ @Field val errorCursorColor: Color? = null,
62
+ // Indicator
63
+ @Field val focusedIndicatorColor: Color? = null,
64
+ @Field val unfocusedIndicatorColor: Color? = null,
65
+ @Field val disabledIndicatorColor: Color? = null,
66
+ @Field val errorIndicatorColor: Color? = null,
67
+ // Leading icon
68
+ @Field val focusedLeadingIconColor: Color? = null,
69
+ @Field val unfocusedLeadingIconColor: Color? = null,
70
+ @Field val disabledLeadingIconColor: Color? = null,
71
+ @Field val errorLeadingIconColor: Color? = null,
72
+ // Trailing icon
73
+ @Field val focusedTrailingIconColor: Color? = null,
74
+ @Field val unfocusedTrailingIconColor: Color? = null,
75
+ @Field val disabledTrailingIconColor: Color? = null,
76
+ @Field val errorTrailingIconColor: Color? = null,
77
+ // Label
78
+ @Field val focusedLabelColor: Color? = null,
79
+ @Field val unfocusedLabelColor: Color? = null,
80
+ @Field val disabledLabelColor: Color? = null,
81
+ @Field val errorLabelColor: Color? = null,
82
+ // Placeholder
83
+ @Field val focusedPlaceholderColor: Color? = null,
84
+ @Field val unfocusedPlaceholderColor: Color? = null,
85
+ @Field val disabledPlaceholderColor: Color? = null,
86
+ @Field val errorPlaceholderColor: Color? = null,
87
+ // Supporting text
88
+ @Field val focusedSupportingTextColor: Color? = null,
89
+ @Field val unfocusedSupportingTextColor: Color? = null,
90
+ @Field val disabledSupportingTextColor: Color? = null,
91
+ @Field val errorSupportingTextColor: Color? = null,
92
+ // Prefix
93
+ @Field val focusedPrefixColor: Color? = null,
94
+ @Field val unfocusedPrefixColor: Color? = null,
95
+ @Field val disabledPrefixColor: Color? = null,
96
+ @Field val errorPrefixColor: Color? = null,
97
+ // Suffix
98
+ @Field val focusedSuffixColor: Color? = null,
99
+ @Field val unfocusedSuffixColor: Color? = null,
100
+ @Field val disabledSuffixColor: Color? = null,
101
+ @Field val errorSuffixColor: Color? = null,
102
+ ) : Record
103
+
104
+ // endregion Records
105
+
106
+ // region Color builder
107
+
108
+ @Composable
109
+ fun TextFieldColorsRecord.toColors(isOutlined: Boolean): TextFieldColors {
110
+ val defaults = if (isOutlined) OutlinedTextFieldDefaults.colors() else TextFieldDefaults.colors()
111
+ // Outlined and Filled TextField both use TextFieldDefault.colors
112
+ return TextFieldDefaults.colors(
113
+ focusedTextColor = focusedTextColor.composeOrNull ?: defaults.focusedTextColor,
114
+ unfocusedTextColor = unfocusedTextColor.composeOrNull ?: defaults.unfocusedTextColor,
115
+ disabledTextColor = disabledTextColor.composeOrNull ?: defaults.disabledTextColor,
116
+ errorTextColor = errorTextColor.composeOrNull ?: defaults.errorTextColor,
117
+ focusedContainerColor = focusedContainerColor.composeOrNull ?: defaults.focusedContainerColor,
118
+ unfocusedContainerColor = unfocusedContainerColor.composeOrNull ?: defaults.unfocusedContainerColor,
119
+ disabledContainerColor = disabledContainerColor.composeOrNull ?: defaults.disabledContainerColor,
120
+ errorContainerColor = errorContainerColor.composeOrNull ?: defaults.errorContainerColor,
121
+ cursorColor = cursorColor.composeOrNull ?: defaults.cursorColor,
122
+ errorCursorColor = errorCursorColor.composeOrNull ?: defaults.errorCursorColor,
123
+ focusedIndicatorColor = focusedIndicatorColor.composeOrNull ?: defaults.focusedIndicatorColor,
124
+ unfocusedIndicatorColor = unfocusedIndicatorColor.composeOrNull ?: defaults.unfocusedIndicatorColor,
125
+ disabledIndicatorColor = disabledIndicatorColor.composeOrNull ?: defaults.disabledIndicatorColor,
126
+ errorIndicatorColor = errorIndicatorColor.composeOrNull ?: defaults.errorIndicatorColor,
127
+ focusedLeadingIconColor = focusedLeadingIconColor.composeOrNull ?: defaults.focusedLeadingIconColor,
128
+ unfocusedLeadingIconColor = unfocusedLeadingIconColor.composeOrNull ?: defaults.unfocusedLeadingIconColor,
129
+ disabledLeadingIconColor = disabledLeadingIconColor.composeOrNull ?: defaults.disabledLeadingIconColor,
130
+ errorLeadingIconColor = errorLeadingIconColor.composeOrNull ?: defaults.errorLeadingIconColor,
131
+ focusedTrailingIconColor = focusedTrailingIconColor.composeOrNull ?: defaults.focusedTrailingIconColor,
132
+ unfocusedTrailingIconColor = unfocusedTrailingIconColor.composeOrNull ?: defaults.unfocusedTrailingIconColor,
133
+ disabledTrailingIconColor = disabledTrailingIconColor.composeOrNull ?: defaults.disabledTrailingIconColor,
134
+ errorTrailingIconColor = errorTrailingIconColor.composeOrNull ?: defaults.errorTrailingIconColor,
135
+ focusedLabelColor = focusedLabelColor.composeOrNull ?: defaults.focusedLabelColor,
136
+ unfocusedLabelColor = unfocusedLabelColor.composeOrNull ?: defaults.unfocusedLabelColor,
137
+ disabledLabelColor = disabledLabelColor.composeOrNull ?: defaults.disabledLabelColor,
138
+ errorLabelColor = errorLabelColor.composeOrNull ?: defaults.errorLabelColor,
139
+ focusedPlaceholderColor = focusedPlaceholderColor.composeOrNull ?: defaults.focusedPlaceholderColor,
140
+ unfocusedPlaceholderColor = unfocusedPlaceholderColor.composeOrNull ?: defaults.unfocusedPlaceholderColor,
141
+ disabledPlaceholderColor = disabledPlaceholderColor.composeOrNull ?: defaults.disabledPlaceholderColor,
142
+ errorPlaceholderColor = errorPlaceholderColor.composeOrNull ?: defaults.errorPlaceholderColor,
143
+ focusedSupportingTextColor = focusedSupportingTextColor.composeOrNull ?: defaults.focusedSupportingTextColor,
144
+ unfocusedSupportingTextColor = unfocusedSupportingTextColor.composeOrNull ?: defaults.unfocusedSupportingTextColor,
145
+ disabledSupportingTextColor = disabledSupportingTextColor.composeOrNull ?: defaults.disabledSupportingTextColor,
146
+ errorSupportingTextColor = errorSupportingTextColor.composeOrNull ?: defaults.errorSupportingTextColor,
147
+ focusedPrefixColor = focusedPrefixColor.composeOrNull ?: defaults.focusedPrefixColor,
148
+ unfocusedPrefixColor = unfocusedPrefixColor.composeOrNull ?: defaults.unfocusedPrefixColor,
149
+ disabledPrefixColor = disabledPrefixColor.composeOrNull ?: defaults.disabledPrefixColor,
150
+ errorPrefixColor = errorPrefixColor.composeOrNull ?: defaults.errorPrefixColor,
151
+ focusedSuffixColor = focusedSuffixColor.composeOrNull ?: defaults.focusedSuffixColor,
152
+ unfocusedSuffixColor = unfocusedSuffixColor.composeOrNull ?: defaults.unfocusedSuffixColor,
153
+ disabledSuffixColor = disabledSuffixColor.composeOrNull ?: defaults.disabledSuffixColor,
154
+ errorSuffixColor = errorSuffixColor.composeOrNull ?: defaults.errorSuffixColor,
155
+ )
156
+ }
157
+
158
+ // endregion Color builder
159
+
160
+ // region Props
161
+
162
+ data class TextFieldProps(
163
+ val defaultValue: MutableState<String> = mutableStateOf(""),
164
+ val autoFocus: MutableState<Boolean> = mutableStateOf(false),
165
+ val variant: MutableState<TextFieldVariant> = mutableStateOf(TextFieldVariant.FILLED),
166
+ val enabled: MutableState<Boolean> = mutableStateOf(true),
167
+ val readOnly: MutableState<Boolean> = mutableStateOf(false),
168
+ val isError: MutableState<Boolean> = mutableStateOf(false),
169
+ val singleLine: MutableState<Boolean> = mutableStateOf(false),
170
+ val maxLines: MutableState<Int?> = mutableStateOf(null),
171
+ val minLines: MutableState<Int?> = mutableStateOf(null),
172
+ val keyboardOptions: MutableState<TextFieldKeyboardOptionsRecord?> = mutableStateOf(null),
173
+ val shape: MutableState<ShapeRecord?> = mutableStateOf(null),
174
+ val colors: MutableState<TextFieldColorsRecord?> = mutableStateOf(null),
175
+ val modifiers: MutableState<ModifierList> = mutableStateOf(emptyList()),
176
+ ) : ComposeProps
177
+
178
+ // endregion Props
179
+
180
+ // region Mappers
181
+
182
+ private fun String?.toKeyboardType(): KeyboardType = when (this) {
183
+ "text" -> KeyboardType.Text
184
+ "number" -> KeyboardType.Number
185
+ "email" -> KeyboardType.Email
186
+ "phone" -> KeyboardType.Phone
187
+ "decimal" -> KeyboardType.Decimal
188
+ "password" -> KeyboardType.Password
189
+ "ascii" -> KeyboardType.Ascii
190
+ "uri" -> KeyboardType.Uri
191
+ "numberPassword" -> KeyboardType.NumberPassword
192
+ else -> KeyboardType.Text
193
+ }
194
+
195
+ private fun String?.toCapitalization(): KeyboardCapitalization = when (this) {
196
+ "characters" -> KeyboardCapitalization.Characters
197
+ "none" -> KeyboardCapitalization.None
198
+ "sentences" -> KeyboardCapitalization.Sentences
199
+ "words" -> KeyboardCapitalization.Words
200
+ else -> KeyboardCapitalization.None
201
+ }
202
+
203
+ private fun String?.toImeAction(): ImeAction = when (this) {
204
+ "default" -> ImeAction.Default
205
+ "none" -> ImeAction.None
206
+ "go" -> ImeAction.Go
207
+ "search" -> ImeAction.Search
208
+ "send" -> ImeAction.Send
209
+ "previous" -> ImeAction.Previous
210
+ "next" -> ImeAction.Next
211
+ "done" -> ImeAction.Done
212
+ else -> ImeAction.Default
213
+ }
214
+
215
+ // endregion Mappers
216
+
217
+ // region View
218
+
219
+ @SuppressLint("ViewConstructor")
220
+ class TextFieldView(context: Context, appContext: AppContext) :
221
+ ExpoComposeView<TextFieldProps>(context, appContext) {
222
+ override val props = TextFieldProps()
223
+ private val onValueChange by EventDispatcher()
224
+ private val onFocusChanged by EventDispatcher()
225
+ private val onKeyboardAction by EventDispatcher()
226
+
227
+ private val textState = mutableStateOf<String?>(null)
228
+ private val focusRequester by lazy { FocusRequester() }
229
+ private var focusManager: FocusManager? = null
230
+
231
+ var text: String?
232
+ get() = textState.value
233
+ set(value) {
234
+ textState.value = value
235
+ }
236
+
237
+ fun focus() = focusRequester.requestFocus()
238
+ fun blur() = focusManager?.clearFocus()
239
+
240
+ @Composable
241
+ override fun ComposableScope.Content() {
242
+ focusManager = LocalFocusManager.current
243
+ val value = textState.value ?: props.defaultValue.value
244
+ val onValueChange: (String) -> Unit = {
245
+ textState.value = it
246
+ onValueChange(mapOf("value" to it))
247
+ }
248
+
249
+ // Slots
250
+ val label: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "label")?.let { slot -> { slot.renderSlot() } }
251
+ val placeholder: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "placeholder")?.let { slot -> { slot.renderSlot() } }
252
+ val leadingIcon: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "leadingIcon")?.let { slot -> { slot.renderSlot() } }
253
+ val trailingIcon: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "trailingIcon")?.let { slot -> { slot.renderSlot() } }
254
+ val prefix: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "prefix")?.let { slot -> { slot.renderSlot() } }
255
+ val suffix: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "suffix")?.let { slot -> { slot.renderSlot() } }
256
+ val supportingText: (@Composable () -> Unit)? = findChildSlotView(this@TextFieldView, "supportingText")?.let { slot -> { slot.renderSlot() } }
257
+
258
+ // Keyboard
259
+ val kbOpts = props.keyboardOptions.value
260
+ val keyboardOptions = KeyboardOptions.Default.copy(
261
+ keyboardType = kbOpts?.keyboardType.toKeyboardType(),
262
+ autoCorrectEnabled = kbOpts?.autoCorrectEnabled ?: true,
263
+ capitalization = kbOpts?.capitalization.toCapitalization(),
264
+ imeAction = kbOpts?.imeAction.toImeAction()
265
+ )
266
+ val currentText = { textState.value ?: "" }
267
+ val keyboardActions = KeyboardActions(
268
+ onDone = { defaultKeyboardAction(ImeAction.Done); onKeyboardAction(mapOf("action" to "done", "value" to currentText())) },
269
+ onGo = { defaultKeyboardAction(ImeAction.Go); onKeyboardAction(mapOf("action" to "go", "value" to currentText())) },
270
+ onNext = { defaultKeyboardAction(ImeAction.Next); onKeyboardAction(mapOf("action" to "next", "value" to currentText())) },
271
+ onPrevious = { defaultKeyboardAction(ImeAction.Previous); onKeyboardAction(mapOf("action" to "previous", "value" to currentText())) },
272
+ onSearch = { defaultKeyboardAction(ImeAction.Search); onKeyboardAction(mapOf("action" to "search", "value" to currentText())) },
273
+ onSend = { defaultKeyboardAction(ImeAction.Send); onKeyboardAction(mapOf("action" to "send", "value" to currentText())) },
274
+ )
275
+
276
+ // Lines
277
+ val singleLine = props.singleLine.value
278
+ val maxLines = props.maxLines.value ?: if (singleLine) 1 else Int.MAX_VALUE
279
+ val minLines = props.minLines.value ?: 1
280
+
281
+ // Modifier
282
+ val modifier = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, this@Content, globalEventDispatcher)
283
+ .focusRequester(focusRequester)
284
+ .onFocusChanged { focusState ->
285
+ onFocusChanged(mapOf("value" to focusState.isFocused))
286
+ }
287
+
288
+ if (props.autoFocus.value) {
289
+ LaunchedEffect(Unit) { focusRequester.requestFocus() }
290
+ }
291
+
292
+ val isOutlined = props.variant.value == TextFieldVariant.OUTLINED
293
+ val shape = shapeFromShapeRecord(props.shape.value)
294
+ ?: if (isOutlined) OutlinedTextFieldDefaults.shape else TextFieldDefaults.shape
295
+ val colors = props.colors.value?.toColors(isOutlined)
296
+ ?: if (isOutlined) OutlinedTextFieldDefaults.colors() else TextFieldDefaults.colors()
297
+
298
+ if (isOutlined) {
299
+ OutlinedTextField(
300
+ value = value, onValueChange = onValueChange, modifier = modifier,
301
+ enabled = props.enabled.value, readOnly = props.readOnly.value,
302
+ label = label, placeholder = placeholder,
303
+ leadingIcon = leadingIcon, trailingIcon = trailingIcon,
304
+ prefix = prefix, suffix = suffix, supportingText = supportingText,
305
+ isError = props.isError.value,
306
+ keyboardOptions = keyboardOptions, keyboardActions = keyboardActions,
307
+ singleLine = singleLine, maxLines = maxLines, minLines = minLines,
308
+ shape = shape, colors = colors,
309
+ )
310
+ } else {
311
+ TextField(
312
+ value = value, onValueChange = onValueChange, modifier = modifier,
313
+ enabled = props.enabled.value, readOnly = props.readOnly.value,
314
+ label = label, placeholder = placeholder,
315
+ leadingIcon = leadingIcon, trailingIcon = trailingIcon,
316
+ prefix = prefix, suffix = suffix, supportingText = supportingText,
317
+ isError = props.isError.value,
318
+ keyboardOptions = keyboardOptions, keyboardActions = keyboardActions,
319
+ singleLine = singleLine, maxLines = maxLines, minLines = minLines,
320
+ shape = shape, colors = colors,
321
+ )
322
+ }
323
+ }
324
+ }
325
+
326
+ // endregion View
@@ -0,0 +1,7 @@
1
+ type SlotNativeViewProps = {
2
+ slotName: string;
3
+ children: React.ReactNode;
4
+ };
5
+ export declare function Slot({ slotName, children }: SlotNativeViewProps): import("react").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=SlotView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlotView.d.ts","sourceRoot":"","sources":["../../src/jetpack-compose/SlotView.tsx"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAOF,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAE/D"}
@@ -0,0 +1,177 @@
1
+ import { Ref } from 'react';
2
+ import { ColorValue } from 'react-native';
3
+ import { ModifierConfig } from '../../types';
4
+ /**
5
+ * Can be used for imperatively setting text and focus on the `TextField` component.
6
+ */
7
+ export type TextFieldRef = {
8
+ setText: (newText: string) => Promise<void>;
9
+ focus: () => Promise<void>;
10
+ blur: () => Promise<void>;
11
+ };
12
+ export type TextFieldCapitalization = 'none' | 'characters' | 'words' | 'sentences';
13
+ export type TextFieldKeyboardType = 'text' | 'number' | 'email' | 'phone' | 'decimal' | 'password' | 'ascii' | 'uri' | 'numberPassword';
14
+ export type TextFieldImeAction = 'default' | 'none' | 'go' | 'search' | 'send' | 'previous' | 'next' | 'done';
15
+ /**
16
+ * Keyboard options matching Compose `KeyboardOptions`.
17
+ */
18
+ export type TextFieldKeyboardOptions = {
19
+ /** @default 'none' */
20
+ capitalization?: TextFieldCapitalization;
21
+ /** @default true */
22
+ autoCorrectEnabled?: boolean;
23
+ /** @default 'text' */
24
+ keyboardType?: TextFieldKeyboardType;
25
+ /** @default 'default' */
26
+ imeAction?: TextFieldImeAction;
27
+ };
28
+ /**
29
+ * Keyboard actions matching Compose `KeyboardActions`.
30
+ * The triggered callback depends on the `imeAction` in `keyboardOptions`.
31
+ */
32
+ export type TextFieldKeyboardActions = {
33
+ onDone?: (value: string) => void;
34
+ onGo?: (value: string) => void;
35
+ onNext?: (value: string) => void;
36
+ onPrevious?: (value: string) => void;
37
+ onSearch?: (value: string) => void;
38
+ onSend?: (value: string) => void;
39
+ };
40
+ /**
41
+ * Colors for `TextField` and `OutlinedTextField`.
42
+ * Maps to `TextFieldColors` in Compose, shared by both variants.
43
+ */
44
+ export type TextFieldColors = {
45
+ focusedTextColor?: ColorValue;
46
+ unfocusedTextColor?: ColorValue;
47
+ disabledTextColor?: ColorValue;
48
+ errorTextColor?: ColorValue;
49
+ focusedContainerColor?: ColorValue;
50
+ unfocusedContainerColor?: ColorValue;
51
+ disabledContainerColor?: ColorValue;
52
+ errorContainerColor?: ColorValue;
53
+ cursorColor?: ColorValue;
54
+ errorCursorColor?: ColorValue;
55
+ focusedIndicatorColor?: ColorValue;
56
+ unfocusedIndicatorColor?: ColorValue;
57
+ disabledIndicatorColor?: ColorValue;
58
+ errorIndicatorColor?: ColorValue;
59
+ focusedLeadingIconColor?: ColorValue;
60
+ unfocusedLeadingIconColor?: ColorValue;
61
+ disabledLeadingIconColor?: ColorValue;
62
+ errorLeadingIconColor?: ColorValue;
63
+ focusedTrailingIconColor?: ColorValue;
64
+ unfocusedTrailingIconColor?: ColorValue;
65
+ disabledTrailingIconColor?: ColorValue;
66
+ errorTrailingIconColor?: ColorValue;
67
+ focusedLabelColor?: ColorValue;
68
+ unfocusedLabelColor?: ColorValue;
69
+ disabledLabelColor?: ColorValue;
70
+ errorLabelColor?: ColorValue;
71
+ focusedPlaceholderColor?: ColorValue;
72
+ unfocusedPlaceholderColor?: ColorValue;
73
+ disabledPlaceholderColor?: ColorValue;
74
+ errorPlaceholderColor?: ColorValue;
75
+ focusedSupportingTextColor?: ColorValue;
76
+ unfocusedSupportingTextColor?: ColorValue;
77
+ disabledSupportingTextColor?: ColorValue;
78
+ errorSupportingTextColor?: ColorValue;
79
+ focusedPrefixColor?: ColorValue;
80
+ unfocusedPrefixColor?: ColorValue;
81
+ disabledPrefixColor?: ColorValue;
82
+ errorPrefixColor?: ColorValue;
83
+ focusedSuffixColor?: ColorValue;
84
+ unfocusedSuffixColor?: ColorValue;
85
+ disabledSuffixColor?: ColorValue;
86
+ errorSuffixColor?: ColorValue;
87
+ };
88
+ /** Shared props between `TextField` and `OutlinedTextField`. */
89
+ type BaseTextFieldProps = {
90
+ ref?: Ref<TextFieldRef>;
91
+ /** Initial value displayed when mounted. Uncontrolled — change `key` to reset. */
92
+ defaultValue?: string;
93
+ /** If true, the text field will be focused automatically when mounted. @default false */
94
+ autoFocus?: boolean;
95
+ /** @default true */
96
+ enabled?: boolean;
97
+ /** @default false */
98
+ readOnly?: boolean;
99
+ /** @default false */
100
+ isError?: boolean;
101
+ /** @default false */
102
+ singleLine?: boolean;
103
+ maxLines?: number;
104
+ minLines?: number;
105
+ keyboardOptions?: TextFieldKeyboardOptions;
106
+ keyboardActions?: TextFieldKeyboardActions;
107
+ /** A callback triggered when user types text. */
108
+ onValueChange?: (value: string) => void;
109
+ /** A callback triggered when the field gains or loses focus. */
110
+ onFocusChanged?: (focused: boolean) => void;
111
+ shape?: object;
112
+ modifiers?: ModifierConfig[];
113
+ /** Slot children (e.g. `TextField.Label`, `TextField.Placeholder`). */
114
+ children?: React.ReactNode;
115
+ };
116
+ export type TextFieldProps = BaseTextFieldProps & {
117
+ colors?: TextFieldColors;
118
+ };
119
+ export type OutlinedTextFieldProps = BaseTextFieldProps & {
120
+ colors?: TextFieldColors;
121
+ };
122
+ /**
123
+ * A Material3 `TextField`.
124
+ */
125
+ declare function TextFieldComponent(props: TextFieldProps): import("react").JSX.Element;
126
+ declare namespace TextFieldComponent {
127
+ var Label: (props: {
128
+ children: React.ReactNode;
129
+ }) => import("react").JSX.Element;
130
+ var Placeholder: (props: {
131
+ children: React.ReactNode;
132
+ }) => import("react").JSX.Element;
133
+ var LeadingIcon: (props: {
134
+ children: React.ReactNode;
135
+ }) => import("react").JSX.Element;
136
+ var TrailingIcon: (props: {
137
+ children: React.ReactNode;
138
+ }) => import("react").JSX.Element;
139
+ var Prefix: (props: {
140
+ children: React.ReactNode;
141
+ }) => import("react").JSX.Element;
142
+ var Suffix: (props: {
143
+ children: React.ReactNode;
144
+ }) => import("react").JSX.Element;
145
+ var SupportingText: (props: {
146
+ children: React.ReactNode;
147
+ }) => import("react").JSX.Element;
148
+ }
149
+ /**
150
+ * A Material3 `OutlinedTextField` with a transparent background and border outline.
151
+ */
152
+ declare function OutlinedTextFieldComponent(props: OutlinedTextFieldProps): import("react").JSX.Element;
153
+ declare namespace OutlinedTextFieldComponent {
154
+ var Label: (props: {
155
+ children: React.ReactNode;
156
+ }) => import("react").JSX.Element;
157
+ var Placeholder: (props: {
158
+ children: React.ReactNode;
159
+ }) => import("react").JSX.Element;
160
+ var LeadingIcon: (props: {
161
+ children: React.ReactNode;
162
+ }) => import("react").JSX.Element;
163
+ var TrailingIcon: (props: {
164
+ children: React.ReactNode;
165
+ }) => import("react").JSX.Element;
166
+ var Prefix: (props: {
167
+ children: React.ReactNode;
168
+ }) => import("react").JSX.Element;
169
+ var Suffix: (props: {
170
+ children: React.ReactNode;
171
+ }) => import("react").JSX.Element;
172
+ var SupportingText: (props: {
173
+ children: React.ReactNode;
174
+ }) => import("react").JSX.Element;
175
+ }
176
+ export { TextFieldComponent as TextField, OutlinedTextFieldComponent as OutlinedTextField };
177
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/TextField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AAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;8BAI5B;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;wBAInC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;wBAI7B;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;gCAIrB;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;AAwC5D,OAAO,EAAE,kBAAkB,IAAI,SAAS,EAAE,0BAA0B,IAAI,iBAAiB,EAAE,CAAC"}
@@ -21,7 +21,7 @@ export * from './Progress';
21
21
  export * from './Slider';
22
22
  export * from './Spacer';
23
23
  export * from './Switch';
24
- export * from './TextInput';
24
+ export * from './TextField';
25
25
  export * from './ToggleButton';
26
26
  export * from './Shape';
27
27
  export * from './ModalBottomSheet';
@@ -1,8 +1,7 @@
1
1
  import { Ref } from 'react';
2
- import { TextFieldKeyboardType } from '../TextField';
3
2
  import { type CommonViewModifierProps } from '../types';
4
3
  /**
5
- * Can be used for imperatively setting text on the SecureField component.
4
+ * Can be used for imperatively setting text and focus on the `SecureField` component.
6
5
  */
7
6
  export type SecureFieldRef = {
8
7
  setText: (newText: string) => Promise<void>;
@@ -11,35 +10,25 @@ export type SecureFieldRef = {
11
10
  };
12
11
  export type SecureFieldProps = {
13
12
  ref?: Ref<SecureFieldRef>;
14
- /**
15
- * Initial value that the SecureField displays when being mounted. As the SecureField is an uncontrolled component, change the key prop if you need to change the text value.
16
- */
13
+ /** Initial value displayed when mounted. Uncontrolled — change `key` to reset. */
17
14
  defaultValue?: string;
15
+ /** If true, the field will be focused automatically when mounted. @default false */
16
+ autoFocus?: boolean;
18
17
  /**
19
18
  * A text that is displayed when the field is empty.
20
19
  */
21
20
  placeholder?: string;
22
21
  /**
23
- * A callback triggered when user types in text into the SecureField.
24
- */
25
- onChangeText?: (value: string) => void;
26
- /**
27
- * A callback triggered when user submits the TextField by pressing the return key.
28
- */
29
- onSubmit?: (value: string) => void;
30
- /**
31
- * A callback triggered when user focuses or blurs the SecureField.
22
+ * A callback triggered when the text value changes.
32
23
  */
33
- onChangeFocus?: (focused: boolean) => void;
34
- keyboardType?: TextFieldKeyboardType;
24
+ onValueChange?: (value: string) => void;
35
25
  /**
36
- * If true, the text input will be focused automatically when the component is mounted.
37
- * @default false
26
+ * A callback triggered when the field gains or loses focus.
38
27
  */
39
- autoFocus?: boolean;
28
+ onFocusChange?: (focused: boolean) => void;
40
29
  } & CommonViewModifierProps;
41
30
  /**
42
- * Renders a `SecureField` component. Should mostly be used for embedding text inputs inside of SwiftUI lists and sections. Is an uncontrolled component.
31
+ * Renders a SwiftUI `SecureField` for password input.
43
32
  */
44
33
  export declare function SecureField(props: SecureFieldProps): import("react").JSX.Element;
45
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swift-ui/SecureField/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,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