ali322/CNodeRN

View on GitHub
__tests__/fixtures/container.js

Summary

Maintainability
A
0 mins
Test Coverage
import React, { Children } from 'react'
import PropTypes from 'prop-types'
import { wrapper,configureStore } from 'redux-container'
import reducers from '../../app/reducer'
import {combineReducers} from 'redux'

export default (initialState) => {
    const rootReducer = combineReducers(reducers)
    const store = configureStore(rootReducer)
    
    return Component => {
        return wrapper(store)(class extends React.Component {
            static childContextTypes = {
                userPrefs: PropTypes.object.isRequired,
                auth: PropTypes.object.isRequired
            }
            getChildContext() {
                return { auth: { isLogined: false }, userPrefs: { preferredTheme: 'default' } }
            }
            render() {
                return <Component {...this.props} actions={null}/>
            }
        })
    }
}