React-native-ui-kitten: No focusInput() in Input (react-native-ui-kitten 4.0.3)

Created on 26 Jun 2019  ·  6Comments  ·  Source: akveo/react-native-ui-kitten

Issue type

I'm submitting a ... (check one with "x")

  • [x] bug report
  • [ ] feature request

Issue description

Current behavior:

There is no focusInput() in the current version.

Expected behavior:

I want to be able to focus the Input programmatically.

Steps to reproduce:

  1. Use a simple input
  2. Assign the input to a ref
  3. Call focusInput() on ref

Related code:

import React, { useRef, useImperativeHandle, forwardRef } from "react";
import {
  Input as KittenInput,
  InputProps as KittenInputProps
} from "react-native-ui-kitten";

interface Props {}
export type InputProps = Props & KittenInputProps;

const InputComponent: React.FC<InputProps> = (props, ref) => {
  const inputRef = useRef();

  useImperativeHandle(ref, () => ({
    focus: () => {
      console.log("focus", inputRef.current.refs);
      inputRef.current.focusInput();
    }
  }));

  return <KittenInput ref={inputRef} {...props} />;
};

export const Input = forwardRef(InputComponent);

Other information:

OS, device, package version

"react-native-ui-kitten": "^4.0.3"
Bug Components

All 6 comments

Thanks for report @FabianEhringer

Looks like this is a global problem, related not only to an Input but for all components 😱
Working on this. Thanks again

You are welcome! Thank's for the quick response time. We're switching from native-base to ui-kitten and we're very excited about your framework. We're on the verge of using it in production. :)

@FabianEhringer pleased to hear that 👍
We're interested in the reasons for your migration decision. We think this could help us become even better. Can you please contact us?

@artyorsh Yes of course, we would be happy to help. We will contact you with the reasons for our migration and additional feedback via email. :)

[email protected] - your feedback would be very helpful for us :)

Was this page helpful?
0 / 5 - 0 ratings