question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

focus, _root, getRef - missing from typings

See original GitHub issue

react-native, react and native-base version

  • RN 0.55.2
  • R 16.3.2
  • NB 2.4.2

Expected behaviour

Typings present

Actual behaviour

Typings not present

Steps to reproduce (code snippet or screenshot)

<Input getRef={(input) =>this.passwordInput = input}} />

Type ‘{ getRef: (input: any) => any; }’ has no properties in common with type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Rea…’.

function focusPassword(input: Input) {
    input._root.focus();
}

Property ‘_root’ does not exist on type ‘Input’.

As a result of above focus() is also missing I think but I’m not sure. I see it defined in NativeMethodsMixinStatic but doesn’t seem as if that’s being referenced anywhere

Screenshot of emulator/device

n/a

Is the bug present in both ios and android or in any one of them?

Yes

Any other additional info which would help us debug the issue quicker.

Can be temporarily fixed by adding below typings file to project (focus only actually exists on the value of _root but I don’t know what its meant to be, so I set it to Input)

declare module "native-base" {
    // getRef, _root, focus all missing
    namespace NativeBase {
        interface Input {
            focus?: () => void;
            _root?: Input;
            getRef?: (ref: Input) => void;
        }
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
janekolszakcommented, Jan 30, 2020

Yes, _root is still missing

4reactions
Slessicommented, Oct 4, 2019

@akhil-geekyants would just like to point out that this still isn’t fixed, _root remains missing from the types.

react-native, react and native-base version

  • RN 0.60.4
  • R 16.8.6
  • NB 2.13.8
Read more comments on GitHub >

github_iconTop Results From Across the Web

The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >
FAQs | React Hook Form - Simple React forms validation
React Hook Form is focusing on uncontrolled inputs, which means you don't need to change the input value via state via onChange ....
Read more >
What do I do when a TypeScript definition file I am using is ...
I notice it is missing the focus method on elements in the array returned by the refs property - so I cannot get...
Read more >
React.focus() Code Example - Code Grepper
it is missing from your system. Install or enable PHP's pcntl extension. Root composer.json requires php ^7.2.5 but your php version (8.0.6) does...
Read more >
Open Source Used In slido-test 22.06 - Cisco
1.1011 babel-plugin-syntax-typescript 7.14.5 ... 1.1384 focus-visible 5.2.0 ... (For example, a function in a library to compute square roots has.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found