Skip to content

Commit 4c9c0c0

Browse files
committed
fix(HOCs): missing props (firebase + dispatch) added - #606
1 parent d322124 commit 4c9c0c0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/withFirestore.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react'
22
import hoistStatics from 'hoist-non-react-statics'
33
import { wrapDisplayName } from './utils'
4+
import ReactReduxFirebaseContext from './ReactReduxFirebaseContext'
45
import ReduxFirestoreContext from './ReduxFirestoreContext'
56

67
/**
@@ -35,9 +36,20 @@ export const createWithFirestore = (storeKey = 'store') => WrappedComponent => {
3536
const HoistedComp = hoistStatics(WithFirestore, WrappedComponent)
3637

3738
const withFirestore = props => (
38-
<ReduxFirestoreContext.Consumer>
39-
{firestore => <HoistedComp firestore={firestore} {...props} />}
40-
</ReduxFirestoreContext.Consumer>
39+
<ReactReduxFirebaseContext.Consumer>
40+
{firebase => (
41+
<ReduxFirestoreContext.Consumer>
42+
{firestore => (
43+
<HoistedComp
44+
firestore={firestore}
45+
firebase={firebase}
46+
dispatch={firebase.dispatch}
47+
{...props}
48+
/>
49+
)}
50+
</ReduxFirestoreContext.Consumer>
51+
)}
52+
</ReactReduxFirebaseContext.Consumer>
4153
)
4254

4355
withFirestore.displayName = wrapDisplayName(WrappedComponent, 'withFirestore')

0 commit comments

Comments
 (0)