diff --git a/patches/react-native-firebase+5.6.0.patch b/patches/react-native-firebase+5.6.0.patch index d65479c04..ee9fbe3a2 100644 --- a/patches/react-native-firebase+5.6.0.patch +++ b/patches/react-native-firebase+5.6.0.patch @@ -1,840 +1,878 @@ +diff --git a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java +index d0836e2..5917d97 100644 +--- a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java ++++ b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java +@@ -213,4 +213,14 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule { + } + } + } ++ ++ @ReactMethod ++ public void addListener(String eventName) { ++ // Required by NativeEventEmitter ++ } ++ ++ @ReactMethod ++ public void removeListeners(Integer count) { ++ // Required by NativeEventEmitter ++ } + } diff --git a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java index c9d63ff..ef725ad 100644 --- a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java +++ b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java @@ -475,7 +475,7 @@ public class DisplayNotificationTask extends AsyncTask { context, notificationId.hashCode(), intent, - PendingIntent.FLAG_UPDATE_CURRENT + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE ); } +diff --git a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java +index 7115b38..9f72acf 100644 +--- a/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java ++++ b/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java +@@ -480,4 +480,14 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen + } + } + } ++ ++ @ReactMethod ++ public void addListener(String eventName) { ++ // Required by NativeEventEmitter ++ } ++ ++ @ReactMethod ++ public void removeListeners(Integer count) { ++ // Required by NativeEventEmitter ++ } + } diff --git a/node_modules/react-native-firebase/dist/common/commonTypes.flow.js.flow b/node_modules/react-native-firebase/dist/common/commonTypes.flow.js.flow index 228a72d..982a997 100644 --- a/node_modules/react-native-firebase/dist/common/commonTypes.flow.js.flow +++ b/node_modules/react-native-firebase/dist/common/commonTypes.flow.js.flow @@ -1,3 +1,5 @@ +// @flow + export type NativeErrorObject = { code: string, message: string, @@ -11,9 +13,9 @@ export type NativeErrorResponse = { [key: string]: ?any, }; -export interface NativeErrorInterface extends Error { +export interface NativeErrorInterface { +code: string; - +message: string; + message: string; +nativeErrorCode: string | number; +nativeErrorMessage: string; } diff --git a/node_modules/react-native-firebase/dist/index.js.flow b/node_modules/react-native-firebase/dist/index.js.flow index 04ee2d9..ba9fdcf 100644 --- a/node_modules/react-native-firebase/dist/index.js.flow +++ b/node_modules/react-native-firebase/dist/index.js.flow @@ -9,7 +9,8 @@ export * from './modules/core/firebase'; /* * Export App types */ -export type { default as App } from './modules/core/app'; +import type AppModule from './modules/core/app'; +export type App = AppModule; /* * Export Auth types diff --git a/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js b/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js index 1c40468..66e191c 100644 --- a/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js +++ b/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js @@ -1,26 +1,10 @@ import React from 'react'; -import { ViewPropTypes, requireNativeComponent, Platform } from 'react-native'; +import { requireNativeComponent, Platform } from 'react-native'; import PropTypes from 'prop-types'; import EventTypes, { NativeExpressEventTypes } from './EventTypes'; import { nativeToJSError } from '../../utils'; import AdRequest from './AdRequest'; import VideoOptions from './VideoOptions'; -const adMobPropTypes = { ...ViewPropTypes, - size: PropTypes.string.isRequired, - unitId: PropTypes.string.isRequired, - - /* eslint-disable react/forbid-prop-types */ - request: PropTypes.object, - video: PropTypes.object - /* eslint-enable react/forbid-prop-types */ - -}; -Object.keys(EventTypes).forEach(eventType => { - adMobPropTypes[eventType] = PropTypes.func; -}); -Object.keys(NativeExpressEventTypes).forEach(eventType => { - adMobPropTypes[eventType] = PropTypes.func; -}); const nativeComponents = {}; function getNativeComponent(name) { @@ -35,7 +19,6 @@ function getNativeComponent(name) { } class AdMobComponent extends React.Component { - static propTypes = adMobPropTypes; static defaultProps = { request: new AdRequest().addTestDevice().build(), video: new VideoOptions().build() diff --git a/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js.flow b/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js.flow index 4162bb1..f37c353 100644 --- a/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js.flow +++ b/node_modules/react-native-firebase/dist/modules/admob/AdMobComponent.js.flow @@ -1,5 +1,5 @@ import React from 'react'; -import { ViewPropTypes, requireNativeComponent, Platform } from 'react-native'; +import { requireNativeComponent, Platform } from 'react-native'; import PropTypes from 'prop-types'; import EventTypes, { NativeExpressEventTypes } from './EventTypes'; import { nativeToJSError } from '../../utils'; @@ -7,22 +7,6 @@ import { nativeToJSError } from '../../utils'; import AdRequest from './AdRequest'; import VideoOptions from './VideoOptions'; -const adMobPropTypes = { - ...ViewPropTypes, - size: PropTypes.string.isRequired, - unitId: PropTypes.string.isRequired, - /* eslint-disable react/forbid-prop-types */ - request: PropTypes.object, - video: PropTypes.object, - /* eslint-enable react/forbid-prop-types */ -}; -Object.keys(EventTypes).forEach(eventType => { - adMobPropTypes[eventType] = PropTypes.func; -}); -Object.keys(NativeExpressEventTypes).forEach(eventType => { - adMobPropTypes[eventType] = PropTypes.func; -}); - const nativeComponents = {}; function getNativeComponent(name) { @@ -37,8 +21,6 @@ function getNativeComponent(name) { } class AdMobComponent extends React.Component { - static propTypes = adMobPropTypes; - static defaultProps = { request: new AdRequest().addTestDevice().build(), video: new VideoOptions().build(), diff --git a/node_modules/react-native-firebase/dist/modules/admob/AdRequest.js.flow b/node_modules/react-native-firebase/dist/modules/admob/AdRequest.js.flow index 41d2d5d..c2f5e0a 100644 --- a/node_modules/react-native-firebase/dist/modules/admob/AdRequest.js.flow +++ b/node_modules/react-native-firebase/dist/modules/admob/AdRequest.js.flow @@ -1,4 +1,18 @@ +// @flow + +type AdRequestProps = {| + keywords: string[], + testDevices: string[], + contentUrl?: string, + gender?: Gender, + requestAgent?: string, + isDesignedForFamilies?: boolean, + tagForChildDirectedTreatment?: boolean, +|}; +type Gender = 'male | female | unknown'; export default class AdRequest { + _props: AdRequestProps; + constructor() { this._props = { keywords: [], @@ -6,30 +20,30 @@ export default class AdRequest { }; } - build() { + build(): AdRequestProps { return this._props; } - addTestDevice(deviceId?: string) { + addTestDevice(deviceId?: string): AdRequest { this._props.testDevices.push(deviceId || 'DEVICE_ID_EMULATOR'); return this; } - addKeyword(keyword: string) { + addKeyword(keyword: string): AdRequest { this._props.keywords.push(keyword); return this; } - setBirthday() { + setBirthday(): void { // TODO } - setContentUrl(url: string) { + setContentUrl(url: string): AdRequest { this._props.contentUrl = url; return this; } - setGender(gender: 'male | female | unknown') { + setGender(gender: Gender): AdRequest { const genders = ['male', 'female', 'unknown']; if (genders.includes(gender)) { this._props.gender = gender; @@ -37,21 +51,21 @@ export default class AdRequest { return this; } - setLocation() { + setLocation(): void { // TODO } - setRequestAgent(requestAgent: string) { + setRequestAgent(requestAgent: string): AdRequest { this._props.requestAgent = requestAgent; return this; } - setIsDesignedForFamilies(isDesignedForFamilies: boolean) { + setIsDesignedForFamilies(isDesignedForFamilies: boolean): AdRequest { this._props.isDesignedForFamilies = isDesignedForFamilies; return this; } - tagForChildDirectedTreatment(tagForChildDirectedTreatment: boolean) { + tagForChildDirectedTreatment(tagForChildDirectedTreatment: boolean): AdRequest { this._props.tagForChildDirectedTreatment = tagForChildDirectedTreatment; return this; } diff --git a/node_modules/react-native-firebase/dist/modules/admob/Interstitial.js.flow b/node_modules/react-native-firebase/dist/modules/admob/Interstitial.js.flow index a2f4c82..db795d7 100644 --- a/node_modules/react-native-firebase/dist/modules/admob/Interstitial.js.flow +++ b/node_modules/react-native-firebase/dist/modules/admob/Interstitial.js.flow @@ -1,3 +1,5 @@ +// @flow + import { Platform } from 'react-native'; import { statics } from './'; import AdRequest from './AdRequest'; @@ -8,8 +10,10 @@ import type AdMob from './'; let subscriptions = []; -export default class Interstitial { +class Interstitial { _admob: AdMob; + adUnit: string; + loaded: boolean; constructor(admob: AdMob, adUnit: string) { // Interstitials on iOS require a new instance each time @@ -79,7 +83,7 @@ export default class Interstitial { * Return a local instance of isLoaded * @returns {boolean} */ - isLoaded() { + isLoaded(): boolean { return this.loaded; } @@ -87,7 +91,7 @@ export default class Interstitial { * Show the advert - will only show if loaded * @returns {*} */ - show() { + show(): void { if (this.loaded) { getNativeModule(this._admob).interstitialShowAd(this.adUnit); } @@ -99,7 +103,7 @@ export default class Interstitial { * @param listenerCb * @returns {null} */ - on(eventType, listenerCb) { + on(eventType: string, listenerCb: Function) { if (!statics.EventTypes[eventType]) { console.warn( `Invalid event type provided, must be one of: ${Object.keys( @@ -117,3 +121,5 @@ export default class Interstitial { return sub; } } + +export default Interstitial; diff --git a/node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js.flow b/node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js.flow index d89df42..ab3bc43 100644 --- a/node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js.flow +++ b/node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js.flow @@ -1,3 +1,5 @@ +// @flow + import { statics } from './'; import AdRequest from './AdRequest'; import { SharedEventEmitter } from '../../utils/events'; @@ -9,6 +11,8 @@ let subscriptions = []; export default class RewardedVideo { _admob: AdMob; + adUnit: string; + loaded: boolean; constructor(admob: AdMob, adUnit: string) { for (let i = 0, len = subscriptions.length; i < len; i++) { @@ -106,7 +110,7 @@ export default class RewardedVideo { * @param listenerCb * @returns {null} */ - on(eventType, listenerCb) { + on(eventType: string, listenerCb: Function) { const types = { ...statics.EventTypes, ...statics.RewardedVideoEventTypes, diff --git a/node_modules/react-native-firebase/dist/modules/auth/AuthSettings.js.flow b/node_modules/react-native-firebase/dist/modules/auth/AuthSettings.js.flow index 997efc7..7b84def 100644 --- a/node_modules/react-native-firebase/dist/modules/auth/AuthSettings.js.flow +++ b/node_modules/react-native-firebase/dist/modules/auth/AuthSettings.js.flow @@ -1,3 +1,5 @@ +// @flow + import { getNativeModule } from '../../utils/native'; import { isAndroid, isIOS } from '../../utils'; diff --git a/node_modules/react-native-firebase/dist/modules/auth/User.js.flow b/node_modules/react-native-firebase/dist/modules/auth/User.js.flow index 96026b6..86c9b24 100644 --- a/node_modules/react-native-firebase/dist/modules/auth/User.js.flow +++ b/node_modules/react-native-firebase/dist/modules/auth/User.js.flow @@ -16,10 +16,10 @@ import type { IdTokenResult, } from './types'; -type UpdateProfile = { - displayName?: string, - photoURL?: string, -}; +type UpdateProfile = $Shape<{| + +displayName?: string, + +photoURL?: string, +|}>; export default class User { _auth: Auth; diff --git a/node_modules/react-native-firebase/dist/modules/core/app.js.flow b/node_modules/react-native-firebase/dist/modules/core/app.js.flow index 6e27c61..0b0b492 100644 --- a/node_modules/react-native-firebase/dist/modules/core/app.js.flow +++ b/node_modules/react-native-firebase/dist/modules/core/app.js.flow @@ -21,7 +21,9 @@ import Links, { NAMESPACE as LinksNamespace } from '../links'; import Messaging, { NAMESPACE as MessagingNamespace } from '../messaging'; import Notifications, { NAMESPACE as NotificationsNamespace, + statics as NotificationsStatics, } from '../notifications'; +import type { NativeNotification } from '../notifications/types'; import Performance, { NAMESPACE as PerfNamespace } from '../perf'; import Storage, { NAMESPACE as StorageNamespace } from '../storage'; import Utils, { NAMESPACE as UtilsNamespace } from '../utils'; @@ -63,7 +65,12 @@ export default class App { messaging: () => Messaging; - notifications: () => Notifications; + notifications: + & ((): Notifications) + & { + +Android: NotificationsStatics.Android, + +Notification: NotificationsStatics.Notification, + }; perf: () => Performance; @@ -77,7 +84,7 @@ export default class App { fromNative: boolean = false ) { this._name = name; - this._options = Object.assign({}, options); + this._options = { ...options }; if (fromNative) { this._initialized = true; @@ -129,7 +136,7 @@ export default class App { * @return {*} */ get options(): FirebaseOptions { - return Object.assign({}, this._options); + return { ...this._options }; } /** diff --git a/node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js.flow index b8ef7c2..37fe40e 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js.flow @@ -8,7 +8,7 @@ import CollectionReference from './CollectionReference'; import { parseUpdateArgs } from './utils'; import { buildNativeMap } from './utils/serialize'; import { getNativeModule } from '../../utils/native'; -import { firestoreAutoId, isFunction, isObject } from '../../utils'; +import { firestoreAutoId, isObject } from '../../utils'; import { getAppEventName, SharedEventEmitter } from '../../utils/events'; import type Firestore from './'; @@ -137,8 +137,8 @@ export default class DocumentReference { let observer: Observer; let docListenOptions = {}; // Called with: onNext, ?onError - if (isFunction(optionsOrObserverOrOnNext)) { - if (observerOrOnNextOrOnError && !isFunction(observerOrOnNextOrOnError)) { + if (typeof optionsOrObserverOrOnNext === 'function') { + if (observerOrOnNextOrOnError && typeof observerOrOnNextOrOnError !== 'function') { throw new Error( 'DocumentReference.onSnapshot failed: Second argument must be a valid function.' ); @@ -150,14 +150,14 @@ export default class DocumentReference { }; } else if ( optionsOrObserverOrOnNext && - isObject(optionsOrObserverOrOnNext) + typeof optionsOrObserverOrOnNext === 'object' ) { // Called with: Observer if (optionsOrObserverOrOnNext.next) { - if (isFunction(optionsOrObserverOrOnNext.next)) { + if (typeof optionsOrObserverOrOnNext.next === 'function') { if ( optionsOrObserverOrOnNext.error && - !isFunction(optionsOrObserverOrOnNext.error) + typeof optionsOrObserverOrOnNext.error !== 'function' ) { throw new Error( 'DocumentReference.onSnapshot failed: Observer.error must be a valid function.' @@ -181,27 +181,27 @@ export default class DocumentReference { ) { docListenOptions = optionsOrObserverOrOnNext; // Called with: Options, onNext, ?onError - if (isFunction(observerOrOnNextOrOnError)) { - if (onError && !isFunction(onError)) { + if (typeof observerOrOnNextOrOnError === 'function') { + if (onError && typeof onError !== 'function') { throw new Error( 'DocumentReference.onSnapshot failed: Third argument must be a valid function.' ); } - // $FlowExpectedError: Not coping with the overloaded method signature observer = { + // $FlowExpectedError: Not coping with the overloaded method signature next: observerOrOnNextOrOnError, error: onError, }; // Called with Options, Observer } else if ( observerOrOnNextOrOnError && - isObject(observerOrOnNextOrOnError) && + typeof observerOrOnNextOrOnError === 'object' && observerOrOnNextOrOnError.next ) { - if (isFunction(observerOrOnNextOrOnError.next)) { + if (typeof observerOrOnNextOrOnError.next === 'function') { if ( observerOrOnNextOrOnError.error && - !isFunction(observerOrOnNextOrOnError.error) + typeof observerOrOnNextOrOnError.error !== 'function' ) { throw new Error( 'DocumentReference.onSnapshot failed: Observer.error must be a valid function.' diff --git a/node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js.flow index edbd9dc..c4e2598 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js.flow @@ -2,7 +2,7 @@ * @flow * FieldValue representation wrapper */ -import AnyJs from './utils/any'; +import type { AnyJs } from './utils/any'; import { buildNativeArray } from './utils/serialize'; // TODO: Salakar: Refactor in v6 diff --git a/node_modules/react-native-firebase/dist/modules/firestore/Query.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/Query.js.flow index 1716dbe..80df382 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/Query.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/Query.js.flow @@ -8,7 +8,7 @@ import SnapshotError from './SnapshotError'; import DocumentSnapshot from './DocumentSnapshot'; import { getNativeModule } from '../../utils/native'; import { buildNativeArray, buildTypeMap } from './utils/serialize'; -import { firestoreAutoId, isFunction, isObject } from '../../utils'; +import { firestoreAutoId, isObject } from '../../utils'; import { getAppEventName, SharedEventEmitter } from '../../utils/events'; import type Firestore from './'; @@ -55,7 +55,7 @@ type FieldOrder = {| fieldPath: NativeFieldPath, |}; -type QueryOptions = { +type QueryOptions = $Shape<{| endAt?: any[], endBefore?: any[], limit?: number, @@ -63,7 +63,7 @@ type QueryOptions = { selectFields?: string[], startAfter?: any[], startAt?: any[], -}; +|}>; export type ObserverOnError = SnapshotError => void; export type ObserverOnNext = QuerySnapshot => void; @@ -274,8 +274,8 @@ export default class Query { let observer: Observer; let metadataChanges = {}; // Called with: onNext, ?onError - if (isFunction(optionsOrObserverOrOnNext)) { - if (observerOrOnNextOrOnError && !isFunction(observerOrOnNextOrOnError)) { + if (typeof optionsOrObserverOrOnNext === 'function') { + if (observerOrOnNextOrOnError && typeof observerOrOnNextOrOnError !== 'function') { throw new Error( 'Query.onSnapshot failed: Second argument must be a valid function.' ); @@ -287,14 +287,14 @@ export default class Query { }; } else if ( optionsOrObserverOrOnNext && - isObject(optionsOrObserverOrOnNext) + typeof optionsOrObserverOrOnNext === 'object' ) { // Called with: Observer if (optionsOrObserverOrOnNext.next) { - if (isFunction(optionsOrObserverOrOnNext.next)) { + if (typeof optionsOrObserverOrOnNext.next === 'function') { if ( optionsOrObserverOrOnNext.error && - !isFunction(optionsOrObserverOrOnNext.error) + typeof optionsOrObserverOrOnNext.error !== 'function' ) { throw new Error( 'Query.onSnapshot failed: Observer.error must be a valid function.' @@ -318,27 +318,27 @@ export default class Query { ) { metadataChanges = optionsOrObserverOrOnNext; // Called with: Options, onNext, ?onError - if (isFunction(observerOrOnNextOrOnError)) { - if (onError && !isFunction(onError)) { + if (typeof observerOrOnNextOrOnError === 'function') { + if (onError && typeof onError !== 'function') { throw new Error( 'Query.onSnapshot failed: Third argument must be a valid function.' ); } - // $FlowExpectedError: Not coping with the overloaded method signature observer = { + // $FlowExpectedError: Not coping with the overloaded method signature next: observerOrOnNextOrOnError, error: onError, }; // Called with Options, Observer } else if ( observerOrOnNextOrOnError && - isObject(observerOrOnNextOrOnError) && + typeof observerOrOnNextOrOnError === 'object' && observerOrOnNextOrOnError.next ) { - if (isFunction(observerOrOnNextOrOnError.next)) { + if (typeof observerOrOnNextOrOnError.next === 'function') { if ( observerOrOnNextOrOnError.error && - !isFunction(observerOrOnNextOrOnError.error) + typeof observerOrOnNextOrOnError.error !== 'function' ) { throw new Error( 'Query.onSnapshot failed: Observer.error must be a valid function.' diff --git a/node_modules/react-native-firebase/dist/modules/firestore/SnapshotError.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/SnapshotError.js.flow index 105574d..c34819e 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/SnapshotError.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/SnapshotError.js.flow @@ -1,3 +1,5 @@ +// @flow + import NativeError from '../../common/NativeError'; import type { SnapshotErrorInterface } from './firestoreTypes.flow'; import type { NativeErrorResponse } from '../../common/commonTypes.flow'; diff --git a/node_modules/react-native-firebase/dist/modules/firestore/Transaction.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/Transaction.js.flow index 0f96640..b564830 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/Transaction.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/Transaction.js.flow @@ -18,9 +18,9 @@ type Command = { options?: SetOptions | {}, }; -type SetOptions = { +type SetOptions = $Shape<{| merge: boolean, -}; +|}>; // TODO docs state all get requests must be made FIRST before any modifications // TODO so need to validate that diff --git a/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow index 624acf0..f4b3039 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow @@ -18,7 +18,7 @@ const generateTransactionId = (): number => transactionId++; export type TransactionMeta = { id: number, - stack: string[], + stack: string, reject?: Function, resolve?: Function, transaction: Transaction, diff --git a/node_modules/react-native-firebase/dist/modules/firestore/utils/any.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/utils/any.js.flow index af9d484..caf587e 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/utils/any.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/utils/any.js.flow @@ -1,4 +1,7 @@ +// @flow + /** * @url https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/util/misc.ts#L26 */ -export type AnyJs = null | undefined | boolean | number | string | object; +//export type AnyJs = null | void | boolean | number | string | Object; +export type AnyJs = any; diff --git a/node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js.flow index 0c87d1d..fcf97f0 100644 --- a/node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js.flow +++ b/node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js.flow @@ -33,7 +33,7 @@ export const buildNativeMap = (data: Object): { [string]: NativeTypeMap } => { return nativeData; }; -export const buildNativeArray = (array: Object[]): NativeTypeMap[] => { +export const buildNativeArray = (array: any[]): NativeTypeMap[] => { const nativeArray = []; if (array) { array.forEach(value => { diff --git a/node_modules/react-native-firebase/dist/modules/functions/HttpsError.js.flow b/node_modules/react-native-firebase/dist/modules/functions/HttpsError.js.flow index e2c7ed3..2c00aa6 100644 --- a/node_modules/react-native-firebase/dist/modules/functions/HttpsError.js.flow +++ b/node_modules/react-native-firebase/dist/modules/functions/HttpsError.js.flow @@ -1,9 +1,11 @@ +// @flow + import type { FunctionsErrorCode } from './types.flow'; export default class HttpsError extends Error { +details: ?any; - +message: string; + message: string; +code: FunctionsErrorCode; @@ -11,6 +13,8 @@ export default class HttpsError extends Error { super(message); this.code = code; this.details = details; - this.message = message; + if (message) { + this.message = message; + } } } diff --git a/node_modules/react-native-firebase/dist/modules/functions/types.flow.js.flow b/node_modules/react-native-firebase/dist/modules/functions/types.flow.js.flow index 8660827..0ef93c8 100644 --- a/node_modules/react-native-firebase/dist/modules/functions/types.flow.js.flow +++ b/node_modules/react-native-firebase/dist/modules/functions/types.flow.js.flow @@ -1,3 +1,7 @@ +// @flow + +import HttpsError from './HttpsError'; + export type HttpsCallableResult = { data: Object, }; diff --git a/node_modules/react-native-firebase/dist/modules/messaging/IOSMessaging.js.flow b/node_modules/react-native-firebase/dist/modules/messaging/IOSMessaging.js.flow index a97bf75..305b5bc 100644 --- a/node_modules/react-native-firebase/dist/modules/messaging/IOSMessaging.js.flow +++ b/node_modules/react-native-firebase/dist/modules/messaging/IOSMessaging.js.flow @@ -1,3 +1,5 @@ +// @flow + import { getNativeModule } from '../../utils/native'; import { isIOS } from '../../utils'; @@ -5,18 +7,20 @@ import { isIOS } from '../../utils'; import type Messaging from './'; export default class IOSMessaging { + _messaging: Messaging; + constructor(messaging: Messaging) { this._messaging = messaging; } - getAPNSToken(): Promise { + getAPNSToken(): null | Promise { if (!isIOS) { return null; } return getNativeModule(this._messaging).getAPNSToken(); } - registerForRemoteNotifications(): Promise { + registerForRemoteNotifications(): void | Promise { if (!isIOS) { return undefined; } diff --git a/node_modules/react-native-firebase/dist/modules/messaging/RemoteMessage.js.flow b/node_modules/react-native-firebase/dist/modules/messaging/RemoteMessage.js.flow index d076e23..3388775 100644 --- a/node_modules/react-native-firebase/dist/modules/messaging/RemoteMessage.js.flow +++ b/node_modules/react-native-firebase/dist/modules/messaging/RemoteMessage.js.flow @@ -89,7 +89,7 @@ export default class RemoteMessage { * @param data * @returns {RemoteMessage} */ - setData(data: { [string]: string } = {}) { + setData(data: { [string]: string } = {}): RemoteMessage { if (!isObject(data)) { throw new Error( `RemoteMessage:setData expects an object but got type '${typeof data}'.` diff --git a/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow b/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow index 988be94..a030db8 100644 --- a/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow +++ b/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow @@ -8,7 +8,6 @@ import INTERNALS from '../../utils/internals'; import { getLogger } from '../../utils/log'; import ModuleBase from '../../utils/ModuleBase'; import { getNativeModule } from '../../utils/native'; -import { isFunction, isObject } from '../../utils'; import IOSMessaging from './IOSMessaging'; import RemoteMessage from './RemoteMessage'; @@ -89,10 +88,10 @@ export default class Messaging extends ModuleBase { onMessage(nextOrObserver: OnMessage | OnMessageObserver): () => any { let listener: RemoteMessage => any; - if (isFunction(nextOrObserver)) { + if (typeof nextOrObserver === "function") { // $FlowExpectedError: Not coping with the overloaded method signature listener = nextOrObserver; - } else if (isObject(nextOrObserver) && isFunction(nextOrObserver.next)) { + } else if (typeof nextOrObserver === "object" && typeof nextOrObserver.next === "function") { listener = nextOrObserver.next; } else { throw new Error( @@ -114,10 +113,10 @@ export default class Messaging extends ModuleBase { nextOrObserver: OnTokenRefresh | OnTokenRefreshObserver ): () => any { let listener: string => any; - if (isFunction(nextOrObserver)) { + if (typeof nextOrObserver === "function") { // $FlowExpectedError: Not coping with the overloaded method signature listener = nextOrObserver; - } else if (isObject(nextOrObserver) && isFunction(nextOrObserver.next)) { + } else if (typeof nextOrObserver === "object" && typeof nextOrObserver.next === "function") { listener = nextOrObserver.next; } else { throw new Error( diff --git a/node_modules/react-native-firebase/dist/modules/notifications/IOSNotifications.js.flow b/node_modules/react-native-firebase/dist/modules/notifications/IOSNotifications.js.flow index f2ea8ca..5058f52 100644 --- a/node_modules/react-native-firebase/dist/modules/notifications/IOSNotifications.js.flow +++ b/node_modules/react-native-firebase/dist/modules/notifications/IOSNotifications.js.flow @@ -1,3 +1,5 @@ +// @flow + import { getNativeModule } from '../../utils/native'; import type Notifications from './'; diff --git a/node_modules/react-native-firebase/dist/modules/notifications/index.js.flow b/node_modules/react-native-firebase/dist/modules/notifications/index.js.flow index 34e4ee3..22d5dbe 100644 --- a/node_modules/react-native-firebase/dist/modules/notifications/index.js.flow +++ b/node_modules/react-native-firebase/dist/modules/notifications/index.js.flow @@ -7,7 +7,6 @@ import { SharedEventEmitter } from '../../utils/events'; import { getLogger } from '../../utils/log'; import ModuleBase from '../../utils/ModuleBase'; import { getNativeModule } from '../../utils/native'; -import { isFunction, isObject } from '../../utils'; import AndroidAction from './AndroidAction'; import AndroidChannel from './AndroidChannel'; import AndroidChannelGroup from './AndroidChannelGroup'; @@ -212,9 +211,9 @@ export default class Notifications extends ModuleBase { nextOrObserver: OnNotification | OnNotificationObserver ): () => any { let listener; - if (isFunction(nextOrObserver)) { + if (typeof nextOrObserver === "function") { listener = nextOrObserver; - } else if (isObject(nextOrObserver) && isFunction(nextOrObserver.next)) { + } else if (typeof nextOrObserver === "object" && typeof nextOrObserver.next === "function") { listener = nextOrObserver.next; } else { throw new Error( @@ -235,9 +234,9 @@ export default class Notifications extends ModuleBase { nextOrObserver: OnNotification | OnNotificationObserver ): () => any { let listener; - if (isFunction(nextOrObserver)) { + if (typeof nextOrObserver === "function") { listener = nextOrObserver; - } else if (isObject(nextOrObserver) && isFunction(nextOrObserver.next)) { + } else if (typeof nextOrObserver === "object" && typeof nextOrObserver.next === "function") { listener = nextOrObserver.next; } else { throw new Error( @@ -258,9 +257,9 @@ export default class Notifications extends ModuleBase { nextOrObserver: OnNotificationOpened | OnNotificationOpenedObserver ): () => any { let listener; - if (isFunction(nextOrObserver)) { + if (typeof nextOrObserver === "function") { listener = nextOrObserver; - } else if (isObject(nextOrObserver) && isFunction(nextOrObserver.next)) { + } else if (typeof nextOrObserver === "object" && typeof nextOrObserver.next === "function") { listener = nextOrObserver.next; } else { throw new Error( diff --git a/node_modules/react-native-firebase/dist/modules/utils/database.js.flow b/node_modules/react-native-firebase/dist/modules/utils/database.js.flow index 12fda54..d25b305 100644 --- a/node_modules/react-native-firebase/dist/modules/utils/database.js.flow +++ b/node_modules/react-native-firebase/dist/modules/utils/database.js.flow @@ -1,3 +1,5 @@ +// @flow + import SyncTree from '../../utils/SyncTree'; export default { diff --git a/node_modules/react-native-firebase/dist/modules/utils/index.js.flow b/node_modules/react-native-firebase/dist/modules/utils/index.js.flow index 463de92..84f24cf 100644 --- a/node_modules/react-native-firebase/dist/modules/utils/index.js.flow +++ b/node_modules/react-native-firebase/dist/modules/utils/index.js.flow @@ -29,7 +29,7 @@ export default class RNFirebaseUtils extends ModuleBase { }); } - get database(): DatabaseUtils { + get database(): typeof DatabaseUtils { return DatabaseUtils; } diff --git a/node_modules/react-native-firebase/dist/utils/SyncTree.js.flow b/node_modules/react-native-firebase/dist/utils/SyncTree.js.flow index 58d0300..ca6edba 100644 --- a/node_modules/react-native-firebase/dist/utils/SyncTree.js.flow +++ b/node_modules/react-native-firebase/dist/utils/SyncTree.js.flow @@ -19,6 +19,7 @@ type Registration = { listener: Listener, eventRegistrationKey: string, ref: DatabaseReference, + ... }; /**