Skip to content

Commit

Permalink
fix: use require in ReactNativeDriver (typeorm#6814)
Browse files Browse the repository at this point in the history
Because react native uses the browser context we can't use `PlatformTools.load` so this reverts the behavior for this file to use a standard `require` call

Fixes typeorm#6811
  • Loading branch information
imnotjames authored and Svetlozar committed Jan 12, 2021
1 parent dfa433d commit 9c2ac78
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/driver/react-native/ReactNativeDriver.ts
Expand Up @@ -5,7 +5,6 @@ import {QueryRunner} from "../../query-runner/QueryRunner";
import {Connection} from "../../connection/Connection";
import {DriverOptionNotSetError} from "../../error/DriverOptionNotSetError";
import {DriverPackageNotInstalledError} from "../../error/DriverPackageNotInstalledError";
import {PlatformTools} from "../../platform/PlatformTools";
import {ReplicationMode} from "../types/ReplicationMode";

export class ReactNativeDriver extends AbstractSqliteDriver {
Expand Down Expand Up @@ -91,7 +90,7 @@ export class ReactNativeDriver extends AbstractSqliteDriver {
*/
protected loadDependencies(): void {
try {
this.sqlite = PlatformTools.load("react-native-sqlite-storage");
this.sqlite = require("react-native-sqlite-storage");

} catch (e) {
throw new DriverPackageNotInstalledError("React-Native", "react-native-sqlite-storage");
Expand Down

0 comments on commit 9c2ac78

Please sign in to comment.