Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Typescript support for Input's InputComponent when using useRef<InputComponent> #1004

Closed
garrettg123 opened this issue Apr 10, 2020 · 2 comments · Fixed by #1055
Closed
Labels
💡 Proposal 📱 Components components module-specific

Comments

@garrettg123
Copy link

🐛 Bug Report

In order to get the proper type for creating a ref for <Input>, I currently need to import the type from import { InputComponent } from '@ui-kitten/components/ui/input/input.component'.

To Reproduce

Steps to reproduce the behavior:
const inputRef = React.useRef<InputComponent>(null)

Expected behavior

InputComponent should be exported from the @ui-kitten/components. Is this fixed in 5.x?

Link to runnable example or repository (highly encouraged)

UI Kitten and Eva version

Package Version
@eva-design/eva 1.3.1
@ui-kitten/components 4.4.2

Environment information

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  Binaries:
    Node: 12.14.0 - /usr/local/bin/node
    Yarn: 1.19.1 - ~/.yarn/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27
      Build Tools: 19.1.0, 21.1.2, 23.0.1, 23.0.2, 23.0.3, 24.0.3, 25.0.0, 25.0.2, 26.0.2, 26.0.3, 28.0.2, 28.0.3
      System Images: android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  npmPackages:
    react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4
  npmGlobalPackages:
    react-native-cli: 2.0.1
@artyorsh
Copy link
Collaborator

artyorsh commented Apr 13, 2020

@garrett-gottlieb still an issue in v5. I have some ideas to make it work in a correct way so we can get rid of InputComponent using only Input, but it requires another breaking change, affecting a styled hoc.

Thinking to implement in alpha.2 for all components.

@artyorsh artyorsh added 💡 Proposal 📱 Components components module-specific labels Apr 13, 2020
@huynhtastic
Copy link

I've run into this as well. I haven't used refs much, but my workaround for it was:

import { TextInput } from 'react-native';

const inputRef = useRef<TextInput>(null);

This allows me to use the base input object to refer to.

@artyorsh artyorsh mentioned this issue Apr 25, 2020
2 tasks
@artyorsh artyorsh linked a pull request Apr 26, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Proposal 📱 Components components module-specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants