Table of Contents

reactReduxFirebase

Middleware that handles configuration (placed in redux's compose call)

Parameters

  • fbConfig
  • otherConfig

Properties

  • firebaseInstance Object Initiated firebase instance (can also be library following Firebase JS API such as react-native-firebase)
  • config Object Containing react-redux-firebase specific configuration
    • config.userProfile String Location on firebase to store user profiles
    • config.enableLogging Boolean Whether or not to enable Firebase database logging. Note: Only works if instance has enableLogging function.
    • config.profileFactory Function Factory for modifying how user profile is saved.
    • config.presence Boolean Location on Firebase to store currently online users list. Often set to 'presence' or 'onlineUsers'.
    • config.sessions Boolean Location on Firebase where user sessions are stored (only if presense is set). Often set to 'sessions' or 'onlineUsers'.
    • config.updateProfileOnLogin Boolean Whether or not to update profile when logging in. (default: false)
    • config.enableRedirectHandling Boolean Whether or not to enable auth redirect handling listener. (default: true)
    • config.onAuthStateChanged Function Function run when auth state changes. Argument Pattern: (authData, firebase, dispatch)
    • config.enableEmptyAuthChanges Boolean Whether or not to enable empty auth changes. When set to true, onAuthStateChanged will be fired with, empty auth changes such as undefined on initialization. See #137 for more details. (default: false)
    • config.onRedirectResult Function Function run when redirect result is returned. Argument Pattern: (authData, firebase, dispatch)
    • config.customAuthParameters Object Object for setting which customAuthParameters are passed to external auth providers.
    • config.profileFactory Function Factory for modifying how user profile is saved.
    • config.fileMetadataFactory Function Factory for modifying how file meta data is written during file uploads
    • config.profileParamsToPopulate (Array | String) Parameters within profile object to populate. As of v2.0.0 data is only loaded for population, not actually automatically populated (allows access to both unpopulated and populated profile data).
    • config.autoPopulateProfile Boolean NOTE: Not yet enabled for v2.0.0. Whether or not to automatically populate profile with data loaded through profileParamsToPopulate config. (default: true)
    • config.setProfilePopulateResults Boolean Whether or not to call SET actions for data that results from populating profile to redux under the data path. For example: role paramter on profile populated from 'roles' root. True will call SET_PROFILE as well as a SET action with the role that is loaded (places it in data/roles). (default: false)

Examples

Setup

import { createStore, compose } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
import * as firebase from 'firebase'

// React Redux Firebase Config
const config = {
  userProfile: 'users', // saves user profiles to '/users' on Firebase
  // here is where you place other config options
}

// initialize script from Firebase page
const fbConfg = {} // firebase config object
firebase.initializeApp(fbConfig)

// Add react-redux-firebase to compose
// Note: In full projects this will often be within createStore.js or store.js
const createStoreWithFirebase = compose(
 reactReduxFirebase(firebase, config),
)(createStore)

// Use Function later to create store
const store = createStoreWithFirebase(rootReducer, initialState)

Returns Function That accepts a component and returns a Component which wraps the provided component (higher order component).

results matching ""

    No results matching ""