Skip to content

Conversation

@prescottprue
Copy link
Owner

@prescottprue prescottprue commented Mar 15, 2017

Notes About react-native

Support for react-native is still in the early testing phases. That means the API and/or functionality may change.

If using react-native, make sure you have the following config enabled when creating your store:

import ReactNative from 'react-native'
import { compose, createStore } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase'
const firebaseConfig = {} // your firebase config object
const initialState = { firebase: { authError: null } };

// then in your config when creating store
const store = createStore(
    makeRootReducer(), 
    initialState,
    compose(
      reactReduxFirebase(
        firebaseConfig,
        {
           rn: ReactNative,
           enableRedirectHandling: false,
           userProfile: 'users' 
         },
      ),
    )
  );

Normal authentication methods, such as firebase.login({provider: 'google', type: 'popup'}), will not work due to Firebase's js library (used internally) not completely supporting react-native. That means you must use firebase.auth().signInWithCredential(credential) until there is more support within the Firebase library.

It might look something like this (untested):

let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token);
this.props.firebase.auth().signInWithCredential(credential)
  .then(() => {
    console.log('auth successful')
  })
  .catch((err) => {
    console.log('error: ', err)
  })

# Conflicts:
#	src/compose.js
@prescottprue
Copy link
Owner Author

react-native branch will remain until v1.4.0 full version is released (not preversions such as v1.4.0-alpha

@prescottprue prescottprue changed the base branch from master to v1.4.0-alpha March 24, 2017 00:26
prescottprue added a commit that referenced this pull request Mar 24, 2017
**NOTE:** [The original pull request](#81) for this feature and its branch have the `dist` files included in git tracking (so the branch could be referenced in package files). This pull request does not include `dist` files.

## Features
* Initial support for `react-native` (should solve #80)
* Import only needed sections of Firebase library ( #72 and #53 )

## Notes About react-native
Support for `react-native` is still in the early testing phases. That means the API and/or functionality may change.

If using `react-native`, make sure you have the following config enabled when creating your store:

```js
import ReactNative from 'react-native'
import { compose, createStore } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase'
const firebaseConfig = {} // your firebase config object
const initialState = { firebase: { authError: null } };

// then in your config when creating store
const store = createStore(
    makeRootReducer(), 
    initialState,
    compose(
      reactReduxFirebase(
        firebaseConfig,
        {
           rn: ReactNative,
           enableRedirectHandling: false,
           userProfile: 'users' 
         },
      ),
    )
  );
```

Normal authentication methods, such as `firebase.login({provider: 'google', type: 'popup'})`, will not work due to Firebase's js library (used internally) not completely supporting `react-native`. That means you must use `firebase.auth().signInWithCredential(credential)` until there is more support within the Firebase library.

It might look something like this (untested):

```js
let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token);
this.props.firebase.auth().signInWithCredential(credential)
  .then(() => {
    console.log('auth successful')
  })
  .catch((err) => {
    console.log('error: ', err)
  })
```
@prescottprue prescottprue deleted the react-native branch July 10, 2017 06:23
Tomoya32 added a commit to Tomoya32/react-redux-firebase that referenced this pull request Aug 22, 2018
**NOTE:** [The original pull request](prescottprue/react-redux-firebase#81) for this feature and its branch have the `dist` files included in git tracking (so the branch could be referenced in package files). This pull request does not include `dist` files.

## Features
* Initial support for `react-native` (should solve #80)
* Import only needed sections of Firebase library ( #72 and #53 )

## Notes About react-native
Support for `react-native` is still in the early testing phases. That means the API and/or functionality may change.

If using `react-native`, make sure you have the following config enabled when creating your store:

```js
import ReactNative from 'react-native'
import { compose, createStore } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase'
const firebaseConfig = {} // your firebase config object
const initialState = { firebase: { authError: null } };

// then in your config when creating store
const store = createStore(
    makeRootReducer(), 
    initialState,
    compose(
      reactReduxFirebase(
        firebaseConfig,
        {
           rn: ReactNative,
           enableRedirectHandling: false,
           userProfile: 'users' 
         },
      ),
    )
  );
```

Normal authentication methods, such as `firebase.login({provider: 'google', type: 'popup'})`, will not work due to Firebase's js library (used internally) not completely supporting `react-native`. That means you must use `firebase.auth().signInWithCredential(credential)` until there is more support within the Firebase library.

It might look something like this (untested):

```js
let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token);
this.props.firebase.auth().signInWithCredential(credential)
  .then(() => {
    console.log('auth successful')
  })
  .catch((err) => {
    console.log('error: ', err)
  })
```
mirdavion pushed a commit to mirdavion/react-redux-firebase that referenced this pull request Mar 18, 2021
**NOTE:** [The original pull request](prescottprue/react-redux-firebase#81) for this feature and its branch have the `dist` files included in git tracking (so the branch could be referenced in package files). This pull request does not include `dist` files.

## Features
* Initial support for `react-native` (should solve #80)
* Import only needed sections of Firebase library ( #72 and #53 )

## Notes About react-native
Support for `react-native` is still in the early testing phases. That means the API and/or functionality may change.

If using `react-native`, make sure you have the following config enabled when creating your store:

```js
import ReactNative from 'react-native'
import { compose, createStore } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase'
const firebaseConfig = {} // your firebase config object
const initialState = { firebase: { authError: null } };

// then in your config when creating store
const store = createStore(
    makeRootReducer(), 
    initialState,
    compose(
      reactReduxFirebase(
        firebaseConfig,
        {
           rn: ReactNative,
           enableRedirectHandling: false,
           userProfile: 'users' 
         },
      ),
    )
  );
```

Normal authentication methods, such as `firebase.login({provider: 'google', type: 'popup'})`, will not work due to Firebase's js library (used internally) not completely supporting `react-native`. That means you must use `firebase.auth().signInWithCredential(credential)` until there is more support within the Firebase library.

It might look something like this (untested):

```js
let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token);
this.props.firebase.auth().signInWithCredential(credential)
  .then(() => {
    console.log('auth successful')
  })
  .catch((err) => {
    console.log('error: ', err)
  })
```
prodev90 added a commit to prodev90/react-redux-firebase-sample that referenced this pull request Jan 4, 2023
**NOTE:** [The original pull request](prescottprue/react-redux-firebase#81) for this feature and its branch have the `dist` files included in git tracking (so the branch could be referenced in package files). This pull request does not include `dist` files.

## Features
* Initial support for `react-native` (should solve #80)
* Import only needed sections of Firebase library ( #72 and #53 )

## Notes About react-native
Support for `react-native` is still in the early testing phases. That means the API and/or functionality may change.

If using `react-native`, make sure you have the following config enabled when creating your store:

```js
import ReactNative from 'react-native'
import { compose, createStore } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase'
const firebaseConfig = {} // your firebase config object
const initialState = { firebase: { authError: null } };

// then in your config when creating store
const store = createStore(
    makeRootReducer(), 
    initialState,
    compose(
      reactReduxFirebase(
        firebaseConfig,
        {
           rn: ReactNative,
           enableRedirectHandling: false,
           userProfile: 'users' 
         },
      ),
    )
  );
```

Normal authentication methods, such as `firebase.login({provider: 'google', type: 'popup'})`, will not work due to Firebase's js library (used internally) not completely supporting `react-native`. That means you must use `firebase.auth().signInWithCredential(credential)` until there is more support within the Firebase library.

It might look something like this (untested):

```js
let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token);
this.props.firebase.auth().signInWithCredential(credential)
  .then(() => {
    console.log('auth successful')
  })
  .catch((err) => {
    console.log('error: ', err)
  })
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants