Skip to content

Commit

Permalink
Merge branches 'master' and 'master' of github.com:NervJS/taro
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Jan 8, 2019
2 parents 2eaf122 + 28273d7 commit 0f5166b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/taro-components/src/components/input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Input extends Nerv.Component {
value: { value }
})
// 修复 IOS 光标跳转问题
if (inputType !== 'number') {
if (!['number', 'file'].includes(inputType)) {
const pos = e.target.selectionEnd
setTimeout(
() => {
Expand Down
14 changes: 0 additions & 14 deletions packages/taro-mobx-common/src/createProvider.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/taro-mobx-common/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { observer } from './observer'

export { inject } from './inject'
export { createProvider } from './createProvider'
export { setStore } from './store'
14 changes: 14 additions & 0 deletions packages/taro-mobx-h5/Provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Children } from 'nervjs'
import { Component } from '@tarojs/taro-h5'
import { setStore } from '@tarojs/mobx-common'

export default class Provider extends Component {
constructor (props) {
super(props)
setStore(props.store)
}

render () {
return Children.only(this.props.children)
}
}
8 changes: 4 additions & 4 deletions packages/taro-mobx-h5/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component } from '@tarojs/taro-h5'
import { createElement, Children } from 'nervjs'
import { createProvider, inject as originInject } from '@tarojs/mobx-common'
import { createElement } from 'nervjs'
import { inject as originInject } from '@tarojs/mobx-common'

export function inject () {
return originInject(...arguments, { Component, createElement })
}

export const Provider = createProvider(Component, Children)

export { observer } from '@tarojs/mobx-common'

export { default as Provider } from './Provider'
14 changes: 14 additions & 0 deletions packages/taro-mobx-rn/Provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Children } from 'react'
import { Component } from '@tarojs/taro-rn'
import { setStore } from '@tarojs/mobx-common'

export default class Provider extends Component {
constructor (props) {
super(props)
setStore(props.store)
}

render () {
return Children.only(this.props.children)
}
}
8 changes: 4 additions & 4 deletions packages/taro-mobx-rn/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component } from '@tarojs/taro-rn'
import { Children, createElement } from 'react'
import { createProvider, inject as originInject } from '@tarojs/mobx-common'
import { createElement } from 'react'
import { inject as originInject } from '@tarojs/mobx-common'

export function inject () {
return originInject(...arguments, { Component, createElement })
}

export const Provider = createProvider(Component, Children)

export { observer } from '@tarojs/mobx-common'

export { default as Provider } from './Provider'
2 changes: 0 additions & 2 deletions packages/taro-transformer-wx/src/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,6 @@ class Transformer {
this.componentProperies,
this.loopRefs
).outputTemplate
} else {
throw codeFrameError(this.classPath.node.loc, '没有定义 render 方法')
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/taro-transformer-wx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prettyPrint } from 'html'
import { transform as parse } from 'babel-core'
import * as ts from 'typescript'
import { Transformer } from './class'
import { setting, findFirstIdentifierFromMemberExpression, isContainJSXElement, codeFrameError, isArrayMapCallExpression } from './utils'
import { setting, findFirstIdentifierFromMemberExpression, isContainJSXElement, codeFrameError, isArrayMapCallExpression, pathResolver } from './utils'
import * as t from 'babel-types'
import { DEFAULT_Component_SET, INTERNAL_SAFE_GET, TARO_PACKAGE_NAME, REDUX_PACKAGE_NAME, MOBX_PACKAGE_NAME, IMAGE_COMPONENTS, INTERNAL_INLINE_STYLE, THIRD_PARTY_COMPONENTS, INTERNAL_GET_ORIGNAL, setLoopOriginal, GEL_ELEMENT_BY_ID } from './constant'
import { Adapters, setAdapter, Adapter } from './adapter'
Expand Down Expand Up @@ -241,7 +241,7 @@ export default function transform (options: Options): TransformResult {
if (bindingPath.isImportDeclaration()) {
const source = bindingPath.node.source
try {
const p = fs.existsSync(source.value + '.js') ? source.value + '.js' : source.value + '.tsx'
const p = pathResolver(source.value, options.sourcePath) + (options.isTyped ? '.js' : '.js')
const code = fs.readFileSync(p, 'utf8')
componentProperies = transform({
isRoot: false,
Expand Down

0 comments on commit 0f5166b

Please sign in to comment.