Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextInput ignoring passed in value #28815

Closed
DChen7 opened this issue May 3, 2020 · 2 comments
Closed

TextInput ignoring passed in value #28815

DChen7 opened this issue May 3, 2020 · 2 comments
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@DChen7
Copy link

DChen7 commented May 3, 2020

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
Screen Shot 2020-05-02 at 11 04 34 PM
Screen Shot 2020-05-02 at 11 04 51 PM

React Native version:

0.62.0

Steps To Reproduce

  1. Type '2' into input
  2. 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);
  };
@react-native-bot react-native-bot added the Component: TextInput Related to the TextInput component. label May 3, 2020
@stale
Copy link

stale bot commented Aug 1, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 1, 2020
@stale
Copy link

stale bot commented Aug 8, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Aug 8, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants