Skip to content

Commit

Permalink
fix: check for given options.transport before setting native transpor…
Browse files Browse the repository at this point in the history
…t layer

#resolves getsentry#2397
  • Loading branch information
zivl authored Jul 27, 2022
1 parent 33a99e8 commit 375a2e1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/js/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
* @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
Expand Down

0 comments on commit 375a2e1

Please sign in to comment.