petrogad / react-native-materialui-textfield

Material textfield
Other
24 stars 20 forks source link

defaultValue becomes a placeholder #3

Open murtraja opened 5 years ago

murtraja commented 5 years ago

Issue: Having a defaultValue prop passed in, makes it a placeholder (color greyed out). As soon as focus is granted to the field, this defaultValue which was passed, disappears and the field is cleared. <TextField defaultValue={'this will become a placeholder :('}/>

Workaround: instead of using defaultValue prop, use value prop. Now, whenever user clicks on the field and focus is granted, the defaultValue persists (and even the color is not greyed out) <TextField value={'this will NOT become a placeholder, but a default value :)'}/>

"react-native-materialui-textfield": "^0.13.2", "react": "^16.6.0", "react-native": "0.57.3",