Skip to content

[Expo web] Uncaught Error _Keyboard.default.metrics is not a function #154

@TrevorOchmonek

Description

@TrevorOchmonek

Using the component in an Expo app (web) this exception is thrown:

Uncaught Error
_Keyboard.default.metrics is not a function
Call Stack
  setTimeout$argument_0
    node_modules/react-native-autocomplete-dropdown/lib/module/index.js

The function in question is calculateDirection: there's a setTimeout lambda beginning with
const kbHeight = Keyboard.metrics()?.height || 0
Changing it like this seems to fix it:
const kbHeight = Keyboard.metrics?.()?.height || 0

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