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

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

Open
rsmidt opened this issue Dec 18, 2024 · 0 comments
Open

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

rsmidt opened this issue Dec 18, 2024 · 0 comments
Labels

Comments

@rsmidt
Copy link

rsmidt commented Dec 18, 2024

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
@rsmidt rsmidt added the bug label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant