FaridSafi / FaridSafi/react-native-gifted-form

value prop returned from getValue (if available) after you delete all text in textinput

Open
#52 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
211
PR merge metrics
No merged PRs in 30d

Description

In short, if you're passing in the `value` prop it will continue to be returned from `getValues` and `getValue` for the given input after you delete all text in the input. The expected result is that it returns `''`;

A temporary a solution is to use `onChangeText`, but still then that means you need to unnecessarily add it to all your forms. It's inconsistent with the expected results. For example, if I have 2 characters: `'ab'` and I delete one and then call `getValue` I'll get back `a`, but then if I delete `a`, you should get back `''`, but instead you will get back the string you passed in as the value prop.

I've searched the code and I can't for the life of me find where this mechanism to choose the value for `this.props.value` when what's entered is an empty string. It should be a quick fix for someone that knows.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the getValue and getValues entry points and the TextInput handling, including the onChangeText workaround described in the issue. Reproduce deletion from 'ab' to 'a' to '' and verify that both getters return '' after all text is removed instead of the original value prop.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.