├── .gitbook └── assets │ ├── react-firebase-tutorial-auth-2-gif.gif │ ├── react-firebase-tutorial-auth-3-loading-gif.gif │ ├── react-firebase-tutorial-auth-4-error-handling-gif.gif │ ├── react-firebase-tutorial-fig (1).gif │ ├── react-firebase-tutorial-fig.gif │ ├── screen-shot-2018-08-20-at-2.04.01-pm.png │ ├── screen-shot-2018-08-20-at-2.22.20-pm.png │ ├── screen-shot-2018-08-20-at-4.45.59-pm.png │ └── screen-shot-2018-08-21-at-11.48.50-am.png ├── .gitignore ├── .opensource └── project.json ├── .vscode └── last.sql ├── README.md ├── modules ├── auth │ ├── .gitignore │ ├── README.md │ ├── __tests__ │ │ └── index.test.tsx │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── demo │ │ │ ├── app.tsx │ │ │ ├── index.html │ │ │ └── index.js │ │ ├── index.tsx │ │ ├── initialize-firebase-app.ts │ │ └── types.ts │ ├── tsconfig.json │ └── yarn.lock ├── database │ ├── .gitignore │ ├── README.md │ ├── __tests__ │ │ ├── FirebaseDatabaseMutation.test.tsx │ │ ├── FirebaseDatabaseNode.test.tsx │ │ ├── FirebaseDatabaseTranasaction.test.tsx │ │ └── reducers.test.ts │ ├── cypress.json │ ├── cypress │ │ ├── fixtures │ │ │ └── example.json │ │ ├── integration │ │ │ └── database.test.js │ │ ├── plugins │ │ │ └── index.js │ │ └── support │ │ │ ├── commands.js │ │ │ └── index.js │ ├── doczrc.js │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── Context.ts │ │ ├── components │ │ │ ├── FirebaseDatabaseMutation.tsx │ │ │ ├── FirebaseDatabaseNode.tsx │ │ │ ├── FirebaseDatabaseNodeLifeCycle.tsx │ │ │ ├── FirebaseDatabaseNodes.tsx │ │ │ ├── FirebaseDatabaseProvider.tsx │ │ │ └── FirebaseDatabaseTransaction.tsx │ │ ├── demo │ │ │ ├── app.tsx │ │ │ ├── index.html │ │ │ ├── index.tsx │ │ │ └── mui.min.css │ │ ├── docs │ │ │ ├── FirebaseDatabaseNode.mdx │ │ │ └── index.tsx │ │ ├── get-firebase-query.ts │ │ ├── index.tsx │ │ ├── initialize-firebase-app.ts │ │ ├── reducers.ts │ │ ├── test-cases │ │ │ ├── MutationExamplePush.tsx │ │ │ ├── MutationExampleUpdate.tsx │ │ │ ├── NodeExampleBasic.tsx │ │ │ └── TransactionExampleBasic.tsx │ │ ├── test-utils.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── tsconfig.json │ └── yarn.lock ├── firestore │ ├── .gitignore │ ├── README.md │ ├── __tests__ │ │ ├── components │ │ │ ├── FirestoreBatchedWrite.test.tsx │ │ │ ├── FirestoreCollection.test.tsx │ │ │ ├── FirestoreDocument.test.tsx │ │ │ └── FirestoreTransaction.test.tsx │ │ └── e2e │ │ │ └── App.test.tsx │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── Context.ts │ │ ├── components │ │ │ ├── FirestoreBatchedWrite.tsx │ │ │ ├── FirestoreCollection.tsx │ │ │ ├── FirestoreCollectionContextConsumerWithLifecycle.tsx │ │ │ ├── FirestoreDocument.tsx │ │ │ ├── FirestoreDocumentContextConsumerWithLifecycle.tsx │ │ │ ├── FirestoreMutation.tsx │ │ │ ├── FirestoreProvider.tsx │ │ │ └── FirestoreTransaction.tsx │ │ ├── demo │ │ │ ├── AddToCollection.tsx │ │ │ ├── App.tsx │ │ │ ├── BatchedWrite.tsx │ │ │ ├── DeleteDocument.tsx │ │ │ ├── RenderInfiniteList.tsx │ │ │ ├── SetDocument.tsx │ │ │ ├── UpdateDocument.tsx │ │ │ ├── firestore-schema.js │ │ │ ├── index.html │ │ │ ├── index.tsx │ │ │ └── test-credentials.ts │ │ ├── get-firestore-query.ts │ │ ├── index.tsx │ │ ├── initialize-firebase-app.ts │ │ ├── state-reducer.ts │ │ ├── test-utils.ts │ │ └── types.ts │ ├── tsconfig.json │ └── yarn.lock ├── generate-firebase-data │ ├── .gitignore │ ├── README.md │ ├── example-schemas │ │ └── schema-one.js │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── cli.ts │ │ ├── index.ts │ │ └── test.ts │ ├── tsconfig.json │ └── yarn.lock ├── generate-firestore-data │ ├── .gitignore │ ├── README.md │ ├── example-schemas │ │ └── schema-one.js │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── cli.ts │ │ ├── index.ts │ │ └── test.ts │ ├── tsconfig.json │ └── yarn.lock ├── generate-json │ ├── .gitignore │ ├── README.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── generate-data.test.ts.snap │ │ │ └── generate-json.test.ts.snap │ │ ├── generate-data.test.ts │ │ └── generate-json.test.ts │ ├── example-schemas-output │ │ ├── keys.json │ │ ├── tree.json │ │ └── values.json │ ├── example-schemas │ │ └── schema-one.js │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── cli.ts │ │ ├── index.ts │ │ └── utils.ts │ ├── tsconfig.json │ └── yarn.lock ├── hooks │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── index.tsx │ │ └── types.ts │ ├── tsconfig.json │ └── yarn.lock ├── react-firebase-docs │ ├── .gitignore │ ├── docs │ │ ├── README.md │ │ ├── SUMMARY.md │ │ ├── assets │ │ │ ├── data-shape-in-firebase.png │ │ │ ├── react-firebase-tutorial-auth-2-gif.gif │ │ │ ├── react-firebase-tutorial-auth-3-loading-gif.gif │ │ │ ├── react-firebase-tutorial-auth-4-error-handling-gif.gif │ │ │ ├── react-firebase-tutorial-dumb-ui-gif.gif │ │ │ ├── react-firebase-tutorial-fig.gif │ │ │ ├── react-firebase-tutorial-result-gif.gif │ │ │ ├── user-input-ui.png │ │ │ ├── wireframe-authed-2.png │ │ │ ├── wireframe-authed.png │ │ │ ├── wireframe-unauthed-2.png │ │ │ ├── wireframe-unauthed-breakdown.png │ │ │ └── wireframe-unauthed.png │ │ ├── generate-firebase-data.md │ │ ├── generate-firestore-data.md │ │ ├── generate-json-data.md │ │ ├── generate-json-data │ │ │ ├── README.md │ │ │ ├── setup.md │ │ │ └── usage.md │ │ ├── guides │ │ │ ├── README.md │ │ │ └── build-a-react-app-with-firebase-auth-and-realtime-database │ │ │ │ ├── README.md │ │ │ │ ├── add-firebase.md │ │ │ │ ├── add-google-and-anonymous-auth.md │ │ │ │ ├── add-react-and-react-dom.md │ │ │ │ ├── implementing-the-ui.md │ │ │ │ ├── listen-to-auth.md │ │ │ │ ├── read-data.md │ │ │ │ ├── setup-the-development-environment.md │ │ │ │ └── write-data.md │ │ ├── react-firebase-auth │ │ │ ├── api.md │ │ │ └── getting-started.md │ │ ├── react-firebase-realtime-database │ │ │ ├── api.md │ │ │ └── getting-started.md │ │ ├── react-firestore-database │ │ │ ├── api.md │ │ │ └── getting-started.md │ │ ├── try-it-out.md │ │ └── view-source.md │ ├── now.json │ ├── package.json │ └── website │ │ ├── blog │ │ └── 2018-08-23-introducing-react-firebase.md │ │ ├── core │ │ └── Footer.js │ │ ├── package.json │ │ ├── pages │ │ └── en │ │ │ ├── help.js │ │ │ ├── index.js │ │ │ └── users.js │ │ ├── sidebars.json │ │ ├── siteConfig.js │ │ └── static │ │ ├── css │ │ └── custom.css │ │ └── img │ │ ├── docusaurus.svg │ │ ├── favicon.png │ │ ├── favicon │ │ └── favicon.ico │ │ ├── logo.png │ │ ├── logo.svg │ │ └── oss_logo.png ├── sandboxes │ ├── firebase-auth │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firebase-database-flatlist-infinite-list │ │ ├── config.js │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.js │ │ └── yarn.lock │ ├── firebase-database-infinite-list │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firebase-database-mutation │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firebase-database-transaction │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firestore-add-to-collection │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firestore-batched-write │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firestore-collection-example │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firestore-infinite-list │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ ├── firestore-mutation-example │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock │ └── firestore-transaction │ │ ├── .gitignore │ │ ├── config.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ └── index.tsx │ │ ├── tsconfig.json │ │ └── yarn.lock └── tutorial-bookmarking-app │ ├── .gitignore │ ├── package.json │ ├── src │ ├── AutoComplete.tsx │ ├── index.html │ ├── index.tsx │ └── test-credentials.ts │ ├── tsconfig.json │ └── yarn.lock ├── package.json ├── react-firebase.code-workspace ├── react-native-examples ├── react-native-expo-firebase-example │ ├── .babelrc │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── App.test.js │ ├── README.md │ ├── app.json │ ├── package.json │ ├── test-credentials.js │ └── yarn.lock └── react-native-firebase-starter │ ├── .babelrc │ ├── .buckconfig │ ├── .editorconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .opensource │ └── project.json │ ├── .watchmanconfig │ ├── App.js │ ├── App.test.js │ ├── LICENSE │ ├── README.md │ ├── android │ ├── .editorconfig │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── reactfirebase │ │ │ │ └── reactfirebaseexample │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle │ ├── app.json │ ├── assets │ └── RNFirebase.png │ ├── bin │ └── rename.js │ ├── index.js │ ├── ios │ ├── GoogleService-Info.plist │ ├── Podfile │ ├── Podfile.lock │ ├── reactfirebaseexample-tvOS │ │ └── Info.plist │ ├── reactfirebaseexample-tvOSTests │ │ └── Info.plist │ ├── reactfirebaseexample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── reactfirebaseexample-tvOS.xcscheme │ │ │ └── reactfirebaseexample.xcscheme │ ├── reactfirebaseexample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── reactfirebaseexample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── reactfirebaseexampleTests │ │ ├── Info.plist │ │ └── reactfirebaseexampleTests.m │ ├── package-lock.json │ ├── package.json │ └── yarn.lock └── yarn.lock /.gitbook/assets/react-firebase-tutorial-auth-2-gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/react-firebase-tutorial-auth-2-gif.gif -------------------------------------------------------------------------------- /.gitbook/assets/react-firebase-tutorial-auth-3-loading-gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/react-firebase-tutorial-auth-3-loading-gif.gif -------------------------------------------------------------------------------- /.gitbook/assets/react-firebase-tutorial-auth-4-error-handling-gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/react-firebase-tutorial-auth-4-error-handling-gif.gif -------------------------------------------------------------------------------- /.gitbook/assets/react-firebase-tutorial-fig (1).gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/react-firebase-tutorial-fig (1).gif -------------------------------------------------------------------------------- /.gitbook/assets/react-firebase-tutorial-fig.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/react-firebase-tutorial-fig.gif -------------------------------------------------------------------------------- /.gitbook/assets/screen-shot-2018-08-20-at-2.04.01-pm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/screen-shot-2018-08-20-at-2.04.01-pm.png -------------------------------------------------------------------------------- /.gitbook/assets/screen-shot-2018-08-20-at-2.22.20-pm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/screen-shot-2018-08-20-at-2.22.20-pm.png -------------------------------------------------------------------------------- /.gitbook/assets/screen-shot-2018-08-20-at-4.45.59-pm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/screen-shot-2018-08-20-at-4.45.59-pm.png -------------------------------------------------------------------------------- /.gitbook/assets/screen-shot-2018-08-21-at-11.48.50-am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.gitbook/assets/screen-shot-2018-08-21-at-11.48.50-am.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .cache 3 | dist 4 | node_modules 5 | build/ 6 | coverage/ 7 | .rpt2_cache -------------------------------------------------------------------------------- /.opensource/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "React Firebase", 3 | "type": "library", 4 | "platforms": ["Web", "ReactNative"], 5 | "content": "README.md", 6 | "pages": { 7 | "modules/react-firebase-docs/docs/react-firebase-realtime-database/getting-started.md": "Getting Started with React Firebase Realtime Database", 8 | "modules/react-firebase-docs/docs/react-firebase-auth/getting-started.md": "Getting Started with React Firebase Auth", 9 | "modules/react-firebase-docs/docs/react-firebase-realtime-database/api.md": "React Firebase Realtime Database API", 10 | "modules/react-firebase-docs/docs/react-firebase-auth/api.md": "React Firebase Auth API", 11 | "modules/react-firebase-docs/docs/README.md": "Reference Docs" 12 | }, 13 | "related": [ 14 | "firebase/firebase-js-sdk", 15 | "firebase/firebase-admin-node", 16 | "invertase/react-native-firebase", 17 | "prescottprue/react-redux-firebase" 18 | ], 19 | "tabs": [ 20 | { 21 | "title": "Reference Docs", 22 | "href": "https://react-firebase-js.com" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.vscode/last.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/.vscode/last.sql -------------------------------------------------------------------------------- /modules/auth/.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | .rpt2_cache 3 | .vscode 4 | build 5 | coverage 6 | dist 7 | node_modules 8 | src/demo/test-credentials.js 9 | dist/ 10 | tmp-demo-dir/ 11 | src/demo/test-credentials.ts -------------------------------------------------------------------------------- /modules/auth/README.md: -------------------------------------------------------------------------------- 1 | # @react-firebase/auth 2 | 3 | ## [Getting Started](https://react-firebase-js.com/docs/react-firebase-auth/getting-started) 4 | 5 | ## [API](https://react-firebase-js.com/docs/react-firebase-auth/api) 6 | -------------------------------------------------------------------------------- /modules/auth/__tests__/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { 3 | render, 4 | fireEvent, 5 | cleanup, 6 | waitForElement 7 | } from "react-testing-library"; 8 | import { App } from "../src/demo/app"; 9 | 10 | test( 11 | "Sign In Anonymously", 12 | async () => { 13 | const { getByText, getByTestId } = render(); 14 | await waitForElement(() => getByTestId("signin-anon")); 15 | const signinButton = getByTestId("signin-anon"); 16 | fireEvent.click(signinButton); 17 | await waitForElement(() => getByText("You are authenticated"), { 18 | timeout: 10000 19 | }); 20 | cleanup(); 21 | }, 22 | 10000 23 | ); 24 | -------------------------------------------------------------------------------- /modules/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@react-firebase/auth", 3 | "description": "Easily integrate Firebase Authentication in your react(or react-native) app.", 4 | "version": "0.2.10", 5 | "main": "dist/index.cjs.js", 6 | "module": "dist/index.esm.js", 7 | "jsnext:main": "dist/index.esm.js", 8 | "umd": "dist/index.umd.js", 9 | "types": "dist/index.d.ts", 10 | "license": "GPL-3.0-only", 11 | "author": { 12 | "name": "rakannimer", 13 | "email": "rakannimer@gmail.com" 14 | }, 15 | "scripts": { 16 | "dev": "parcel src/demo/index.html -d tmp-demo-dir", 17 | "build": "rollup -c", 18 | "test": "tsc && jest", 19 | "prepublish": "npm run build", 20 | "pub": "yarn build && yarn publish --access public" 21 | }, 22 | "devDependencies": { 23 | "@types/jest": "^23.3.1", 24 | "@types/lodash.get": "^4.4.4", 25 | "@types/react": "^16.4.11", 26 | "docz": "^0.9.6", 27 | "firebase": "^5.4.0", 28 | "jest": "^23.5.0", 29 | "parcel-bundler": "^1.9.7", 30 | "prettier": "^1.14.2", 31 | "react": "^16.4.2", 32 | "react-dom": "^16.4.2", 33 | "react-testing-library": "^5.0.0", 34 | "rollup": "^0.64.1", 35 | "rollup-plugin-typescript2": "^0.16.1", 36 | "ts-jest": "^23.1.4", 37 | "typescript": "^3.0.1" 38 | }, 39 | "dependencies": { 40 | "lodash.get": "^4.4.2", 41 | "render-and-add-props": "^0.5.0" 42 | }, 43 | "peerDependencies": { 44 | "firebase": ">=4" 45 | }, 46 | "repository": { 47 | "url": "https://github.com/rakannimer/react-firebase" 48 | }, 49 | "files": [ 50 | "dist/" 51 | ], 52 | "jest": { 53 | "collectCoverageFrom": [ 54 | "src/*.tsx" 55 | ], 56 | "transform": { 57 | "^.+\\.tsx?$": "ts-jest" 58 | }, 59 | "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", 60 | "moduleFileExtensions": [ 61 | "ts", 62 | "tsx", 63 | "js", 64 | "jsx", 65 | "json", 66 | "node" 67 | ] 68 | }, 69 | "keywords": [ 70 | "react", 71 | "firebase", 72 | "auth", 73 | "react-firebase-auth", 74 | "firebase-auth" 75 | ] 76 | } 77 | -------------------------------------------------------------------------------- /modules/auth/rollup.config.js: -------------------------------------------------------------------------------- 1 | import typescript from "rollup-plugin-typescript2"; 2 | 3 | export default [ 4 | { 5 | input: "src/index.tsx", 6 | output: [ 7 | { 8 | file: "dist/index.umd.js", 9 | format: "umd", 10 | name: "ReactFirebaseAuth" 11 | }, 12 | { 13 | file: "dist/index.esm.js", 14 | format: "esm" 15 | }, 16 | { 17 | file: "dist/index.cjs.js", 18 | format: "cjs" 19 | } 20 | ], 21 | external: ["react", "render-and-add-props", "immer"], 22 | plugins: [ 23 | typescript({ 24 | typescript: require("typescript"), 25 | abortOnError: false 26 | }) 27 | ] 28 | } 29 | ]; 30 | -------------------------------------------------------------------------------- /modules/auth/src/demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /modules/database/src/demo/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import { App } from "./App"; 4 | 5 | render(, document.getElementById("root")); 6 | -------------------------------------------------------------------------------- /modules/database/src/docs/index.tsx: -------------------------------------------------------------------------------- 1 | // import * as React from "react"; 2 | // //@ts-ignore 3 | // import Component from "@reach/component-component"; 4 | // import * as firebase from "firebase/app"; 5 | // import "firebase/database"; 6 | 7 | // import { FirebaseDatabaseNode } from "../components/FirebaseDatabaseNode"; 8 | // import { FirebaseDatabaseProvider } from "../components/FirebaseDatabaseProvider"; 9 | // import { config } from "../demo/test-credentials"; 10 | // // import { config } from "../demo/test-credentials.ts"; 11 | 12 | // export const Demo = () => ( 13 | // 14 | // 15 | // {({ state, setState }) => ( 16 | // 17 | // 23 | // {d => { 24 | // return ( 25 | // 26 | //
Path {d.path}
27 | //
28 | //                     Value {JSON.stringify(d.value, null, 2)}
29 | //                   
30 | //
31 | // ); 32 | // }} 33 | //
34 | // 35 | // 42 | // 49 | // 50 | //
51 | // )} 52 | //
53 | //
54 | // ); 55 | -------------------------------------------------------------------------------- /modules/database/src/get-firebase-query.ts: -------------------------------------------------------------------------------- 1 | import { FirebaseQuery } from "./types"; 2 | 3 | export const getFirebaseQuery = ({ 4 | firebase = null, 5 | path, 6 | orderByChild = null, 7 | orderByKey = null, 8 | orderByValue = null, 9 | limitToFirst = null, 10 | limitToLast = null, 11 | startAt = null, 12 | endAt = null, 13 | equalTo = null 14 | }: FirebaseQuery) => { 15 | if (firebase === null) { 16 | throw new Error("Need to supply firebase argument to getFirebaseQuery"); 17 | } 18 | if (path === null || typeof path === "undefined") { 19 | throw new Error("Need to supply path argument to getFirebaseQuery"); 20 | } 21 | let result = firebase.database().ref(path); 22 | if (orderByChild !== null) { 23 | result = result.orderByChild(orderByChild); 24 | } 25 | if (orderByKey !== null) { 26 | result = result.orderByKey(); 27 | } 28 | if (orderByValue !== null) { 29 | result = result.orderByValue(); 30 | } 31 | if (limitToFirst !== null) { 32 | result = result.limitToFirst(limitToFirst); 33 | } 34 | if (limitToLast !== null) { 35 | result = result.limitToLast(limitToLast); 36 | } 37 | if (startAt !== null) { 38 | result = result.startAt(startAt); 39 | } 40 | if (endAt !== null) { 41 | result = result.endAt(endAt); 42 | } 43 | if (equalTo !== null) { 44 | result = result.equalTo(equalTo); 45 | } 46 | return result; 47 | }; 48 | -------------------------------------------------------------------------------- /modules/database/src/index.tsx: -------------------------------------------------------------------------------- 1 | export { FirebaseDatabaseNode } from "./components/FirebaseDatabaseNode"; 2 | export { FirebaseDatabaseNodes } from "./components/FirebaseDatabaseNodes"; 3 | export { 4 | FirebaseDatabaseProvider 5 | } from "./components/FirebaseDatabaseProvider"; 6 | 7 | export { 8 | FirebaseDatabaseMutation 9 | } from "./components/FirebaseDatabaseMutation"; 10 | export { 11 | FirebaseDatabaseTransaction 12 | } from "./components/FirebaseDatabaseTransaction"; 13 | 14 | export { getFirebaseQuery } from "./get-firebase-query"; 15 | export { initializeFirebaseApp } from "./initialize-firebase-app"; 16 | -------------------------------------------------------------------------------- /modules/database/src/initialize-firebase-app.ts: -------------------------------------------------------------------------------- 1 | import { InitializeAppArgs } from "./types"; 2 | export const initializeFirebaseApp = ({ 3 | firebase, 4 | authDomain, 5 | databaseURL, 6 | projectId, 7 | storageBucket, 8 | messagingSenderId, 9 | apiKey, 10 | appId, 11 | measurementId 12 | }: InitializeAppArgs) => { 13 | try { 14 | firebase.initializeApp({ 15 | apiKey, 16 | authDomain, 17 | databaseURL, 18 | projectId, 19 | storageBucket, 20 | messagingSenderId, 21 | appId, 22 | measurementId 23 | }); 24 | } catch (err) { 25 | if (err.code !== "app/duplicate-app") { 26 | throw err; 27 | } 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /modules/database/src/test-cases/MutationExamplePush.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as firebase from "firebase/app"; 3 | import "firebase/database"; 4 | import { State } from "react-powerplug"; 5 | import { FirebaseDatabaseProvider, FirebaseDatabaseMutation } from "../"; 6 | import { config } from "../demo/test-credentials"; 7 | 8 | import { IfNotFalsy } from "../test-utils"; 9 | 10 | export const MutationExamplePush = ({ 11 | path, 12 | value 13 | }: { 14 | path: string; 15 | value: any; 16 | }) => ( 17 | 18 | 19 | {({ state, setState }) => ( 20 | 21 | 22 | {({ runMutation }) => { 23 | return ( 24 | 35 | ); 36 | }} 37 | 38 | 39 | 40 |
{state.pushedKey}
41 |
42 |
43 | )} 44 |
45 |
46 | ); 47 | -------------------------------------------------------------------------------- /modules/database/src/test-cases/MutationExampleUpdate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as firebase from "firebase/app"; 3 | import "firebase/database"; 4 | import { State } from "react-powerplug"; 5 | import { FirebaseDatabaseProvider, FirebaseDatabaseMutation } from ".."; 6 | import { config } from "../demo/test-credentials"; 7 | 8 | import { IfNotFalsy, WithTestId, s } from "../test-utils"; 9 | 10 | export const MutationExampleUpdate = ({ 11 | path, 12 | value 13 | }: { 14 | path: string; 15 | value: any; 16 | }) => ( 17 | 18 | 19 | {({ state, setState }) => ( 20 | 21 | 22 | {({ runMutation }) => { 23 | return ( 24 | 25 | 34 | 35 | ); 36 | }} 37 | 38 | 39 | 40 | 41 |
{s(state.hasUpdated)}
42 |
43 |
44 |
45 | )} 46 |
47 |
48 | ); 49 | -------------------------------------------------------------------------------- /modules/database/src/test-cases/NodeExampleBasic.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import * as firebase from "firebase/app"; 4 | import "firebase/database"; 5 | import { FirebaseDatabaseProvider, FirebaseDatabaseNode } from "../"; 6 | import { config } from "../demo/test-credentials"; 7 | 8 | import { IfNotFalsy, s, WithTestId } from "../test-utils"; 9 | 10 | export const NodeExampleBasic = ({ 11 | path, 12 | ...otherStuffMaybe 13 | }: { 14 | path: string; 15 | [otherStuffMaybe: string]: any; 16 | }) => ( 17 | 18 | 19 | {value => { 20 | return ( 21 |
22 | 23 | 24 |
{s(value.value)}
25 |
26 |
27 | 28 | 29 |
{s(value.path)}
30 |
31 |
32 | 33 | 34 |
{s(value.isLoading)}
35 |
36 |
37 |
38 | ); 39 | }} 40 |
41 |
42 | ); 43 | -------------------------------------------------------------------------------- /modules/database/src/test-cases/TransactionExampleBasic.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as firebase from "firebase/app"; 3 | import "firebase/database"; 4 | import { State } from "react-powerplug"; 5 | import { FirebaseDatabaseProvider, FirebaseDatabaseTransaction } from "../"; 6 | import { config } from "../demo/test-credentials"; 7 | import { IfNotFalsy } from "../test-utils"; 8 | 9 | export const TransactionExample = ({ 10 | path, 11 | ...otherStuffMaybe 12 | }: { 13 | path: string; 14 | [otherStuffMaybe: string]: any; 15 | }) => { 16 | return ( 17 | 18 | 19 | {({ state, setState }) => { 20 | return ( 21 | 22 | 23 |
24 | {state.hasUpdated} 25 |
26 |
27 | 28 | {({ runTransaction }) => ( 29 |
30 | 49 |
50 | )} 51 |
52 |
53 | ); 54 | }} 55 |
56 |
57 | ); 58 | }; 59 | -------------------------------------------------------------------------------- /modules/database/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { FirebaseQuery } from "./types"; 2 | const firebaseQueryProperties = [ 3 | "path", 4 | "orderByChild", 5 | "orderByKey", 6 | "orderByValue", 7 | "limitToFirst", 8 | "limitToLast", 9 | "startAt", 10 | "endAt", 11 | "equalTo", 12 | "keysOnly" 13 | ] as Array; 14 | 15 | export const getInternalDataPath = (componentID: any, query: FirebaseQuery) => { 16 | return `${componentID}-${firebaseQueryProperties 17 | .map(prop => query[prop]) 18 | .join("_")}`; 19 | }; 20 | 21 | let id = 0; 22 | export const createID = () => { 23 | return id++; 24 | }; 25 | 26 | export const hasFirebaseQueryChanged = ( 27 | previousQuery: FirebaseQuery, 28 | currentQuery: FirebaseQuery 29 | ) => { 30 | for (let propName of firebaseQueryProperties) { 31 | if (previousQuery[propName] !== currentQuery[propName]) { 32 | return true; 33 | } 34 | } 35 | return false; 36 | }; 37 | -------------------------------------------------------------------------------- /modules/database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/"], 3 | "compilerOptions": { 4 | "jsx": "react", 5 | "target": "es5", 6 | "module": "ESNext", 7 | "moduleResolution": "node", 8 | "lib": ["es2018", "dom"], 9 | "outDir": "./build/", 10 | "strict": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "esModuleInterop": true, 14 | "allowSyntheticDefaultImports": true, 15 | "skipLibCheck": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/firestore/.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | .rpt2_cache 3 | .vscode 4 | dist 5 | build 6 | node_modules 7 | tmp-demo-dir 8 | src/demo/test-credentials.js 9 | coverage -------------------------------------------------------------------------------- /modules/firestore/README.md: -------------------------------------------------------------------------------- 1 | # @react-firebase/firestore 2 | 3 | ## [Getting Started](https://react-firebase-js.com/docs/react-firestore-database/getting-started) 4 | 5 | ## [API](https://react-firebase-js.com/docs/react-firestore-database/api) 6 | -------------------------------------------------------------------------------- /modules/firestore/__tests__/e2e/App.test.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | render, 4 | getNodeText, 5 | fireEvent, 6 | waitForElement 7 | } from "react-testing-library"; 8 | import * as firebase from "firebase/app"; 9 | import "firebase/firestore"; 10 | import { 11 | App, 12 | testDocPath, 13 | testDocValue, 14 | testDocUpdate 15 | } from "../../src/demo/App"; 16 | 17 | import { 18 | setValueAtPath, 19 | getValueAtPath, 20 | deleteValueAtPath 21 | } from "../../src/test-utils"; 22 | 23 | export const before = async () => { 24 | await deleteValueAtPath(testDocPath); 25 | const val = await getValueAtPath(testDocPath); 26 | expect(val).toEqual(undefined); 27 | await setValueAtPath(testDocPath, { c: "d" }); 28 | }; 29 | 30 | export const after = async (path = testDocPath) => { 31 | await deleteValueAtPath(testDocPath); 32 | }; 33 | 34 | test( 35 | "update-document", 36 | async () => { 37 | await before(); 38 | const { getByTestId } = render(); 39 | fireEvent.click(getByTestId("update-document")); 40 | await waitForElement(() => getByTestId("update-document-result"), { 41 | timeout: 10000 42 | }); 43 | const addedKeys = Object.keys( 44 | JSON.parse(getNodeText(getByTestId("update-document-result"))) 45 | ); 46 | // throw JSON.parse(getNodeText(getByTestId("update-document-result"))); 47 | Object.keys(testDocUpdate).forEach(testKey => { 48 | expect(addedKeys).toContain(testKey); 49 | }); 50 | await after(); 51 | }, 52 | 10000 53 | ); 54 | 55 | test( 56 | "set-document", 57 | async () => { 58 | // Initialize 59 | const { getByText, getByTestId } = render(); 60 | await deleteValueAtPath(testDocPath); 61 | const val = await getValueAtPath(testDocPath); 62 | expect(val).toEqual(undefined); 63 | 64 | // Set Document 65 | fireEvent.click(getByTestId("set-document")); 66 | await waitForElement(() => getByTestId("set-document-result"), { 67 | timeout: 10000 68 | }); 69 | const addedKeys = Object.keys( 70 | JSON.parse(getNodeText(getByTestId("set-document-result"))) 71 | ); 72 | Object.keys(testDocValue).forEach(testKey => { 73 | expect(addedKeys).toContain(testKey); 74 | }); 75 | }, 76 | 10000 77 | ); 78 | -------------------------------------------------------------------------------- /modules/firestore/rollup.config.js: -------------------------------------------------------------------------------- 1 | import typescript from "rollup-plugin-typescript2"; 2 | 3 | export default { 4 | input: "src/index.tsx", 5 | output: [ 6 | { 7 | file: "dist/index.umd.js", 8 | format: "umd", 9 | name: "ReactGoogleCharts" 10 | }, 11 | { 12 | file: "dist/index.esm.js", 13 | format: "esm" 14 | }, 15 | { 16 | file: "dist/index.cjs.js", 17 | format: "cjs" 18 | } 19 | ], 20 | external: [ 21 | "react", 22 | "lodash.get", 23 | "lodash.set", 24 | "firebase", 25 | "render-and-add-props", 26 | "immer" 27 | ], 28 | plugins: [ 29 | typescript({ 30 | typescript: require("typescript"), 31 | abortOnError: false, 32 | tsconfigOverride: { 33 | compilerOptions: { 34 | module: "ESNext" 35 | } 36 | } 37 | }) 38 | ] 39 | }; 40 | -------------------------------------------------------------------------------- /modules/firestore/src/Context.ts: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreProviderState } from "./types"; 3 | 4 | export const firestoreDefaultContext = { 5 | listenTo: (a: any) => {}, 6 | stopListeningTo: (path: string) => {}, 7 | dataTree: {}, 8 | firebase: {}, 9 | firestore: null as any 10 | } as FirestoreProviderState; 11 | 12 | export const { 13 | Provider: FirestoreContextProvider, 14 | Consumer: FirestoreContextConsumer 15 | } = React.createContext(firestoreDefaultContext); 16 | -------------------------------------------------------------------------------- /modules/firestore/src/components/FirestoreCollection.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { renderAndAddProps } from "render-and-add-props"; 3 | import get from "lodash/get"; 4 | import { FirestoreContextConsumer } from "../Context"; 5 | import { FirestoreQuery } from "../types"; 6 | import { FirestoreCollectionContextConsumerLifeCycle } from "./FirestoreCollectionContextConsumerWithLifecycle"; 7 | 8 | export class FirestoreCollection extends React.Component< 9 | FirestoreQuery & { 10 | children: ( 11 | { 12 | 13 | }: { 14 | path: string; 15 | value: any; 16 | ids: string[]; 17 | isLoading: boolean; 18 | } 19 | ) => React.ReactNode; 20 | } 21 | > { 22 | render() { 23 | const { children, path } = this.props; 24 | if (path === null) { 25 | console.warn("path not provided to FirestoreNode ! Not rendering."); 26 | return null; 27 | } 28 | return ( 29 | 30 | {context => { 31 | return ( 32 | 33 | 38 | {renderAndAddProps(children, { 39 | path, 40 | value: get(context, `dataTree[${path}].value`, null), 41 | ids: get(context, `dataTree[${path}].ids`, null), 42 | isLoading: get(context, `dataTree[${path}].isLoading`, true) 43 | })} 44 | 45 | ); 46 | }} 47 | 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/firestore/src/components/FirestoreCollectionContextConsumerWithLifecycle.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreContextConsumerWithLifeCycleProps } from "../types"; 3 | export class FirestoreCollectionContextConsumerLifeCycle extends React.Component< 4 | FirestoreContextConsumerWithLifeCycleProps 5 | > { 6 | listenToNode() { 7 | const { dataTree, path, listenTo } = this.props; 8 | if (path === null) { 9 | return; 10 | } 11 | listenTo(this.props, "collection"); 12 | } 13 | stopListeningToNode() { 14 | const { stopListeningTo, path, dataTree } = this.props; 15 | if (path === null || path in dataTree) { 16 | return; 17 | } 18 | stopListeningTo(path); 19 | } 20 | componentDidMount() { 21 | this.listenToNode(); 22 | } 23 | shouldComponentUpdate(nextProps: FirestoreContextConsumerWithLifeCycleProps) { 24 | const propsThatCanChange = [ 25 | "path", 26 | "limit", 27 | "startAfter", 28 | "startAt", 29 | "endAt", 30 | "endBefore", 31 | "where" 32 | ]; 33 | for (let propName of propsThatCanChange) { 34 | //@ts-ignore 35 | if (this.props[propName] !== nextProps[propName]) { 36 | return true; 37 | } 38 | } 39 | return false; 40 | } 41 | 42 | componentDidUpdate() { 43 | this.listenToNode(); 44 | } 45 | componentWillUnmount() { 46 | this.stopListeningToNode(); 47 | } 48 | render() { 49 | return null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /modules/firestore/src/components/FirestoreDocument.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { renderAndAddProps } from "render-and-add-props"; 3 | 4 | import { FirestoreContextConsumer } from "../Context"; 5 | import { FirestoreQuery } from "../types"; 6 | import { FirestoreDocumentContextConsumerLifeCycle } from "./FirestoreDocumentContextConsumerWithLifecycle"; 7 | 8 | export class FirestoreDocument extends React.Component< 9 | FirestoreQuery & { 10 | children: ( 11 | { 12 | 13 | }: { 14 | path: string; 15 | value: any; 16 | isLoading: boolean; 17 | } 18 | ) => React.ReactNode; 19 | } 20 | > { 21 | render() { 22 | const { children, path } = this.props; 23 | if (path === null) { 24 | console.warn("path not provided to FirestoreNode ! Not rendering."); 25 | return null; 26 | } 27 | return ( 28 | 29 | {context => { 30 | return ( 31 | 32 | 37 | {renderAndAddProps(children, { 38 | path, 39 | value: context.dataTree[path] && context.dataTree[path].value, 40 | isLoading: 41 | context.dataTree[path] && context.dataTree[path].isLoading 42 | })} 43 | 44 | ); 45 | }} 46 | 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /modules/firestore/src/components/FirestoreDocumentContextConsumerWithLifecycle.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { FirestoreContextConsumerWithLifeCycleProps } from "../types"; 4 | 5 | export class FirestoreDocumentContextConsumerLifeCycle extends React.Component< 6 | FirestoreContextConsumerWithLifeCycleProps 7 | > { 8 | listenToNodeIfNotInContext() { 9 | const { dataTree, path, listenTo } = this.props; 10 | if (path === null || path in dataTree) { 11 | return; 12 | } 13 | listenTo(this.props, "document"); 14 | } 15 | stopListeningToNode() { 16 | const { stopListeningTo, path, dataTree } = this.props; 17 | if (path === null || path in dataTree) { 18 | return; 19 | } 20 | stopListeningTo(path); 21 | } 22 | componentDidMount() { 23 | this.listenToNodeIfNotInContext(); 24 | } 25 | componentDidUpdate() { 26 | this.listenToNodeIfNotInContext(); 27 | } 28 | componentWillUnmount() { 29 | this.stopListeningToNode(); 30 | } 31 | render() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import * as firebase from "firebase/app"; 3 | import "firebase/firestore"; 4 | import { config } from "./test-credentials"; 5 | import { FirestoreProvider } from "../"; 6 | import { RenderInfiniteList } from "./RenderInfiniteList"; 7 | import { SetDocument } from "./SetDocument"; 8 | import { UpdateDocument } from "./UpdateDocument"; 9 | import { DeleteDocument } from "./DeleteDocument"; 10 | import { AddToCollection } from "./AddToCollection"; 11 | import { BatchedWrite } from "./BatchedWrite"; 12 | 13 | export const testCollectionPath = "user_bookmarks"; 14 | export const testDocPath = `${testCollectionPath}/TEST_USER_ID`; 15 | export const testDocValue = { 16 | nowOnCli: Date.now(), 17 | nowOnServer: firebase.firestore.FieldValue.serverTimestamp(), 18 | some: "data" 19 | }; 20 | export const testDocUpdate = { 21 | someOther: "data" 22 | }; 23 | 24 | export const s = (v: any) => JSON.stringify(v, null, 2); 25 | 26 | export const App = () => { 27 | return ( 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 |
37 |
38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/BatchedWrite.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreBatchedWrite } from "../"; 3 | import { testDocPath } from "./App"; 4 | export const BatchedWrite = () => { 5 | return ( 6 | 7 | 8 | {({ addMutationToBatch, commit }) => { 9 | // console.log() 10 | return ( 11 |
12 |

Batched write

13 | 25 | 35 |
36 | ); 37 | }} 38 |
39 |
40 | ); 41 | }; 42 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/DeleteDocument.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreDocument, FirestoreMutation } from "../"; 3 | import { testDocPath, testDocUpdate, s } from "./App"; 4 | export const DeleteDocument = () => ( 5 |
6 | 7 | {({ runMutation }) => ( 8 | <> 9 | 17 | 18 | {d => 19 | d.value ? ( 20 |
{s(d.value)}
21 | ) : null 22 | } 23 |
24 | 25 | )} 26 |
27 |
28 | ); 29 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/RenderInfiniteList.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { State } from "react-powerplug"; 3 | import { FirestoreCollection } from "../components/FirestoreCollection"; 4 | import { testCollectionPath, s } from "./App"; 5 | export const RenderInfiniteList = () => ( 6 |
7 | 8 | {({ state, setState }) => ( 9 | 14 | {({ value, ids }) => { 15 | return ( 16 |
17 |
{s({ value, ids })}
18 | 29 |
30 | ); 31 | }} 32 |
33 | )} 34 |
35 |
36 | ); 37 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/SetDocument.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreDocument, FirestoreMutation } from "../"; 3 | import { testDocPath, testDocValue, s } from "./App"; 4 | export const SetDocument = () => ( 5 |
6 | 7 | {({ runMutation }) => { 8 | return ( 9 | 17 | ); 18 | }} 19 | 20 | 21 |
22 | 23 | {d => 24 | d.value ? ( 25 |
{s(d.value)}
26 | ) : null 27 | } 28 |
29 |
30 |
31 | ); 32 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/UpdateDocument.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { FirestoreDocument, FirestoreMutation } from "../"; 3 | import { testDocPath, testDocUpdate, s } from "./App"; 4 | export const UpdateDocument = () => ( 5 |
6 | 7 | {({ runMutation }) => ( 8 | 16 | )} 17 | 18 |
19 | 20 | {d => 21 | d.value && d.value.someOther ? ( 22 |
{s(d.value)}
23 | ) : null 24 | } 25 |
26 |
27 |
28 | ); 29 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/firestore-schema.js: -------------------------------------------------------------------------------- 1 | // For use with generate-firestore-data 2 | const keyReducers = {}; 3 | 4 | const schema = { 5 | // "{env}": { 6 | user_conversations: { 7 | "{conversationID}": { 8 | user_id: "{userID}", 9 | peer_id: "{peerID}", 10 | conversation_id: "{conversationID}", 11 | created_at: "timestamp", 12 | updated_at: "timestamp", 13 | unread_message_count: "number" 14 | } 15 | }, 16 | messages: { 17 | "{messageID}": { 18 | conversation_id: "{conversationID}", 19 | sender_id: "{userID}", 20 | recipient_id: "{peerID}", 21 | created_at: "timestamp", 22 | updated_at: "timestamp" 23 | } 24 | } 25 | }; 26 | 27 | const count = 20; 28 | module.exports = { 29 | schema, 30 | keyReducers, 31 | count 32 | }; 33 | -------------------------------------------------------------------------------- /modules/firestore/src/demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase-auth-example", 3 | "version": "0.1.0", 4 | "description": "Firebase Auth Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/auth": "^0.1.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-auth/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import * as firebase from "firebase/app"; 4 | import "firebase/auth"; 5 | import { 6 | FirebaseAuthProvider, 7 | FirebaseAuthConsumer, 8 | IfFirebaseAuthed, 9 | IfFirebaseAuthedAnd 10 | } from "@react-firebase/auth"; 11 | import { config } from "../config"; 12 | 13 | export const App = () => { 14 | return ( 15 | 16 |
17 | 25 | 33 | 40 | 41 | {({ isSignedIn, user, providerId }) => { 42 | return ( 43 |
44 |                 {JSON.stringify({ isSignedIn, user, providerId }, null, 2)}
45 |               
46 | ); 47 | }} 48 |
49 |
50 | 51 | {() => { 52 | return
You are authenticated
; 53 | }} 54 |
55 | providerId !== "anonymous"} 57 | > 58 | {({ providerId }) => { 59 | return
You are authenticated with {providerId}
; 60 | }} 61 |
62 |
63 |
64 |
65 | ); 66 | }; 67 | render(, document.getElementById("root")); 68 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-auth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-flatlist-infinite-list/config.js: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-flatlist-infinite-list/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Parcel Sandbox 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-flatlist-infinite-list/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parcel-sandbox", 3 | "version": "1.0.0", 4 | "description": "Simple Parcel Sandbox", 5 | "main": "index.html", 6 | "scripts": { 7 | "start": "parcel index.html --open", 8 | "build": "parcel build index.html" 9 | }, 10 | "dependencies": { 11 | "@reach/component-component": "0.1.0", 12 | "@react-firebase/database": "0.2.15", 13 | "firebase": "5.4.1", 14 | "react": "latest", 15 | "react-art": "16.4.2", 16 | "react-dom": "16.4.2", 17 | "react-native-web": "0.8.9" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.6.1" 21 | } 22 | } -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-flatlist-infinite-list/src/index.js: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import { View, Text, FlatList } from "react-native-web"; 4 | import * as firebase from "firebase/app"; 5 | import "firebase/database"; 6 | import { 7 | FirebaseDatabaseProvider, 8 | FirebaseDatabaseNode 9 | } from "@react-firebase/database"; 10 | import Component from "@reach/component-component"; 11 | import { config } from "../config"; 12 | 13 | const s = v => JSON.stringify(v, null, 2); 14 | 15 | const App = () => { 16 | return ( 17 | 18 | 19 | 20 | {component => ( 21 | 25 | {({ value }) => { 26 | if (value === null || typeof value === "undefined") return null; 27 | const keys = Object.keys(value); 28 | const values = Object.values(value); 29 | return ( 30 | keys[i]} 34 | renderItem={v => ( 35 | 36 | {s(v)} 37 | 38 | )} 39 | onEndReached={() => { 40 | component.setState({ limit: component.state.limit + 1 }); 41 | }} 42 | /> 43 | ); 44 | }} 45 | 46 | )} 47 | 48 | 49 | Oh hai 50 | 51 | 52 | 53 | ); 54 | }; 55 | render(, document.getElementById("app")); 56 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase-database-infinite-list-example", 3 | "version": "0.1.0", 4 | "description": "Firebase Database Infinite List Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/database": "^0.2.13", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/database"; 5 | import { 6 | FirebaseDatabaseProvider, 7 | FirebaseDatabaseNode 8 | } from "@react-firebase/database"; 9 | import { config } from "../config"; 10 | 11 | const styles = { 12 | fontFamily: "sans-serif" 13 | }; 14 | 15 | const s = (a: any) => JSON.stringify(a, null, 2); 16 | 17 | export type AppState = { 18 | limit: number; 19 | }; 20 | 21 | class App extends React.Component { 22 | state = { 23 | limit: 2 24 | }; 25 | render() { 26 | return ( 27 |
28 | 29 | 35 | {d => { 36 | return ( 37 | 38 |
Path {d.path}
39 |
40 |                     Value {s(d.value)}
41 |                   
42 | 49 |
50 | ); 51 | }} 52 |
53 |
54 |
55 | ); 56 | } 57 | } 58 | 59 | render(, document.getElementById("root")); 60 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-infinite-list/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-mutation/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-mutation/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-mutation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-mutation/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase-database-mutation-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Database Mutation Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/database": "^0.2.13", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-mutation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase-database-transaction-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Database Transaction Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/database": "^0.2.13", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/database"; 5 | import { 6 | FirebaseDatabaseProvider, 7 | FirebaseDatabaseNode, 8 | FirebaseDatabaseTransaction 9 | } from "@react-firebase/database"; 10 | import { config } from "../config"; 11 | 12 | const styles = { 13 | fontFamily: "sans-serif" 14 | }; 15 | 16 | const s = (a: any) => JSON.stringify(a, null, 2); 17 | 18 | const path = "user_bookmarks/a/usage_count"; 19 | 20 | const App = () => ( 21 |
22 | 23 | 24 | {({ runTransaction }) => { 25 | return ( 26 |
27 | 44 |
45 | ); 46 | }} 47 |
48 | 49 | 50 | {d => { 51 | return ( 52 |
53 | {d.value && ( 54 |
Value : {s(d.value)}
55 | )} 56 | {d.path &&
Path : {d.path}
} 57 |
58 |                 isLoading : {s(d.isLoading)}
59 |               
60 |
61 | ); 62 | }} 63 |
64 |
65 |
66 | ); 67 | 68 | render(, document.getElementById("root")); 69 | -------------------------------------------------------------------------------- /modules/sandboxes/firebase-database-transaction/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-add-to-collection/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-add-to-collection/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-add-to-collection/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-add-to-collection/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-mutation-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Collection Add Document Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.2.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-add-to-collection/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-batched-write-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Batch Write Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.3.0", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/firestore"; 5 | import { 6 | FirestoreProvider, 7 | FirestoreDocument, 8 | FirestoreBatchedWrite 9 | } from "@react-firebase/firestore"; 10 | import { config } from "../config"; 11 | 12 | const styles = { 13 | fontFamily: "sans-serif" 14 | }; 15 | 16 | const s = (a: any) => JSON.stringify(a, null, 2); 17 | 18 | const path = "user_bookmarks/test"; 19 | 20 | const App = () => ( 21 |
22 | 23 | 24 | {({ addMutationToBatch, commit }) => { 25 | return ( 26 |
27 |

Batched write

28 | 40 | 50 |
51 | ); 52 | }} 53 |
54 | 55 | {value => { 56 | return ( 57 |
58 | {
{s(value)}
} 59 | {value.path &&
{value.path}
} 60 |
{value.isLoading}
61 |
62 | ); 63 | }} 64 |
65 |
66 |
67 | ); 68 | 69 | render(, document.getElementById("root")); 70 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-batched-write/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/"], 3 | "compilerOptions": { 4 | "jsx": "react", 5 | "target": "es5", 6 | "module": "ESNext", 7 | "moduleResolution": "node", 8 | "lib": ["es2018", "dom"], 9 | "outDir": "./build/", 10 | "strict": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "allowSyntheticDefaultImports": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Document or Collection Mutation Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html --open" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.2.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | 4 | import firebase from "firebase/app"; 5 | import "firebase/firestore"; 6 | import { 7 | FirestoreProvider, 8 | FirestoreCollection 9 | } from "@react-firebase/firestore"; 10 | import { config } from "../config"; 11 | 12 | const styles = { 13 | fontFamily: "sans-serif" 14 | }; 15 | 16 | const s = (a: any) => JSON.stringify(a, null, 2); 17 | 18 | const App = () => { 19 | return ( 20 |
21 | 22 |
23 | 24 | {d => { 25 | return
{s(d)}
; 26 | }} 27 |
28 |
29 |
30 |
31 | ); 32 | }; 33 | 34 | render(, document.getElementById("root")); 35 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-collection-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-infinite-list", 3 | "version": "0.1.0", 4 | "description": "Firestore Infinite List Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.2.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/firestore"; 5 | import { 6 | FirestoreCollection, 7 | FirestoreProvider 8 | } from "@react-firebase/firestore"; 9 | import { config } from "../config"; 10 | const s = (a: any) => JSON.stringify(a, null, 2); 11 | 12 | export type InfiniteListState = { 13 | page: number; 14 | pageLength: number; 15 | }; 16 | 17 | export class InfiniteList extends React.Component { 18 | state = { 19 | page: 0, 20 | pageLength: 1 21 | }; 22 | render() { 23 | return ( 24 | 25 |
26 | 31 | {({ value }) => { 32 | return ( 33 |
34 |
{s(value)}
35 |
36 | ); 37 | }} 38 |
39 |
40 | 50 |
51 | ); 52 | } 53 | } 54 | 55 | const App = InfiniteList; 56 | 57 | render(, document.getElementById("root")); 58 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-infinite-list/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-mutation-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Document or Collection Mutation Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.2.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/firestore"; 5 | import { 6 | FirestoreProvider, 7 | FirestoreDocument, 8 | FirestoreMutation 9 | } from "@react-firebase/firestore"; 10 | import { config } from "../config"; 11 | 12 | const styles = { 13 | fontFamily: "sans-serif" 14 | }; 15 | 16 | const s = (a: any) => JSON.stringify(a, null, 2); 17 | 18 | const path = "user_bookmarks/test"; 19 | 20 | const App = () => ( 21 |
22 | 23 | 24 | {({ runMutation }) => { 25 | return ( 26 |
27 |

Mutate state

28 | 40 |
41 | ); 42 | }} 43 |
44 | 45 | {value => { 46 | return ( 47 |
48 | {value.value &&
{s(value.value)}
} 49 | {value.path &&
{value.path}
} 50 |
{value.isLoading}
51 |
52 | ); 53 | }} 54 |
55 |
56 |
57 | ); 58 | 59 | render(, document.getElementById("root")); 60 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-mutation-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/"], 3 | "compilerOptions": { 4 | "jsx": "react", 5 | "target": "es5", 6 | "module": "ESNext", 7 | "moduleResolution": "node", 8 | "lib": ["es2018", "dom"], 9 | "outDir": "./build/", 10 | "strict": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "allowSyntheticDefaultImports": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .cache 4 | build -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | // DO NOT USE THESE CREDENTIALS ! THEY ARE HERE TO HELP IN THE LEARNING PROCESS. 3 | // ANY AND ALL DATA ON THAT DOMAIN IS SUBJECT TO CHANGE AND REMOVAL AT ANY TIME 4 | // THIS ACCOUNT IS ALSO ON THE FREE PLAN AND IS SUBJECT TO RESTRICTIONS ! 5 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 6 | authDomain: "react-firebase-baecd.firebaseapp.com", 7 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 8 | projectId: "react-firebase-baecd", 9 | storageBucket: "react-firebase-baecd.appspot.com", 10 | messagingSenderId: "6611069556" 11 | }; 12 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page Title 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-tranasction-example", 3 | "version": "0.1.0", 4 | "description": "Firestore Batch Write Example", 5 | "main": "index.html", 6 | "repository": "https://github.com/rakannimer/react-firebase/", 7 | "author": "rakannimer", 8 | "license": "GPL-3.0", 9 | "private": false, 10 | "scripts": { 11 | "start": "parcel index.html" 12 | }, 13 | "dependencies": { 14 | "@react-firebase/firestore": "^0.2.9", 15 | "firebase": "^5.4.1", 16 | "react": "^16.4.2", 17 | "react-dom": "^16.4.2" 18 | }, 19 | "devDependencies": { 20 | "parcel-bundler": "^1.9.7", 21 | "prettier": "^1.14.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | import firebase from "firebase/app"; 4 | import "firebase/firestore"; 5 | import { 6 | FirestoreProvider, 7 | FirestoreDocument, 8 | FirestoreTransaction 9 | } from "@react-firebase/firestore"; 10 | import { config } from "../config"; 11 | 12 | const styles = { 13 | fontFamily: "sans-serif" 14 | }; 15 | 16 | const s = (a: any) => JSON.stringify(a, null, 2); 17 | 18 | const path = "user_bookmarks/test"; 19 | 20 | const App = () => ( 21 |
22 | 23 | 24 | {({ runTransaction }) => { 25 | return ( 26 |
27 | 45 |
46 | ); 47 | }} 48 |
49 | 50 | {d => { 51 | return ( 52 |
53 | {d.value && 54 | d.value.a && ( 55 |
56 | {JSON.stringify(d.value.a)} 57 |
58 | )} 59 | {d.path &&
{d.path}
} 60 |
{d.isLoading}
61 |
62 | ); 63 | }} 64 |
65 |
66 |
67 | ); 68 | 69 | render(, document.getElementById("root")); 70 | -------------------------------------------------------------------------------- /modules/sandboxes/firestore-transaction/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "lib": ["es2018", "dom"], 8 | "outDir": "./build/", 9 | "strict": true, 10 | "declaration": true, 11 | "removeComments": true, 12 | "allowSyntheticDefaultImports": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /modules/tutorial-bookmarking-app/.gitignore: -------------------------------------------------------------------------------- 1 | # parcel cache 2 | .cache 3 | .vscode 4 | 5 | dist 6 | node_modules -------------------------------------------------------------------------------- /modules/tutorial-bookmarking-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tutorial-bookmarking-app", 3 | "version": "1.0.0", 4 | "main": "src/index.html", 5 | "license": "MIT", 6 | "devDependencies": { 7 | "@types/lodash.get": "^4.4.4", 8 | "@types/lodash.set": "^4.3.4", 9 | "@types/match-sorter": "^2.2.0", 10 | "@types/react": "^16.4.11", 11 | "@types/react-dom": "^16.0.7", 12 | "parcel-bundler": "^1.9.7", 13 | "prettier": "^1.14.2", 14 | "typescript": "^3.0.1" 15 | }, 16 | "scripts": { 17 | "dev": "parcel src/index.html" 18 | }, 19 | "dependencies": { 20 | "@material-ui/core": "^1.5.1", 21 | "@material-ui/icons": "^2.0.3", 22 | "@react-firebase/auth": "^0.1.8", 23 | "@react-firebase/database": "0.2.7", 24 | "downshift": "^2.1.5", 25 | "firebase": "^5.4.0", 26 | "lodash.get": "^4.4.2", 27 | "lodash.set": "^4.3.2", 28 | "match-sorter": "^2.2.3", 29 | "react": "^16.4.2", 30 | "react-dom": "^16.4.2", 31 | "react-powerplug": "^1.0.0-rc.1" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /modules/tutorial-bookmarking-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /modules/tutorial-bookmarking-app/src/test-credentials.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 3 | authDomain: "react-firebase-baecd.firebaseapp.com", 4 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 5 | projectId: "react-firebase-baecd", 6 | storageBucket: "react-firebase-baecd.appspot.com", 7 | messagingSenderId: "6611069556" 8 | }; 9 | -------------------------------------------------------------------------------- /modules/tutorial-bookmarking-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es5", 5 | "module": "commonjs", 6 | "lib": ["dom", "es2017"], 7 | 8 | "strict": true, 9 | "esModuleInterop": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-firebase", 4 | "workspaces": [ 5 | "modules/*" 6 | ], 7 | "scripts": { 8 | "test:auth": "cd modules/auth && yarn test", 9 | "test:database": "cd modules/database && yarn test", 10 | "test:firestore": "cd modules/firestore && yarn test", 11 | "test": "yarn test:auth && yarn test:database && yarn test:firestore" 12 | }, 13 | "repository": { 14 | "url": "https://github.com/rakannimer/react-firebase" 15 | }, 16 | "devDependencies": {} 17 | } 18 | -------------------------------------------------------------------------------- /react-firebase.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "modules/sandboxes" 5 | }, 6 | { 7 | "path": "modules/database" 8 | }, 9 | { 10 | "path": "modules/react-firebase-docs" 11 | }, 12 | { 13 | "path": "modules/firestore" 14 | }, 15 | { 16 | "path": "modules/auth" 17 | }, 18 | { 19 | "path": "modules/hooks" 20 | }, 21 | { 22 | "path": "modules/generate-json" 23 | }, 24 | { 25 | "path": "modules/generate-firestore-data" 26 | }, 27 | { 28 | "path": "modules/generate-firebase-data" 29 | }, 30 | { 31 | "path": "modules/tutorial-bookmarking-app" 32 | }, 33 | { 34 | "path": "react-native-examples/react-native-firebase-starter/" 35 | }, 36 | { 37 | "path": "react-native-examples/react-native-expo-firebase-example/" 38 | }, 39 | { 40 | "path": "./" 41 | } 42 | ], 43 | "settings": {} 44 | } 45 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["babel-preset-expo"], 3 | "env": { 4 | "development": { 5 | "plugins": ["transform-react-jsx-source"] 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # expo 4 | .expo/ 5 | 6 | # dependencies 7 | /node_modules 8 | 9 | # misc 10 | .env.local 11 | .env.development.local 12 | .env.test.local 13 | .env.production.local 14 | 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import App from './App'; 3 | 4 | import renderer from 'react-test-renderer'; 5 | 6 | it('renders without crashing', () => { 7 | const rendered = renderer.create().toJSON(); 8 | expect(rendered).toBeTruthy(); 9 | }); 10 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "sdkVersion": "27.0.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-expo-firebase-example", 3 | "version": "0.1.0", 4 | "private": true, 5 | "devDependencies": { 6 | "jest-expo": "~27.0.0", 7 | "prettier": "^1.14.2", 8 | "react-native-scripts": "1.14.0", 9 | "react-test-renderer": "16.3.1" 10 | }, 11 | "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", 12 | "scripts": { 13 | "start": "react-native-scripts start", 14 | "eject": "react-native-scripts eject", 15 | "android": "react-native-scripts android", 16 | "ios": "react-native-scripts ios", 17 | "test": "jest" 18 | }, 19 | "jest": { 20 | "preset": "jest-expo" 21 | }, 22 | "dependencies": { 23 | "@react-firebase/auth": "^0.2.2", 24 | "@react-firebase/database": "^0.2.13", 25 | "expo": "^27.0.1", 26 | "firebase": "^5.4.1", 27 | "react": "16.3.1", 28 | "react-native": "~0.55.2" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /react-native-examples/react-native-expo-firebase-example/test-credentials.js: -------------------------------------------------------------------------------- 1 | export const config = { 2 | apiKey: "AIzaSyBIEgdW0FGGxQZ7bbbqIhzmiVAk7nnJB14", 3 | authDomain: "react-firebase-baecd.firebaseapp.com", 4 | databaseURL: "https://react-firebase-baecd.firebaseio.com", 5 | projectId: "react-firebase-baecd", 6 | storageBucket: "react-firebase-baecd.appspot.com", 7 | messagingSenderId: "6611069556" 8 | }; 9 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "babel-preset-react-native-stage-0/decorator-support" 4 | ], 5 | "env": { 6 | "development": { 7 | "plugins": [ 8 | "transform-react-jsx-source" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | module.system=haste 33 | 34 | munge_underscores=true 35 | 36 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 37 | 38 | module.file_ext=.js 39 | module.file_ext=.jsx 40 | module.file_ext=.json 41 | module.file_ext=.native.js 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 52 | 53 | [version] 54 | ^0.67.0 55 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # RNFirebase specific 59 | # 60 | .expo/ 61 | /ios/Pods/ 62 | # google-services.json 63 | # GoogleService-Info.plist 64 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.opensource/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "React Native Firebase Starter", 3 | "type": "sample", 4 | "platforms": ["Android", "iOS"], 5 | "content": "README.md", 6 | "related": ["invertase/react-native-firebase"] 7 | } 8 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import App from './App'; 3 | 4 | import renderer from 'react-test-renderer'; 5 | 6 | it('renders without crashing', () => { 7 | const rendered = renderer.create().toJSON(); 8 | expect(rendered).toBeTruthy(); 9 | }); 10 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Invertase Limited 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this library except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.reactfirebase.reactfirebaseexample", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.reactfirebase.reactfirebaseexample", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/java/com/reactfirebase/reactfirebaseexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactfirebase.reactfirebaseexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "reactfirebaseexample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | reactfirebaseexample 3 | 4 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | 6 | jcenter() 7 | google() 8 | maven { 9 | url 'https://maven.fabric.io/public' 10 | } 11 | } 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:3.1.3' 14 | classpath 'com.google.gms:google-services:4.0.1' 15 | classpath 'com.google.firebase:firebase-plugins:1.1.1' 16 | classpath 'io.fabric.tools:gradle:1.25.4' 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | jcenter() 26 | google() 27 | maven { 28 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 29 | url "$rootDir/../node_modules/react-native/android" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | org.gradle.daemon=true 21 | org.gradle.parallel=true 22 | android.useDeprecatedNdk=true 23 | org.gradle.configureondemand=true 24 | org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 25 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 6 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'reactfirebaseexample' 2 | include ':react-native-firebase' 3 | project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactfirebaseexample", 3 | "displayName": "reactfirebaseexample" 4 | } -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/assets/RNFirebase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rakannimer/react-firebase/ed3db6aba5563c78163b84c94da806a9c9d18dde/react-native-examples/react-native-firebase-starter/assets/RNFirebase.png -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './App'; 3 | AppRegistry.registerComponent('reactfirebaseexample', () => App); 4 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AD_UNIT_ID_FOR_BANNER_TEST 6 | ca-app-pub-3940256099942544/2934735716 7 | AD_UNIT_ID_FOR_INTERSTITIAL_TEST 8 | ca-app-pub-3940256099942544/4411468910 9 | CLIENT_ID 10 | 6611069556-qsehbjoki9l6l31sk7e4kglkfjvjofub.apps.googleusercontent.com 11 | REVERSED_CLIENT_ID 12 | com.googleusercontent.apps.6611069556-qsehbjoki9l6l31sk7e4kglkfjvjofub 13 | API_KEY 14 | AIzaSyDM2ghD0mW8u6uWn6m3Zp6yq7-F7z5_6oE 15 | GCM_SENDER_ID 16 | 6611069556 17 | PLIST_VERSION 18 | 1 19 | BUNDLE_ID 20 | com.reactfirebase.reactfirebaseexample 21 | PROJECT_ID 22 | react-firebase-baecd 23 | STORAGE_BUCKET 24 | react-firebase-baecd.appspot.com 25 | IS_ADS_ENABLED 26 | 27 | IS_ANALYTICS_ENABLED 28 | 29 | IS_APPINVITE_ENABLED 30 | 31 | IS_GCM_ENABLED 32 | 33 | IS_SIGNIN_ENABLED 34 | 35 | GOOGLE_APP_ID 36 | 1:6611069556:ios:855aece9994893c6 37 | DATABASE_URL 38 | https://react-firebase-baecd.firebaseio.com 39 | 40 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '9.0' 3 | 4 | target 'reactfirebaseexample' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for reactfirebaseexample 9 | 10 | # Required by RNFirebase 11 | pod 'Firebase/Core', '~> 5.3.0' 12 | 13 | # [OPTIONAL PODS] - comment out pods for firebase products you won't be using. 14 | pod 'Firebase/AdMob', '~> 5.3.0' 15 | pod 'Firebase/Auth', '~> 5.3.0' 16 | pod 'Firebase/Crash', '~> 5.3.0' 17 | pod 'Firebase/Database', '~> 5.3.0' 18 | pod 'Firebase/Functions', '~> 5.3.0' 19 | pod 'Firebase/DynamicLinks', '~> 5.3.0' 20 | pod 'Firebase/Firestore', '~> 5.3.0' 21 | # pod 'Firebase/Invites', '~> 5.3.0' 22 | pod 'Firebase/Messaging', '~> 5.3.0' 23 | pod 'Firebase/RemoteConfig', '~> 5.3.0' 24 | pod 'Firebase/Storage', '~> 5.3.0' 25 | pod 'Firebase/Performance', '~> 5.3.0' 26 | pod 'Fabric', '~> 1.7.5' 27 | pod 'Crashlytics', '~> 3.10.4' 28 | 29 | end 30 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | [FIRApp configure]; 19 | NSURL *jsCodeLocation; 20 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 21 | 22 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 23 | moduleName:@"reactfirebaseexample" 24 | initialProperties:nil 25 | launchOptions:launchOptions]; 26 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 27 | 28 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 29 | UIViewController *rootViewController = [UIViewController new]; 30 | rootViewController.view = rootView; 31 | self.window.rootViewController = rootViewController; 32 | [self.window makeKeyAndVisible]; 33 | return YES; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | $(DISPLAY_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(DISPLAY_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/ios/reactfirebaseexampleTests/reactfirebaseexampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface reactfirebaseexampleTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation reactfirebaseexampleTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /react-native-examples/react-native-firebase-starter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactfirebaseexample", 3 | "version": "0.1.0", 4 | "private": true, 5 | "devDependencies": { 6 | "babel-jest": "^23.4.0", 7 | "babel-preset-react-native-stage-0": "^1.0.1", 8 | "fs-extra": "^6.0.1", 9 | "jest": "^23.4.0", 10 | "prettier": "^1.14.2", 11 | "react-test-renderer": "^16.4.1", 12 | "replace-in-file": "^3.4.0" 13 | }, 14 | "scripts": { 15 | "android": "react-native run-android", 16 | "ios": "react-native run-ios", 17 | "rename": "node ./bin/rename.js", 18 | "start": "react-native start", 19 | "test": "jest" 20 | }, 21 | "jest": { 22 | "preset": "react-native" 23 | }, 24 | "dependencies": { 25 | "@react-firebase/auth": "^0.2.4", 26 | "@react-firebase/database": "^0.2.14", 27 | "@react-firebase/firestore": "^0.3.0", 28 | "fbjs": "^0.8.17", 29 | "react": "^16.3.2", 30 | "react-native": "^0.55.3", 31 | "react-native-firebase": "^4.3.6" 32 | } 33 | } 34 | --------------------------------------------------------------------------------