Skip to content

Commit 82ac2d4

Browse files
committed
add firebaseui to example
1 parent 2abceee commit 82ac2d4

File tree

8 files changed

+70
-88
lines changed

8 files changed

+70
-88
lines changed

example/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ buck-out/
6565
# RNFirebaseStarter
6666
yarn.lock
6767
package-lock.json
68+
69+
# config files
70+
71+
google-services.json

example/App.js

Lines changed: 37 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,47 @@
1-
import React from 'react';
2-
import { StyleSheet, Platform, Image, Text, View, ScrollView } from 'react-native';
1+
import React, { Component } from 'react';
2+
import { StyleSheet, View } from 'react-native'
3+
import { ImageView, PhotoView } from 'react-native-firebaseui'
34

4-
import firebase from 'react-native-firebase';
5+
//no zoom support
6+
class MyFirebaseImageView extends Component {
7+
render() {
8+
let imageProps = this.props
59

6-
export default class App extends React.Component {
7-
constructor() {
8-
super();
9-
this.state = {};
10+
return (
11+
<ImageView
12+
{...imageProps}
13+
path='images/firebase_logo.png'
14+
timestamp={1000} //optional, can be used to specify last modified time for same storage path
15+
resizeMode='cover' //'cover', 'contain', 'stretch'
16+
/>
17+
)
1018
}
19+
}
1120

12-
async componentDidMount() {
13-
// TODO: You: Do firebase things
14-
// const { user } = await firebase.auth().signInAnonymously();
15-
// console.warn('User -> ', user.toJSON());
21+
//zoom support (android only). On iOS just wrap the ImageView with a scroll view
22+
class MyFirebasePhotoView extends Component {
23+
render() {
24+
let imageProps = this.props
1625

17-
// await firebase.analytics().logEvent('foo', { bar: '123'});
26+
return (
27+
<PhotoView
28+
{...imageProps}
29+
path='images/firebase_logo.png'
30+
timestamp={1000} //optional, can be used to specify last modified time for same storage path
31+
resizeMode='cover' //'cover', 'contain', 'stretch'
32+
/>
33+
)
1834
}
35+
}
1936

37+
export default class App extends Component {
2038
render() {
2139
return (
22-
<ScrollView>
23-
<View style={styles.container}>
24-
<Image source={require('./assets/ReactNativeFirebase.png')} style={[styles.logo]}/>
25-
<Text style={styles.welcome}>
26-
Welcome to {'\n'} React Native Firebase
27-
</Text>
28-
<Text style={styles.instructions}>
29-
To get started, edit App.js
30-
</Text>
31-
{Platform.OS === 'ios' ? (
32-
<Text style={styles.instructions}>
33-
Press Cmd+R to reload,{'\n'}
34-
Cmd+D or shake for dev menu
35-
</Text>
36-
) : (
37-
<Text style={styles.instructions}>
38-
Double tap R on your keyboard to reload,{'\n'}
39-
Cmd+M or shake for dev menu
40-
</Text>
41-
)}
42-
<View style={styles.modules}>
43-
<Text style={styles.modulesHeader}>The following Firebase modules are pre-installed:</Text>
44-
{firebase.admob.nativeModuleExists && <Text style={styles.module}>admob()</Text>}
45-
{firebase.analytics.nativeModuleExists && <Text style={styles.module}>analytics()</Text>}
46-
{firebase.auth.nativeModuleExists && <Text style={styles.module}>auth()</Text>}
47-
{firebase.config.nativeModuleExists && <Text style={styles.module}>config()</Text>}
48-
{firebase.crashlytics.nativeModuleExists && <Text style={styles.module}>crashlytics()</Text>}
49-
{firebase.database.nativeModuleExists && <Text style={styles.module}>database()</Text>}
50-
{firebase.firestore.nativeModuleExists && <Text style={styles.module}>firestore()</Text>}
51-
{firebase.functions.nativeModuleExists && <Text style={styles.module}>functions()</Text>}
52-
{firebase.iid.nativeModuleExists && <Text style={styles.module}>iid()</Text>}
53-
{firebase.invites.nativeModuleExists && <Text style={styles.module}>invites()</Text>}
54-
{firebase.links.nativeModuleExists && <Text style={styles.module}>links()</Text>}
55-
{firebase.messaging.nativeModuleExists && <Text style={styles.module}>messaging()</Text>}
56-
{firebase.notifications.nativeModuleExists && <Text style={styles.module}>notifications()</Text>}
57-
{firebase.perf.nativeModuleExists && <Text style={styles.module}>perf()</Text>}
58-
{firebase.storage.nativeModuleExists && <Text style={styles.module}>storage()</Text>}
59-
</View>
60-
</View>
61-
</ScrollView>
62-
);
40+
<View style={styles.container}>
41+
<MyFirebaseImageView />
42+
<MyFirebasePhotoView />
43+
</View>
44+
)
6345
}
6446
}
6547

@@ -69,34 +51,5 @@ const styles = StyleSheet.create({
6951
justifyContent: 'center',
7052
alignItems: 'center',
7153
backgroundColor: '#F5FCFF',
72-
},
73-
logo: {
74-
height: 120,
75-
marginBottom: 16,
76-
marginTop: 64,
77-
padding: 10,
78-
width: 135,
79-
},
80-
welcome: {
81-
fontSize: 20,
82-
textAlign: 'center',
83-
margin: 10,
84-
},
85-
instructions: {
86-
textAlign: 'center',
87-
color: '#333333',
88-
marginBottom: 5,
89-
},
90-
modules: {
91-
margin: 20,
92-
},
93-
modulesHeader: {
94-
fontSize: 16,
95-
marginBottom: 8,
96-
},
97-
module: {
98-
fontSize: 14,
99-
marginTop: 4,
100-
textAlign: 'center',
101-
}
102-
});
54+
},
55+
});

