swushi / react-native-input-outline

MIT License
123 stars 15 forks source link

On focus doesn't fire any events #20

Closed thedewpoint closed 2 years ago

thedewpoint commented 2 years ago

on focus never fires any events for me. I replaced InputOutline with a regular TextInput and it works fine so I think it's something wrong with this component

nitishkumar347 commented 2 years ago

try to use focus instead of onFocus working fine for me

swushi commented 2 years ago

Could you please provide some reproducible code?

nitishkumar347 commented 2 years ago

<MaterialTextfield fieldName={'phoneNo'} value={value.phoneNo} ref={(ref: any) => (inputRefs.current[1] = ref)} onSubmitEditing={() => inputRefs?.current[2].focus()} keyboardType={'number-pad'} error={error.phoneNo} label={i18n.t('mobile')} renderLeft={() => } starStatus onChangeText={changeText} /> here the ref i get through this component so use focus instead to onFocus

swushi commented 2 years ago

Im seeing a lot of fundamental mistakes in your code. I tested locally and onFocus works fine. Closing.

sbjesushenao commented 2 years ago

I'm having the same problem with the onFocus event. Is there incompatibility with react-hook-form controller?

swushi commented 2 years ago

@sbjesushenao I'm unfamiliar with that library. However, if that library works with vanilla TextInput from react-native, it should work. Could you please provide a snippet?

sbjesushenao commented 2 years ago

Hello, thanks for the reply, but I ended up using another library for my outlineInput. I tried your library without any Controller and still wasn't getting any response on the onFocus event. Maybe it is my react-native and reanimate version.

JoyCood commented 1 year ago

Hello, thanks for the reply, but I ended up using another library for my outlineInput. I tried your library without any Controller and still wasn't getting any response on the onFocus event. Maybe it is my react-native and reanimate version.

i have the same issue. @swushi

"react": "18.1.0",
"react-native": "0.70.6",
"react-native-input-outline": "^1.5.2",
"react-native-reanimated": "^2.13.0",
import { InputOutline } from 'react-native-input-outline';

const inputRef = useRef<InputOutline>(null);

<InputOutline
  ref={inputRef}
  placeholder={t`Enter password`}
  onFocus={() => console.log("mmmmmmmmmmmmmm")}
  onBlur={() => console.log("kkkkkkkkkkkkkkkk")}
/>