Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NervJS/taro
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Dec 14, 2018
2 parents 9e1864d + 7eed26c commit 231e654
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 64 deletions.
2 changes: 1 addition & 1 deletion docs/config-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ import Utils from '../../utils'

```js
alias: {
'@components': path.resolve(__dirname, '..', 'src/components')
'@components': path.resolve(__dirname, '..', 'src/components'),
'@utils': path.resolve(__dirname, '..', 'src/utils')
}
```
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-rn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Alo, alo! Bilibilibilibibili~

> 由于在开发环境中用到 `create-react-native-app` 的模式,所以**务必**`dependencies` 的方式安装 `react-native``expo`,查看例子期间,务必保证它们待在 `dependencies` 下哦。
>
> 设置 package.json 中的 `main``./node_modules/react-native-scripts/build/bin/crna-entry.js`
> 设置 package.json 中的 `main``node_modules/expo/AppEntry.js`
- [Expo版本清单](https://expo.io/--/api/v2/versions),这里可以看到每个版本Expo对应的版本关系,**这很重要**

Expand Down
7 changes: 3 additions & 4 deletions packages/taro-components-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"test": "jest --coverage",
"prepare": "npm run build",
"test-update": "jest --updateSnapshot",
"start": "react-native-scripts start",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios"
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios"
},
"files": [
"dist"
Expand Down Expand Up @@ -72,7 +72,6 @@
"pre-commit": "^1.2.2",
"react": "^16.4.1",
"react-native-mock-render": "0.0.25",
"react-native-scripts": "^1.14.0",
"react-test-renderer": "^16.2.0",
"sinon": "^6.0.0",
"tsc-watch": "^1.0.30",
Expand Down
11 changes: 7 additions & 4 deletions packages/taro-components-rn/src/components/_Clickable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ export default function (WrappedComponent: React.ComponentType<*>) {
onTouchend && onTouchend(this.getWxAppEvent(evt))
const endTimestamp = evt.nativeEvent.timestamp
const gapTime = endTimestamp - this.startTimestamp
if (gapTime <= 350) {
onClick && onClick(this.getWxAppEvent(evt))
} else {
onLongPress && onLongPress(this.getWxAppEvent(evt))
const hasMove = Math.abs(gestureState.dx) >= 1 || Math.abs(gestureState.dy) >= 1
if (!hasMove) {
if (gapTime <= 350) {
onClick && onClick(this.getWxAppEvent(evt))
} else {
onLongPress && onLongPress(this.getWxAppEvent(evt))
}
}
this.setStayTimer()
},
Expand Down
8 changes: 2 additions & 6 deletions packages/taro-components/types/Checkbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { ComponentType } from 'react'
import { StandardProps, BaseEventFunction } from './common'
import { StandardProps, BaseEventFunction, FormItemProps } from './common'

interface CheckboxGroupProps extends StandardProps {
/**
* 表单组件中加上 name 来作为 key
*/
name: string;
interface CheckboxGroupProps extends StandardProps, FormItemProps {
/**
* <checkbox-group/>中选中项发生改变是触发 change 事件
*
Expand Down
7 changes: 0 additions & 7 deletions packages/taro-components/types/MovableView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ interface MovableViewProps extends StandardProps {
*/
scaleValue?: number,

/**
* 是否使用动画
*
* 默认值: true
*/
animation?: boolean,

/**
* 拖动过程中触发的事件,event.detail = `{x: x, y: y, source: source}`,其中source表示产生移动的原因,值可为touch(拖动)、touch-out-of-bounds(超出移动范围)、out-of-bounds(超出移动范围后的回弹)、friction(惯性)和空字符串(setData)
*
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Picker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ interface PickerRegionProps extends PickerStandardProps {
/**
* 仅当 mode = region 时有效,可为每一列的顶部添加一个自定义的项
*/
customItem: string
customItem?: string
}

declare const Picker: ComponentType<
Expand Down
8 changes: 2 additions & 6 deletions packages/taro-components/types/Radio.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { ComponentType } from 'react'
import { StandardProps, BaseEventFunction } from './common'
import { StandardProps, BaseEventFunction, FormItemProps } from './common'

interface RadioGroupProps extends StandardProps {
/**
* 表单组件中加上 name 来作为 key
*/
name: string;
interface RadioGroupProps extends StandardProps, FormItemProps {
onChange?: BaseEventFunction
}

Expand Down
2 changes: 1 addition & 1 deletion packages/taro-webpack-runner/src/config/dev.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function (config: Partial<BuildConfig>): any {
output = emptyObj,
sourceRoot = '',
outputRoot,
publicPath,
publicPath = '',
staticDirectory = 'static',
chunkDirectory = 'chunk',

Expand Down
12 changes: 7 additions & 5 deletions packages/taro-webpack-runner/src/config/prod.conf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';

import { addLeadingSlash, addTrailingSlash, appPath, emptyObj } from '../util';
import { addTrailingSlash, appPath, emptyObj } from '../util';
import {
getCssoWebpackPlugin,
getDefinePlugin,
Expand All @@ -18,15 +18,15 @@ import {
import { BuildConfig } from '../util/types';
import getBaseChain from './base.conf';

export default function (config: BuildConfig): any {
export default function (config: Partial<BuildConfig>): any {
const chain = getBaseChain()
const {
alias = emptyObj,
entry = emptyObj,
output = emptyObj,
sourceRoot = '',
outputRoot,
publicPath,
publicPath = '',
staticDirectory = 'static',
chunkDirectory = 'chunk',
dllDirectory = 'lib',
Expand Down Expand Up @@ -57,7 +57,9 @@ export default function (config: BuildConfig): any {
module = {
postcss: emptyObj
},
plugins
plugins = {
babel: {}
}
} = config

const plugin: any = {}
Expand Down Expand Up @@ -121,7 +123,7 @@ export default function (config: BuildConfig): any {
entry: getEntry(entry),
output: getOutput([{
outputRoot,
publicPath: addLeadingSlash(addTrailingSlash(publicPath)),
publicPath: addTrailingSlash(publicPath),
chunkDirectory
}, output]),
resolve: { alias },
Expand Down
3 changes: 1 addition & 2 deletions packages/taro-webpack-runner/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ const buildProd = (config: BuildConfig): Promise<void> => {
const buildDev = async (config: BuildConfig): Promise<any> => {
return new Promise((resolve, reject) => {
const conf = buildConf(config)
conf.publicPath = addLeadingSlash(addTrailingSlash(conf.publicPath))
const publicPath = conf.publicPath
const publicPath = conf.publicPath ? addLeadingSlash(addTrailingSlash(conf.publicPath)) : '/'
const outputPath = path.join(appPath, conf.outputRoot as string)
const customDevServerOption = config.devServer || {}
const webpackChain = devConf(config)
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-webpack-runner/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ const recursiveMerge = (src, ...args) => {
})
}

const isNpmPackage = name => !/^(\.|\/)/.test(name)
const isNpmPackage = (name: string) => !/^(\.|\/)/.test(name)

const addLeadingSlash = path => path.charAt(0) === '/' ? path : '/' + path
const addTrailingSlash = path => path.charAt(path.length - 1) === '/' ? path : path + '/'
const addLeadingSlash = (url: string) => url.charAt(0) === '/' ? url : '/' + url
const addTrailingSlash = (url: string) => url.charAt(url.length - 1) === '/' ? url : url + '/'

export {
appPath,
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-with-weapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"test": "jest",
"build": "rollup -c rollup.config.js",
"dev": "rollup -c -w rollup.config.js"
"dev": "rollup -c -w rollup.config.js",
"tsc": "tsc"
},
"files": [
"dist",
Expand All @@ -21,8 +22,8 @@
"author": "yuche",
"license": "MIT",
"dependencies": {
"@tarojs/taro": "1.2.0-beta.15",
"lodash.isequal": "^4.5.0"
"@tarojs/taro": "1.2.0-beta.14",
"lodash": "^4.17.11"
},
"devDependencies": {
"@types/jest": "^22.2.3",
Expand All @@ -31,6 +32,7 @@
"jest": "^23.0.1",
"jest-cli": "^22.1.4",
"rollup": "^0.66.2",
"rollup-plugin-buble": "^0.19.6",
"rollup-plugin-typescript2": "^0.17.0",
"ts-jest": "^22.4.6",
"tslint": "^5.10.0",
Expand Down
18 changes: 2 additions & 16 deletions packages/taro-with-weapp/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { join } = require('path')
const resolve = require('rollup-plugin-node-resolve')
const babel = require('rollup-plugin-babel')
const buble = require('rollup-plugin-buble')
const common = require('rollup-plugin-commonjs')
const alias = require('rollup-plugin-alias')
const typescript = require('rollup-plugin-typescript2')
Expand Down Expand Up @@ -35,21 +35,7 @@ const baseConfig = {
common({
include: 'node_modules/**'
}),
babel({
babelrc: false,
presets: [
['@babel/preset-env', {
modules: false
}]
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
['@babel/plugin-transform-react-jsx', {
'pragma': 'Nerv.createElement'
}]
]
})
buble()
]
}
const esmConfig = Object.assign({}, baseConfig, {
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-with-weapp/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
Component,
ComponentLifecycle,
internal_safe_set as safeSet
ComponentLifecycle
} from '@tarojs/taro'
import isEqual from 'lodash.isequal'
import isEqual from 'lodash/isEqual'
import safeSet from 'lodash/set'

type WeappLifeCycle = () => void
type Observer = (newProps, oldProps, changePath: string) => void
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-with-weapp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es2015",
"module": "ES2015",
"removeComments": false,
"preserveConstEnums": true,
Expand Down

0 comments on commit 231e654

Please sign in to comment.