example/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ android {
154154
}
155155

156156
dependencies {
157+
implementation project(':react-native-firebaseui')
157158
//noinspection GradleDynamicVersion
158159
implementation "com.facebook.react:react-native:+"
159160
implementation fileTree(dir: "libs", include: ["*.jar"])

example/android/app/src/main/java/com/rmrs/reactnativefirebaseuiexample/MainApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.Application;
55

66
import com.facebook.react.ReactApplication;
7+
import io.rumors.reactnativefirebaseui.RNFirebaseUiPackage;
78
import com.facebook.react.ReactNativeHost;
89
import com.facebook.react.ReactPackage;
910
import com.facebook.react.shell.MainReactPackage;
@@ -43,6 +44,7 @@ public boolean getUseDeveloperSupport() {
4344
protected List<ReactPackage> getPackages() {
4445
return Arrays.asList(
4546
new MainReactPackage(),
47+
new RNFirebaseUiPackage(),
4648
new RNFirebasePackage(),
4749
// add/remove these packages as appropriate
4850
new RNFirebaseAdMobPackage(),

example/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
jcenter()
1313
maven {
1414
url 'https://maven.fabric.io/public'
15-
}
15+
}
1616
}
1717
dependencies {
1818
classpath 'com.android.tools.build:gradle:3.2.0'
@@ -33,6 +33,9 @@ allprojects {
3333
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
3434
url "$rootDir/../node_modules/react-native/android"
3535
}
36+
maven {
37+
url "https://jitpack.io"
38+
}
3639
}
3740
}
3841

example/android/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'ReactNativeFirebaseUIExample'
2+
include ':react-native-firebaseui'
3+
project(':react-native-firebaseui').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebaseui/android')
24
include ':react-native-firebase'
35
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
46

example/ios/ReactNativeFirebaseUIExample.xcodeproj/project.pbxproj

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
};
66
objectVersion = 46;
77
objects = {
8-
98
/* Begin PBXBuildFile section */
109
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1110
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -40,6 +39,7 @@
4039
8E7D4B171F8AFD9C00699FE4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D4B161F8AFD9B00699FE4 /* GoogleService-Info.plist */; };
4140
A038CD85D39748E122AC50D7 /* libPods-ReactNativeFirebaseUIExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 333056BA5B7ADABE709DF4A1 /* libPods-ReactNativeFirebaseUIExample.a */; };
4241
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
42+
2BAF0A8D66B44E65918C358B /* libRNFirebaseUi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9A763E046F34FF9A0917F84 /* libRNFirebaseUi.a */; };
4343
/* End PBXBuildFile section */
4444

