Update ControlledInputs.md

This commit is contained in:
Juho Teperi 2020-04-15 09:56:35 +03:00 committed by GitHub
parent 1e11774189
commit 9165f0b724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -26,7 +26,7 @@ Reagent to create the input element:
## React-native
ReactNative has it's own `TextInput` component. Similar workaround can't be (at least easily) implemented in ReactNative, as the component doesn't provide similar API as DOM Inputs to control the selection. Currently best option is to use controlled inputs (`default-value` and `on-change`). If you also need to update the input value from your code, you could change to Input component React key to force recreation of the component:
ReactNative has it's own `TextInput` component. Similar workaround can't be (at least easily) implemented in ReactNative, as the component doesn't provide similar API as DOM Inputs to control the selection. Currently best option is to use uncontrolled inputs (`default-value` and `on-change`). If you also need to update the input value from your code, you could change to Input component React key to force recreation of the component:
```clj
[:> TextInput
@ -39,6 +39,8 @@ ReactNative has it's own `TextInput` component. Similar workaround can't be (at
;; When key changes, old component is unmounted and new one created, and the new component will use the new default-value
```
(Similar workaround can be also used with DOM inputs)
## Examples
- [Material UI](./examples/material-ui.md)