Add default implementation for android
This commit is contained in:
parent
0fbbae031a
commit
cc8bcc5466
|
@ -2,6 +2,9 @@
|
||||||
#
|
#
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Google
|
||||||
|
android/app/google-services.json
|
||||||
|
|
||||||
# Xcode
|
# Xcode
|
||||||
#
|
#
|
||||||
build/
|
build/
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
### Android
|
||||||
|
|
||||||
|
1) Setup google-services.json
|
||||||
|
- make sure the package_name inside points to `com.demo`
|
|
@ -136,6 +136,11 @@ dependencies {
|
||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile "com.android.support:appcompat-v7:23.0.1"
|
compile "com.android.support:appcompat-v7:23.0.1"
|
||||||
compile "com.facebook.react:react-native:+" // From node_modules
|
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
|
// Run this once to be able to run the application with BUCK
|
||||||
|
@ -144,3 +149,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
|
||||||
from configurations.compile
|
from configurations.compile
|
||||||
into 'libs'
|
into 'libs'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
|
@ -8,6 +8,8 @@ import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.react.shell.MainReactPackage;
|
import com.facebook.react.shell.MainReactPackage;
|
||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
|
import io.invertase.firebase.RNFirebasePackage;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,7 +24,8 @@ public class MainApplication extends Application implements ReactApplication {
|
||||||
@Override
|
@Override
|
||||||
protected List<ReactPackage> getPackages() {
|
protected List<ReactPackage> getPackages() {
|
||||||
return Arrays.<ReactPackage>asList(
|
return Arrays.<ReactPackage>asList(
|
||||||
new MainReactPackage()
|
new MainReactPackage(),
|
||||||
|
new RNFirebasePackage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
rootProject.name = 'demo'
|
rootProject.name = 'demo'
|
||||||
|
|
||||||
include ':app'
|
include ':app'
|
||||||
|
include ':react-native-firebase'
|
||||||
|
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { View } from 'react-native'
|
import { View } from 'react-native'
|
||||||
|
import RNFirebase from 'react-native-firebase'
|
||||||
|
import firebase from './lib/firebase'
|
||||||
|
|
||||||
export default class App extends React.Component {
|
export default class App extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
/**
|
|
||||||
* Sample React Native App
|
|
||||||
* https://github.com/facebook/react-native
|
|
||||||
* @flow
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import {
|
import {
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
|
|
|
@ -1,53 +1,25 @@
|
||||||
/**
|
import React, { Component } from 'react'
|
||||||
* Sample React Native App
|
|
||||||
* https://github.com/facebook/react-native
|
|
||||||
* @flow
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import {
|
import {
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
|
||||||
View
|
View
|
||||||
} from 'react-native';
|
} from 'react-native'
|
||||||
|
import App from './app'
|
||||||
|
|
||||||
export default class demo extends Component {
|
export default class demo extends Component {
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.welcome}>
|
<App />
|
||||||
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>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1
|
||||||
justifyContent: 'center',
|
}
|
||||||
alignItems: 'center',
|
})
|
||||||
backgroundColor: '#F5FCFF',
|
|
||||||
},
|
|
||||||
welcome: {
|
|
||||||
fontSize: 20,
|
|
||||||
textAlign: 'center',
|
|
||||||
margin: 10,
|
|
||||||
},
|
|
||||||
instructions: {
|
|
||||||
textAlign: 'center',
|
|
||||||
color: '#333333',
|
|
||||||
marginBottom: 5,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
AppRegistry.registerComponent('demo', () => demo);
|
AppRegistry.registerComponent('demo', () => demo)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import RNFirebase from 'react-native-firebase'
|
||||||
|
|
||||||
|
const configurationOptions = {
|
||||||
|
debug: true
|
||||||
|
}
|
||||||
|
|
||||||
|
const firebase = RNFirebase.initializeApp(configurationOptions)
|
||||||
|
|
||||||
|
export default firebase
|
Loading…
Reference in New Issue