From 644ca5774f31985e45eea09f9822c9cdb90c5825 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Wed, 12 Feb 2020 21:40:52 +0000 Subject: [PATCH 1/3] feat: add firebase storage upload example --- with-firebase-storage-upload/App.js | 203 +++++++++++++++++++ with-firebase-storage-upload/README.md | 22 ++ with-firebase-storage-upload/app.json | 12 ++ with-firebase-storage-upload/babel.config.js | 6 + with-firebase-storage-upload/package.json | 17 ++ 5 files changed, 260 insertions(+) create mode 100644 with-firebase-storage-upload/App.js create mode 100644 with-firebase-storage-upload/README.md create mode 100644 with-firebase-storage-upload/app.json create mode 100644 with-firebase-storage-upload/babel.config.js create mode 100644 with-firebase-storage-upload/package.json diff --git a/with-firebase-storage-upload/App.js b/with-firebase-storage-upload/App.js new file mode 100644 index 0000000..e13cff8 --- /dev/null +++ b/with-firebase-storage-upload/App.js @@ -0,0 +1,203 @@ +import * as ImagePicker from 'expo-image-picker'; +import * as Permissions from 'expo-permissions'; +import * as firebase from 'firebase'; +import React from 'react'; +import { + ActivityIndicator, + Button, + Clipboard, + Image, + Share, + StatusBar, + StyleSheet, + Text, + View, +} from 'react-native'; +import uuid from 'uuid'; + +const firebaseConfig = { + apiKey: 'AIzaSyAlZruO2T_JNOWn4ysfX6AryR6Dzm_VVaA', + authDomain: 'blobtest-36ff6.firebaseapp.com', + databaseURL: 'https://blobtest-36ff6.firebaseio.com', + storageBucket: 'blobtest-36ff6.appspot.com', + messagingSenderId: '506017999540', +}; + +firebase.initializeApp(firebaseConfig); + +// Firebase sets some timeers for a long period, which will trigger some warnings. Let's turn that off for this example +console.disableYellowBox = true; + +export default class App extends React.Component { + state = { + image: null, + uploading: false, + }; + + async componentDidMount() { + await Permissions.askAsync(Permissions.CAMERA_ROLL); + await Permissions.askAsync(Permissions.CAMERA); + } + + render() { + let { image } = this.state; + + return ( + + {!!image && ( + + Example: Upload ImagePicker result + + )} + +