This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
moduleName:@"YourReactApp" | |
initialProperties:nil | |
launchOptions:launchOptions]; | |
// This line | |
rootView.backgroundColor = [[UIColor alloc] initWithRed:0.39 green:0.58 blue:0.67 alpha:1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- We'll use 'background' name to reference this color --> | |
<!-- Replace #HEX_VALUE with Your color --> | |
<color name="background">#HEX_VALUE</color> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- @color is a reference to resource colors.xml --> | |
<!-- and 'background' is a name of the resource --> | |
<item name="android:windowBackground">@color/background</item> | |
</style> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This will be different | |
target 'YouAppNameHere' do | |
#Firebase and RNFirebase pods | |
pod 'Firebase/Core' | |
pod 'RNFirebase', :path => '../node_modules/react-native-firebase' | |
# Authentication module for RNFirebase | |
pod 'Firebase/Auth' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ':react-native-firebase' | |
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// Add to dependencies | |
compile(project(':react-native-firebase')) { | |
transitive = false | |
} | |
compile "com.google.firebase:firebase-core:11.4.2" | |
// If you are receiving Google Play API availability issues, add the following dependency | |
compile "com.google.android.gms:play-services-base:11.4.2" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will vary | |
package com.example.application; | |
// Core RNFirebase | |
import io.invertase.firebase.RNFirebasePackage; | |
public class MainApplication extends Application implements ReactApplication { | |
@Override | |
protected List<ReactPackage> getPackages() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RNFirebase from 'react-native-firebase' | |
// to check out init options, head to https://invertase.io/react-native-firebase/#/v2/usage?id=configuration-options | |
const initOptions = {} | |
const firebase = RNFirebase.initializeApp(initOptions); | |
export default firebase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
// Inside our Component's class | |
_authenticateUser = async () => { | |
const { firebase } = this.props; // Parent passes reference to Firebase through props | |
const { userPassword, userEmail } = this.state; | |
let userInfo = null; | |
try { | |
userInfo = await firebase.auth().signInWithEmailAndPassword(userEmail, userPassword) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import firebase from './firebase' | |
// Child is our Wrapped component | |
export default (Child) => ( | |
class AuthHoC extends Component { | |
state = { | |
isAuthenticated: false | |
} |
OlderNewer