Skip to content

Disable Fetch for ReactNative #5643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tasty-readers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

Change the networking API to use XHR instead of `fetch()` for ReactNative.
2 changes: 1 addition & 1 deletion packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dev": "rollup -c -w",
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"prettier": "prettier --write '*.js' '*.ts' '@(lite|src|test)/**/*.ts'",
"prettier": "prettier --write '*.js' '@(lite|src|test)/**/*.ts'",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier fails since there are no *.ts files at the root anymore.

"test:lite": "node ./scripts/run-tests.js --emulator --platform node_lite --main=lite/index.ts 'test/lite/**/*.test.ts'",
"test:lite:prod": "node ./scripts/run-tests.js --platform node_lite --main=lite/index.ts 'test/lite/**/*.test.ts'",
"test:lite:browser": "karma start --single-run --lite",
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/src/index.rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

import { registerFirestore } from './register';

registerFirestore('rn');
registerFirestore('rn', /* useFetchStreams= */ false);

export * from './api';
7 changes: 5 additions & 2 deletions packages/firestore/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import { setSDKVersion } from '../src/core/version';
import { Firestore } from './api/database';
import { PrivateSettings } from './lite-api/settings';

export function registerFirestore(variant?: string): void {
export function registerFirestore(
variant?: string,
useFetchStreams = true
): void {
setSDKVersion(SDK_VERSION);
_registerComponent(
new Component(
Expand All @@ -42,7 +45,7 @@ export function registerFirestore(variant?: string): void {
container.getProvider('auth-internal')
)
);
settings = { useFetchStreams: true, ...settings };
settings = { useFetchStreams, ...settings };
firestoreInstance._setSettings(settings);
return firestoreInstance;
},
Expand Down