How to use the @tarojs/mobx-common.getInjectName function in @tarojs/mobx-common

To help you get started, we’ve selected a few @tarojs/mobx-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-mobx-rn / src / inject.js View on Github external
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 () {
github NervJS / taro / packages / taro-mobx-h5 / src / inject.js View on Github external
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 () {
github NervJS / taro / packages / taro-mobx / src / inject.js View on Github external
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
}