4545
/* Begin PBXContainerItemProxy section */
@@ -357,6 +357,8 @@
357357
ADF4CB3C3BF44D3EBA8B78C4 /* RNFirebase.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFirebase.xcodeproj; path = "../node_modules/react-native-firebase/ios/RNFirebase.xcodeproj"; sourceTree = "<group>"; };
358358
B7AFA8AA9A1CFD17320E9074 /* Pods-ReactNativeFirebaseUIExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeFirebaseUIExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ReactNativeFirebaseUIExample/Pods-ReactNativeFirebaseUIExample.release.xcconfig"; sourceTree = "<group>"; };
359359
FBC8C743C046423C960F2237 /* libRNFirebase.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFirebase.a; sourceTree = "<group>"; };
360+
A534AB8174E64935AD5199CA /* RNFirebaseUi.xcodeproj */ = {isa = PBXFileReference; name = "RNFirebaseUi.xcodeproj"; path = "../node_modules/react-native-firebaseui/ios/RNFirebaseUi.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
361+
F9A763E046F34FF9A0917F84 /* libRNFirebaseUi.a */ = {isa = PBXFileReference; name = "libRNFirebaseUi.a"; path = "libRNFirebaseUi.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
360362
/* End PBXFileReference section */
361363

362364
/* Begin PBXFrameworksBuildPhase section */
@@ -386,6 +388,7 @@
386388
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
387389
68B70528A2734DEA89C8B214 /* libRNFirebase.a in Frameworks */,
388390
A038CD85D39748E122AC50D7 /* libPods-ReactNativeFirebaseUIExample.a in Frameworks */,
391+
2BAF0A8D66B44E65918C358B /* libRNFirebaseUi.a in Frameworks */,
389392
);
390393
runOnlyForDeploymentPostprocessing = 0;
391394
};
@@ -573,6 +576,7 @@
573576
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
574577
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
575578
ADF4CB3C3BF44D3EBA8B78C4 /* RNFirebase.xcodeproj */,
579+
A534AB8174E64935AD5199CA /* RNFirebaseUi.xcodeproj */,
576580
);
577581
name = Libraries;
578582
sourceTree = "<group>";
@@ -731,7 +735,7 @@
731735
83CBB9F71A601CBA00E9B192 /* Project object */ = {
732736
isa = PBXProject;
733737
attributes = {
734-
LastUpgradeCheck = 0940;
738+
LastUpgradeCheck = 940;
735739
ORGANIZATIONNAME = Facebook;
736740
TargetAttributes = {
737741
00E356ED1AD99517003FC87E = {
@@ -1283,13 +1287,15 @@
12831287
HEADER_SEARCH_PATHS = (
12841288
"$(inherited)",
12851289
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1290+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
12861291
);
12871292
INFOPLIST_FILE = ReactNativeFirebaseUIExampleTests/Info.plist;
12881293
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
12891294
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
12901295
LIBRARY_SEARCH_PATHS = (
12911296
"$(inherited)",
12921297
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1298+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
12931299
);
12941300
OTHER_LDFLAGS = (
12951301
"-ObjC",
@@ -1308,13 +1314,15 @@
13081314
HEADER_SEARCH_PATHS = (
13091315
"$(inherited)",
13101316
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1317+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
13111318
);
13121319
INFOPLIST_FILE = ReactNativeFirebaseUIExampleTests/Info.plist;
13131320
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
13141321
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13151322
LIBRARY_SEARCH_PATHS = (
13161323
"$(inherited)",
13171324
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1325+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13181326
);
13191327
OTHER_LDFLAGS = (
13201328
"-ObjC",
@@ -1336,6 +1344,7 @@
13361344
HEADER_SEARCH_PATHS = (
13371345
"$(inherited)",
13381346
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1347+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
13391348
);
13401349
INFOPLIST_FILE = ReactNativeFirebaseUIExample/Info.plist;
13411350
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1360,6 +1369,7 @@
13601369
HEADER_SEARCH_PATHS = (
13611370
"$(inherited)",
13621371
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1372+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
13631373
);
13641374
INFOPLIST_FILE = ReactNativeFirebaseUIExample/Info.plist;
13651375
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1389,12 +1399,14 @@
13891399
HEADER_SEARCH_PATHS = (
13901400
"$(inherited)",
13911401
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1402+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
13921403
);
13931404
INFOPLIST_FILE = "ReactNativeFirebaseUIExample-tvOS/Info.plist";
13941405
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
13951406
LIBRARY_SEARCH_PATHS = (
13961407
"$(inherited)",
13971408
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1409+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13981410
);
13991411
OTHER_LDFLAGS = (
14001412
"-ObjC",
@@ -1423,12 +1435,14 @@
14231435
HEADER_SEARCH_PATHS = (
14241436
"$(inherited)",
14251437
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
1438+
"$(SRCROOT)/../node_modules/react-native-firebaseui/ios",
14261439
);
14271440
INFOPLIST_FILE = "ReactNativeFirebaseUIExample-tvOS/Info.plist";
14281441
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
14291442
LIBRARY_SEARCH_PATHS = (
14301443
"$(inherited)",
14311444
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1445+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14321446
);
14331447
OTHER_LDFLAGS = (
14341448
"-ObjC",
@@ -1458,6 +1472,7 @@
14581472
LIBRARY_SEARCH_PATHS = (
14591473
"$(inherited)",
14601474
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1475+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14611476
);
14621477
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeFirebaseUIExample-tvOSTests";
14631478
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1483,6 +1498,7 @@
14831498
LIBRARY_SEARCH_PATHS = (
14841499
"$(inherited)",
14851500
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1501+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14861502
);
14871503
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeFirebaseUIExample-tvOSTests";
14881504
PRODUCT_NAME = "$(TARGET_NAME)";

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"dependencies": {
2525
"react": "16.5.0",
2626
"react-native": "0.57.1",
27-
"react-native-firebase": "^5.1.0"
27+
"react-native-firebase": "^5.1.0",
28+
"react-native-firebaseui": "file:../"
2829
}
2930
}

0 commit comments

Comments
 (0)