Podfile
target 'yourAppNameHere' do
pod "Yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'BatchedBridge', # Required For React Native 0.45.0+
'Core',
// All necessary imports | |
class AppAuthScreen extends Component { | |
async componentDidMount() { | |
const { navigation } = this.props; | |
const currentEmail = await AsyncStorage.getItem( | |
'@footballApp:currentEmail' // key used to save email during user singup | |
); |
// @flow | |
import firebase from 'react-native-firebase'; | |
export const DB = firebase.firestore(); | |
export const USER_COLLECTION = 'users'; // name of collection in Firestore | |
export async function createUserDataBaseEntry(userId: string) { | |
// creating a new transaction |
import com.facebook.react.ReactActivity; | |
public class MainActivity extends ReactActivity { | |
@Override | |
protected String getMainComponentName() { | |
return "kotlin_app"; | |
} | |
} |
import com.facebook.react.ReactActivity | |
class MainActivity : ReactActivity() { | |
override fun getMainComponentName(): String? { | |
return "kotlin_app" | |
} | |
} |
//... | |
apply plugin: "kotlin-android" // apply plugin | |
dependencies { | |
// ... | |
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // add dependency | |
} | |
// ... |
buildscript { | |
ext.kotlin_version = '1.2.31' // add version | |
// ... | |
dependencies { | |
// ... | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Add kotlin dependency | |
} | |
} | |
// ... |
/* | |
Variables | |
- Must be initialized with value | |
- Can be either immutable or mutable | |
- Can be null, but need to be declared with nullable type (more later) | |
- Various in Kotlin | |
- Numbers | |
- Byte | |
- Short |
import React, { Component } from 'react'; | |
import firebase from './firebase' | |
// Child is our Wrapped component | |
export default (Child) => ( | |
class AuthHoC extends Component { | |
state = { | |
isAuthenticated: false | |
} |
// ... | |
// 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) |