Skip to content

Issue when currentlyFocusedInput is not found #3

@jacquesdev

Description

@jacquesdev

I'm experiencing an issue on this line:

currentlyFocusedInput.measureInWindow((_x, y, _width, height) => {

I'm getting this error: TypeError: Cannot read property 'measureInWindow' of null. That means this line

const currentlyFocusedInput = TextInput.State.currentlyFocusedInput();

is returning null

Now in my use case, this error happens when I switch between clicking on TextInputs that are sometimes disabled (since I want the look of a text input, but use an onPress to interact with instead). I'm wondering if your code would not be able to read it if it's disabled, and if that is why it's returning that type error? Otherwise I guess just finding a solution where you confirm that currentlyFocusedInput exists, eg currentlyFocusedInput?.measureInWindow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions