From 375a2e1ec6536c438d0e0142e6d11e365c97491d Mon Sep 17 00:00:00 2001 From: Ziv Levy Date: Wed, 27 Jul 2022 13:46:16 +0300 Subject: [PATCH] fix: check for given options.transport before setting native transport layer #resolves #2397 --- src/js/client.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/client.ts b/src/js/client.ts index a76163e1ba..cef7a6d3fd 100644 --- a/src/js/client.ts +++ b/src/js/client.ts @@ -25,14 +25,14 @@ export class ReactNativeClient extends BaseClient { * @param options Configuration options for this SDK. */ public constructor(options: ReactNativeClientOptions) { - const transport = (options: BrowserTransportOptions, nativeFetch?: FetchImpl): Transport => { - if (NATIVE.isNativeTransportAvailable()) { - return new NativeTransport(); - } - return makeFetchTransport(options, nativeFetch); + if (!options.transport) { + options.transport = (options: BrowserTransportOptions, nativeFetch?: FetchImpl): Transport => { + if (NATIVE.isNativeTransportAvailable()) { + return new NativeTransport(); + } + return makeFetchTransport(options, nativeFetch); + }; } - - options.transport = transport; super(options); // This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning