-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Component: TextInputRelated to the TextInput component.Related to the TextInput component.Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
TextInput component shows different value than what is passed in through the value prop
React Native version:
0.62.0
Steps To Reproduce
- Type '2' into input
- Type 'f' into input twice
Expected Results
Expected to only see integers in the text input
Snack, code example, screenshot, or link to a repository:
const onChange = (value: string) => {
const trimmed = value.replace(/\D/g,'');
props.onChange(trimmed.substring(0, Math.min(trimmed.length, props.maxDigits)));
}
console.log('props.value', props.value)
return (
<TextInput
onChangeText={onChange}
value={props.value}
/>
);
passed in onChange function is just onChangeWeight:
const [weight, setWeight] = useState('');
const onChangeWeight = (w: string) => {
return setWeight(w);
};
geomih
Metadata
Metadata
Assignees
Labels
Component: TextInputRelated to the TextInput component.Related to the TextInput component.Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.