Skip to content

Multiple mode can pass string arrays to TextInput value #4

Description

@alx-so

Problem

The public input value type allows string | string[]. In controlled mode, Input casts props.value to string and passes it directly to React Native TextInput.value.

When multiple is enabled and a consumer passes value={["Apple"]} or another string array, the native TextInput can receive an array instead of a string.

Impact

React Native TextInput.value expects a string. Passing an array can cause runtime warnings, invalid rendering, or platform-specific input behavior.

Code references

  • src/components/Input/Input.tsx#L17: InputValue allows string | string[].
  • src/components/Input/Input.tsx#L31-L32: public value and defaultValue use InputValue.
  • src/components/Input/Input.tsx#L62: controlled value is cast to string without validation or composition.
  • src/components/Input/Input.tsx#L223-L225: value is passed to TextInput.
  • src/components/Input/utils.ts#L5-L11: composeValue already normalizes multiple mode to an empty text input value, but it is not applied to controlled render values.

Acceptance criteria

  • TextInput.value always receives a string.
  • Multiple mode handles selected tags separately from the current editable text.
  • Controlled and uncontrolled value behavior is made explicit in types and runtime code.
  • Regression tests cover multiple value={string[]} and multiple defaultValue={string[]} without passing arrays to TextInput.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: inputInput and TextInput behaviorarea: multiselectMultiple selection and tag behaviorbugSomething isn't workingpriority: highHigh impact issue for the next release

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions