Add default implementation for android

This commit is contained in:
ugiacoman 2017-07-04 19:22:19 -04:00
parent 0fbbae031a
commit cc8bcc5466
10 changed files with 42 additions and 47 deletions

View File

@ -2,6 +2,9 @@
#
.DS_Store
# Google
android/app/google-services.json
# Xcode
#
build/

4
example/demo/README.md Normal file
View File

@ -0,0 +1,4 @@
### Android
1) Setup google-services.json
- make sure the package_name inside points to `com.demo`

View File

@ -136,6 +136,11 @@ dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile(project(':react-native-firebase')) {
transitive = false
}
compile "com.google.firebase:firebase-core:11.0.0"
}
// Run this once to be able to run the application with BUCK
@ -144,3 +149,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'

View File

@ -8,6 +8,8 @@ import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import io.invertase.firebase.RNFirebasePackage;
import java.util.Arrays;
import java.util.List;
@ -22,7 +24,8 @@ public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new RNFirebasePackage()
);
}
};

View File

@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

View File

@ -1,3 +1,4 @@
rootProject.name = 'demo'
include ':app'
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

View File

@ -1,5 +1,7 @@
import React from 'react'
import { View } from 'react-native'
import RNFirebase from 'react-native-firebase'
import firebase from './lib/firebase'
export default class App extends React.Component {
render () {

View File

@ -1,9 +1,3 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react'
import {
AppRegistry,

View File

@ -1,53 +1,25 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
} from 'react-native'
import App from './app'
export default class demo extends Component {
render() {
render () {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
<App />
</View>
);
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
flex: 1
}
})
AppRegistry.registerComponent('demo', () => demo);
AppRegistry.registerComponent('demo', () => demo)

View File

@ -0,0 +1,9 @@
import RNFirebase from 'react-native-firebase'
const configurationOptions = {
debug: true
}
const firebase = RNFirebase.initializeApp(configurationOptions)
export default firebase