react-native-text-input-mask / react-native-text-input-mask

Text input mask for React Native, Android and iOS
MIT License
1.19k stars 306 forks source link

Don't pass mask #20

Closed maksugr closed 6 years ago

maksugr commented 6 years ago

Can I use TextInputMask but with undefined or some other value of property mask (any character)? It's comfortable to use this component with mask and without.

maksugr commented 6 years ago

Anybody here? Can I somehow use mask for any symbol?)

ivanzotov commented 6 years ago

@maksugr yes, it checks if a mask prop is available – https://github.com/react-native-community/react-native-text-input-mask/blob/master/index.js#L23, so you can use TextInputMask like a TextInput without mask features. Let me know if it doesn't work :)

kirakik commented 6 years ago

@ivanzotov I get a crash in Android if I do not pass a mask. I think there's a null check missing.

screenshot_20171023-153753

ivanzotov commented 6 years ago

@kirakik thanks, reopened issue, will fix

maksugr commented 6 years ago

@ivanzotov yes, I had the same issue. sorry for non informative first message.

kirakik commented 6 years ago

@maksugr a work around for now would be to create a component that renders a text input, and pass it a mask prop when you need it. Then in the rendering of that component, you can do:


const Input = this.props.mask ? TextInputMask : TextInput
return (
    <Input {...} />
)
maksugr commented 6 years ago

@kirakik yes, this way is good and work, but not for me. I also wrap components in styled-components and my logic is more complicated then this, and it doesn't work without additional hacks. So I want TextInputMask that works without mask prop by default.

ivanzotov commented 6 years ago

@maksugr fixed in 0.6.2

annaweinstein-atlanticbank commented 3 years ago

i still get the same non-null error....