ui icon indicating copy to clipboard operation
ui copied to clipboard

Update TextInput.js

Open StephenTANM opened this issue 4 years ago • 0 comments

Fix for onFocus & onBlur silently failing. Reproduction example below...

import { TextInput } from "@shoutem/ui";

interface InitialState {
  focused: Boolean;
}
const textInput = React.createRef();

const Input = (props: any) => {

const [state, setstate] = useState<InitialState>({
    focused: false,
  });

  const onFocus = () => {
    setstate((oldstate) => ({
      ...state,
      focused: true,
    }));
  };

  const onBlur = () => {
    setstate((oldstate) => ({
      ...state,
      focused: false,
    }));
  };

  return (
    <TextInput
      onFocus={onFocus}
      onBlur={onBlur}
      autoFocus
    />
}

StephenTANM avatar Dec 04 '20 06:12 StephenTANM