Skip to content

Outdated use-latest-callback dependency causes type error #4579

Closed
@rsmidt

Description

@rsmidt

Current behaviour

When trying to use a simple FAB.Group, a type error is emitted because of the "use-latest-callback" dependency:

Warning: TypeError: 0, _useLatestCallback.default is not a function (it is undefined)

This error is located at:
    in CardComponent (created by FAB.Group)
    in RCTView (created by View)
    in View (created by FAB.Group)
    in RCTView (created by View)
    in View (created by FAB.Group)
    in RCTView (created by View)
    in View (created by FAB.Group)
    in RCTView (created by View)
    in View (created by FAB.Group)
    in RCTView (created by View)
    in View (created by FAB.Group)
    in FAB.Group (created by TeamActionsFab)
....

Seems like a simple dep

Expected behaviour

It should not throw a type error.

How to reproduce?

The component definition:

function TeamActionsFab({ teamId }: TeamActionsFabProps) {
  const [fabState, setFabState] = useState({ open: false });

  const onStateChange = ({ open }: { open: boolean }) => setFabState({ open });

  return (
    <Portal>
      <FAB.Group
        visible
        open={fabState.open}
        icon="plus"
        actions={[
          {
            icon: "calendar",
            label: i18n.t("app.teams.actions.add_event"),
            onPress: () => console.log("Pressed add event"),
          },
        ]}
        onStateChange={onStateChange}
      />
    </Portal>
  );
}

Preview

What have you tried so far?

There's a similar issue in react-navigation: react-navigation/react-navigation#12056.
I've tried the steps laid out there (changing resolution, manually installing a newer version, ...), but nothing worked out.

What actually worked is manually overriding the dependency in the package.json:

  "overrides": {
    "use-latest-callback": "^0.2.3"
  }

If it's just a matter of bumping the version, I can prepare a PR.

Your Environment

software version
ios x (not used yet)
android 35
react-native 0.76.5
react-native-paper 5.12.5
node 22.11.0
npm or yarn npm (10.9.0)
expo sdk 52.0.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions