Skip to content

Normal TextInput behaviour on undefined mask property  #41

@jimmi-joensson

Description

@jimmi-joensson

Describe the Feature

I think it would make sense to make the MaskedTextInput component fallback to the normal TextInput behaviour when the mask property is undefined. This would mean that anything written in the input would be passed on in both text and rawText.

Possible Implementations

export const CustomInput = ({...props}: CustomInputProps) => {
  const [value, setValue] = React.useState('Hello world')

  const handleChangeText = React.useCallback((text, rawText) => {
    console.log('text:', text)
    console.log('rawText:', rawText)
    setValue(text)
  }, [])
  
  return (
      <MaskedTextInput
        mask={undefined}
        onChangeText={(text, rawText) => setValue(text)}}
        value={value}
        {...props}
      />
  )
}

// Typing "!" suffixed on "Hello world" in the input

// text: Hello world!
// rawText: Hello world!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions