Skip to content

SDK reinitialization with different config #417

@gtyanchev

Description

@gtyanchev

SDK version:

    "react-native": "0.76.7",
    "expo": "^52.0.37",
    "customerio-expo-plugin": "^2.0.2",
    "customerio-reactnative": "4.2.4",

Describe the issue
I have an app that operates in two major regions that have separate workspaces and credentials.
I want to be able to reinitialise the SDK with the correct keys when the region is changed within the app.

It seems like this is not possible at the moment?
Calling CustomerIO.initialize(config) multiple times results in a console warning and the SDK instance keeps using the original config.

Reloading the app using Expo's .reloadAsync on region change and then initialising the SDK, causes the SDK to fully stop working. I think .reloadAsync reloads only the JS bundle, but there is probably some state preserved in the native modules which causes the issue.

  1. Is that expected behaviour and what would you suggest to fix the issue?
  2. How hard would it be to reset the native module state?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions