Nikolay
Nikolay
Maybe something like: ```js import React from 'react' import { TextInput } from 'react-native' export default function PhoneTextInput({ placeholder, autoComplete, autoFocus, value, onChange }) { return ( ); } ```...
Yes, see if it works. I don't have React Native so I didn't check.
> On Load I get a warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef(). The component uses `React.forwardRef()`....
> Do I need to install the input-format package separately? No, it's installed automatically. The code above should work because it forwards `ref` now. Did the `forwardRef` warning disappear?
Doesn’t it show a stack trace? On Thu, 23 Jan 2020 at 18:23, Ayan Dey wrote: > Yes, the forward ref warning disappeared but I get the TypeError. > >...
So, the error originates at that function: https://github.com/catamphetamine/input-format/blob/26abb77bec3ac5984f7fe99408846464fda6136a/source/input%20control.js#L35-L38 Called from here: https://github.com/catamphetamine/input-format/blob/26abb77bec3ac5984f7fe99408846464fda6136a/source/react/Input.js#L35-L41 And `input` there is `ref.current`. There, for some reason `ref.current` is `undefined`. I read a bit about React...
Oh, yes, change `onChangeText` to `onChange` in ``. On Fri, 24 Jan 2020 at 09:10, Ayan Dey wrote: > On adding smartCaret: { false } I receive a TypeError. >...
So `event.target.value` is `undefined` at this line of code: https://github.com/catamphetamine/react-phone-number-input/blob/d84e5ad751c60b083850a634899d9ad5e5039ce9/source/InputBasic.js#L26 You can add some kind of `console.log(event.target.value)` in `onChange` to see what's the `value` there. ```js { console.log(event); onChange(event); }}/>...
Huh, so `target` is a number in React Native? How does one get value then. Well, ok, then try this instead: ```js onChange({ preventDefault() { this.defaultPrevented = true }, target:...
@whimsicaldreamer > I guess we get the values from `nativeEvent.text`. Maybe. That could be a second route. Not yet though. > Where should I try the above? I meant: ```js...