Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1d1bb12
Started separate reducers.
prescottprue Jan 16, 2017
113fb3c
Merge branch 'master' into v2.0.0-alpha
prescottprue Mar 19, 2017
53175d0
Finished removing rest of immutable stuff from reducer.
prescottprue Mar 21, 2017
67f3384
Return file snapshot on upload (#88)
urbantumbleweed Mar 24, 2017
5edc780
feat(react-native): react-native and boilerplate support (#90)
prescottprue Mar 24, 2017
2d1bbb7
Added XMLHttpRequest to tests (to fix firebase auth issue)
Mar 24, 2017
0ffacb0
react-native complete example started.
Mar 24, 2017
224de4e
Firebase showing up in react-native example.
Mar 24, 2017
78f3ed4
Home now displays auth in a string.
Mar 25, 2017
2b2f429
react-native now working with firebase js library
prescottprue Mar 25, 2017
cc0ad58
Switched to ReactNative instead of rn
prescottprue Mar 25, 2017
d65aa2f
Version v1.4.0-beta (#97)
prescottprue Mar 26, 2017
04039a2
Version v1.4.0 Beta 2 (#100)
prescottprue Mar 28, 2017
5042759
Version v1.4.0 Beta 3 (#101)
prescottprue Mar 28, 2017
27d64e7
Merge branch 'master' into v1.4.0
prescottprue Mar 30, 2017
acd14f9
Merge branch 'master' into v1.4.0
Apr 1, 2017
c960361
Version 1.4.0 Beta 4 (#105)
prescottprue Apr 3, 2017
459c222
Version v1.4.0 Release Candidate 1 (#110)
prescottprue Apr 5, 2017
23bb32a
Form utils added to example.
prescottprue Apr 10, 2017
bc64cf5
Roadmap updated with info on nested populates and updateProfile method.
Apr 15, 2017
b3c87bd
Merge branch 'master' into v1.4.0
Apr 15, 2017
d4b86d1
Server side rendering notes added.
Apr 26, 2017
d7943f5
Merge branch 'master' into v1.4.0
May 5, 2017
36de200
Support for custom auth parameters added.
May 5, 2017
6b2826c
Merge branch 'master' into v1.4.0
May 5, 2017
e478d03
notParsed query parameter. isLoaded returns true issue (#121)
May 5, 2017
85e968e
Use prop-types package instead of the bundled prop-types (#122)
petetnt May 5, 2017
7dbe7b2
key: true lists support for profileParamsToPopulate (#123)
fej-snikduj May 5, 2017
ff11deb
Fixed typos in material-example
May 6, 2017
e89e381
Fixed the last of the "react" typos within material example.
May 6, 2017
3655517
Firebase updated to v3.9.0. More material example updates.
prescottprue May 6, 2017
4e629a9
Lint removed.
prescottprue May 6, 2017
e53dc19
More lint removal from material-ui example.
prescottprue May 6, 2017
caa9bd4
Added message to clarify home container.
prescottprue May 6, 2017
c964724
Not populated delete working in material-ui example
prescottprue May 6, 2017
c92a563
Pull request template updated. Roadmap updated with react-native-fire…
prescottprue May 16, 2017
90489f6
SSR and Auth sections added to recipes. Roadmap updated for coming v1…
prescottprue May 16, 2017
4404433
Merge branch 'master' into v1.4.0
prescottprue May 16, 2017
12df1e8
Auth Recipes cleaned up.
prescottprue May 16, 2017
df2a81a
Apply #122 to v1.5.0
May 17, 2017
4e212dd
Adds various features to populates (#132)
javamonn May 17, 2017
451976a
Firebase messaging and instance exposed.
May 17, 2017
13c9c6d
Version v1.5.0-alpha (#136)
prescottprue May 23, 2017
2b57b69
Roadmap updated. Pointed to correct version inside react-native example.
May 23, 2017
fd23aae
Merge branch 'master' into v2.0.0-alpha
prescottprue May 24, 2017
4bbb795
Material example working with new reducer setup. Logger added.
prescottprue May 24, 2017
a8c0c48
Merge branch 'master' into v1.5.0
May 30, 2017
6542913
v1.5.0-alpha.2 (#146)
prescottprue May 30, 2017
7940976
Version v1.5.0 Beta (#147)
prescottprue May 31, 2017
63587ec
Don't mix import/export with module.exports (#149)
martynovs May 31, 2017
0a02539
fix: unwatch events with same parameters as original watch (#151)
javamonn Jun 3, 2017
cfc3aba
Allow to use different stores in firebaseConnect (#148)
martynovs Jun 3, 2017
9d48234
Version v1.5.0 Beta 2 (#153)
prescottprue Jun 6, 2017
8e3f3d0
Version v1.5.0 Beta 3 (#154)
prescottprue Jun 6, 2017
cae1be8
Merge branch 'master' into v2.0.0-alpha
Jun 15, 2017
ff85858
Unused helpers removed. Moved creation of firebase instance to its ow…
Jun 15, 2017
c991311
Merge branch 'master' into v2.0.0-alpha
Jun 18, 2017
0a00620
Merge branch 'v1.5.0' into v2.0.0-alpha
Jun 18, 2017
b7f91ac
Support of passing in a firebase instance
Jun 20, 2017
af12928
Started work on populate.
Jun 20, 2017
b430f8d
Population working. Tests no longer have syntax errors.
Jun 20, 2017
63cb540
Version v2.0.0-alpha.
Jun 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Version v2.0.0-alpha.
* Basic Population working with new syntax (`populate`)
* Material example uses new syntax
* A firebase instance can be passed
* Unused helpers removed (populatedDataToJS, dataToJS, customToJS)
  • Loading branch information
Scott Prue committed Jun 20, 2017
commit 63cb540a90ed14ee3b195d7c12e66de5fac44473
75 changes: 41 additions & 34 deletions src/connect.js → src/createFirebaseConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,55 @@ import { watchEvents, unWatchEvents } from './actions/query'
import { getEventsFromInput, createCallable } from './utils'

/**
* @name firebaseConnect
* @extends React.Component
* @description Higher Order Component that automatically listens/unListens
* to provided firebase paths using React's Lifecycle hooks.
* @param {Array} watchArray - Array of objects or strings for paths to sync from Firebase. Can also be a function that returns the array. The function is passed the current props and the firebase object.
* @return {Function} - that accepts a component to wrap and returns the wrapped component
* @example <caption>Basic</caption>
* // this.props.firebase set on App component as firebase object with helpers
* import { firebaseConnect } from 'react-redux-firebase'
* export default firebaseConnect()(App)
* @name createFirebaseConnect
* @description WARNING!! Advanced feature, and only be used when needing to
* access a firebase instance created under a different store key
* @param {String} storeKey - Name of key of store to connect to (store that contains state.firebase)
* @return {Function} - that returns a firebaseConnect function, which is later used to wrap a component
* @example <caption>Data</caption>
* import { connect } from 'react-redux'
* import { firebaseConnect, dataToJS } from 'react-redux-firebase'
* import { createFirebaseConnect } from 'react-redux-firebase'
*
* // sync /todos from firebase into redux
* const fbWrapped = firebaseConnect([
* 'todos'
* ])(App)
* // sync /todos from firebase (in other store) into redux
* const fbWrapped = createFirebaseConnect('someOtherName')(['todos'])
*
* // pass todos list from redux as this.props.todosList
* export default connect(({ firebase }) => ({
* todosList: dataToJS(firebase, 'todos'),
* profile: pathToJS(firebase, 'profile'), // pass profile data as this.props.profile
* auth: pathToJS(firebase, 'auth') // pass auth data as this.props.auth
* }))(fbWrapped)
* @example <caption>Data that depends on props</caption>
* import { connect } from 'react-redux'
* import { firebaseConnect, dataToJS } from 'react-redux-firebase'
*
* // sync /todos from firebase into redux
* const fbWrapped = firebaseConnect((props, firebase) => ([
* `todos/${firebase.database().currentUser.uid}/${props.type}`
* ])(App)
*
* // pass todos list for the specified type of todos from redux as `this.props.todosList`
* export default connect(({ firebase, type }) => ({
* todosList: dataToJS(firebase, `data/todos/${firebase.getIn(['auth', 'uid'])}/${type}`),
* profile: pathToJS(firebase, 'profile'), // pass profile data as this.props.profile
* auth: pathToJS(firebase, 'auth') // pass auth data as this.props.auth
* export default connect(({ firebase: data: { todos }, auth, profile }) => ({
* todos,
* profile, // pass profile data as this.props.profile
* auth // pass auth data as this.props.auth
* }))(fbWrapped)
*/
export const createFirebaseConnect = (storeKey = 'store') => (dataOrFn = []) => WrappedComponent => {
/**
* @name firebaseConnect
* @extends React.Component
* @description Higher Order Component that automatically listens/unListens
* to provided firebase paths using React's Lifecycle hooks.
* @param {Array} watchArray - Array of objects or strings for paths to sync
* from Firebase. Can also be a function that returns the array. The function
* is passed the current props and the firebase object.
* @return {Function} - that accepts a component to wrap and returns the wrapped component
* @example <caption>Basic</caption>
* // this.props.firebase set on App component as firebase object with helpers
* import { firebaseConnect } from 'react-redux-firebase'
* export default firebaseConnect()(App)
* @example <caption>Data</caption>
* import { connect } from 'react-redux'
* import { firebaseConnect, dataToJS } from 'react-redux-firebase'
*
* // sync /todos from firebase into redux
* const fbWrapped = firebaseConnect([
* 'todos'
* ])(App)
*
* // pass todos list from redux as this.props.todosList
* export default connect(({ firebase: data: { todos }, auth, profile }) => ({
* todos,
* profile, // pass profile data as this.props.profile
* auth // pass auth data as this.props.auth
* }))(fbWrapped)
*/
class FirebaseConnect extends Component {
constructor (props, context) {
super(props, context)
Expand Down