Error UIKit hooks after upgrading to react native 0.72

After upgrading from react native 0.71.10 to 0.72.4, many of the hooks are throwing errors immediately when called:

const { openSheet } = useBottomSheet();
// ERROR  Error: BottomSheetContext is not provided, wrap your app with DialogProvider

const { openMenu } = useActionMenu();
// ERROR  Error: ActionMenuContext is not provided, wrap your app with DialogProvider
const { alert } = useAlert();
// ERROR  Error: AlertContext is not provided, wrap your app with DialogProvider

const toast = useToast();
//  ERROR  Error: ToastContext is not provided, wrap your app with ToastProvider

The component is wrapped in SendbirdUIKitContainer, and from looking through the code, that component should be setting up the contexts.

Nothing has changed in the application code other than upgrading react native, and interestingly, the other UIKit components I’m using are working correctly, including GroupChannelListFragment and GroupChannelFragment. The bottom sheet and dialogs even render when interacting with those components.

[UIKit Version]

    "@sendbird/chat": "^4.9.5",
    "@sendbird/uikit-react-native": "^3.0.4",
    "@sendbird/uikit-react-native-foundation": "^3.1.0",
    "react": "18.2.0",
    "react-native": "0.72.4",

[Reproduction Steps]
Setup a react native app and try to use any of the hooks.

Ideally the Sendbird RN sample app would be updated to the latest version of RN, and then it would be simpler to provide repo steps for you. It’s very far behind right now at version 0.67.5

100% of the time I try to use any of the hooks after upgrading react native

[Current impact]
I cannot use the hooks. Fortunately, I don’t have any critical path production use cases for them right this moment, but I’m worried it is an indication that there are issues with the other UIKit components.

Hello @curthipster.

uikit-react-native has uikit-react-native-foundation as a dependency rather than a peerDependency.

Due to this, if you install uikit-react-native-foundation with a different version from uikit-react-native, it can lead to the installation of two separate modules of uikit-react-native-foundation, which might result in errors when referencing different react contexts.

Could you please try removing uikit-react-native-foundation and upgrading the version of uikit-react-native to 3.1.0?

That worked! Thank you so much.

1 Like