Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Does react-native-client-sdk (v10) support expo web? #263

@QuanGao-osmind

Description

@QuanGao-osmind

Describe the bug
We have an expo project that we are targeting both mobile and web platforms. The react-native-client-sdk works well on mobile but crashes in web.

This is the error I see:

autoEnv.js:24 Uncaught TypeError: Cannot read properties of undefined (reading 'Manufacturer')

which traces to this code in autoEnv, seems like Platform.constants is undefined somehow.

export const ldDevice = {
    // key is populated by common/client-sdk
    key: '',
    envAttributesVersion: '1.0',
    manufacturer: Platform.select({
        ios: 'apple',
        android: Platform.constants.Manufacturer,
    }),
    model: Platform.select({
        // ios: model n/a from PlatformIOSStatic
        android: Platform.constants.Model,
    }),
    os: {
        family: Platform.select({
            ios: 'apple',
            default: Platform.OS,
        }),
        name: Platform.OS,
        version: (_a = Platform.Version) === null || _a === void 0 ? void 0 : _a.toString(),
    },
};

To reproduce
Follow the SDK doc to initialize LD client and identify user.

Expected behavior
Expect react-native-client-sdk to work on all platforms expo support (Android, IOS, web)

SDK version
10.1.3

OS/platform
Web browser: Chrome Version 124.0.6367.62

Any insights are greatly appreciated, thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions