Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createStoreInjector (grabStoresFn, injectNames, sourceComponent) {
class Injector extends Component {
static isMobxInjector = true
static config = sourceComponent.config || {}
static displayName = getInjectName(sourceComponent, injectNames)
__observeInstance
render () {
const originProps = mapStoreToProps(grabStoresFn, this.props)
return createElement(sourceComponent, {
...originProps,
ref: ref => {
originProps.ref && originProps.ref(ref)
if (ref) {
this.__observeInstance = ref
}
}
})
}
componentDidShow () {
function createStoreInjector (grabStoresFn, injectNames, sourceComponent) {
class Injector extends Component {
static isMobxInjector = true
static config = sourceComponent.config || {}
static displayName = getInjectName(sourceComponent, injectNames)
__observeInstance
render () {
const originProps = mapStoreToProps(grabStoresFn, this.props)
return createElement(sourceComponent, {
...originProps,
ref: ref => {
originProps.ref && originProps.ref(ref)
if (ref) {
this.__observeInstance = ref
}
}
})
}
componentDidShow () {
function createStoreInjector (grabStoresFn, injectNames, Component) {
class Injector extends Component {
static isMobxInjector = true
static displayName = getInjectName(Component, injectNames)
constructor (props, isPage) {
super(Object.assign(...arguments, mapStoreToProps(grabStoresFn, props)), isPage)
}
_constructor () {
Object.assign(this.props, mapStoreToProps(grabStoresFn, this.props))
super._constructor && super._constructor(this.props)
}
}
return Injector
}