Cnilton / react-native-floating-label-input

A customizable React Native TextInput with its placeholder always shown. Includes masks, global styles, character count, and a bunch else.
MIT License
280 stars 58 forks source link

not working onChange #115

Closed Luhkas27 closed 2 years ago

Luhkas27 commented 2 years ago

Good afternoon, the input is not working correctly on his onChange, I have already updated both the lib here and the reanimated to see if it came back and nothing worked.

https://user-images.githubusercontent.com/41193788/158252720-dfc047e6-1da0-4139-b7eb-1cafb37d394e.mov

Cnilton commented 2 years ago

Hi @Luhkas27, I think you are using the wrong property. For the input text value change you should use onChangeText prop.

Luhkas27 commented 2 years ago

then follow the component code:

const handleChange = (value: any) => { let stageValue = value if (maskType && masks[maskType]) stageValue = masks [maskType] (value) if (onChange) onChange(stageValue) } return ( <> <S.Container> <S.WrapperInput> {icon && } <S.Input ref={(r) => { if (ref && r?._inputElement) { ref.current = r._inputElement } }} {...(onBlur ? { isFocused, onBlur } : {})} {...(onFocus ? { onFocus } : {})} label={label} value={(maskType && masksmaskType) || value} hintTextColor={theme.pallete.maskInput} maskType={maskType} mask={mask} maxDecimalPlaces={maxDecimalPlaces} keyboardType={keyboardType} multiline={multiline} maxLength={maxLength} hint={placeholder} autoCapitalize="none" autoCorrect={false} editable={editable} onChangeText={handleChange}

Cnilton commented 2 years ago

@Luhkas27 I'm sorry, but part of the code that is relevant for this probable issue is missing as being used in:

const handleChange = (value: any) => {
   let stageValue = value
   if (maskType && masks[maskType]) stageValue = masks [maskType] (value)
   if (onChange) onChange(stageValue)
}

Can you please inform the usage of masks, maskType, and onChange?

Cnilton commented 2 years ago

@Luhkas27, any update?

Luhkas27 commented 2 years ago

@Cnilton we couldn't come up with a concrete solution and decided to make another input component by hand

Cnilton commented 2 years ago

I'm sorry to hear that, but if you change your mind, I'll be right here!