rememberTextFieldState
Composable Function
Common
@Composable
fun rememberTextFieldState(
initialText: String = "",
initialSelection: TextRange = TextRange(initialText.length),
): TextFieldState
Create and remember a TextFieldState. The state is remembered using rememberSaveable and so
will be saved and restored with the composition.
If you need to store a TextFieldState in another object, use the TextFieldState.Saver object
to manually save and restore the state.
Parameters
| initialText | The initial text state. If a different value is passed in a subsequent recomposition, the value of the state will not be updated. To update the state after it's initialized, call methods on TextFieldState. |
| initialSelection | The initial selection state. If a different value is passed in a subsequent recomposition, the value of the state will not be updated. To update the state after it's initialized, call methods on TextFieldState. |
