Skip to content

Commit

Permalink
upd: 升级 Taro 版本至 1.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
js-newbee committed Mar 5, 2019
1 parent c3dda86 commit 34c84df
Show file tree
Hide file tree
Showing 11 changed files with 1,114 additions and 182 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CHANGELOG

## 1.1.0 (2010-03-05)

* 升级 Taro 至 1.2.15 版本
* 去掉 RN 绑定 onClick 时的样式兼容处理 [issue](https://github.com/NervJS/taro/issues/2205)
* 修改根据不同环境引入不同组件的写法 (./src/pages/webview)

## 1.0.0 (2019-02-20)

* 正式开源
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
本项目直接调用的网易严选接口,若要体验登录、购物车功能,请使用网易邮箱账号登录。

``` bash
# 全局安装 @tarojs/cli 指定版本,或 npm install -g @tarojs/cli@1.2.13
yarn global add @tarojs/cli@1.2.13

# 安装依赖,或 npm i
yarn

Expand All @@ -41,8 +38,8 @@ npm run dev:h5

# 运行 React Native,有如下注意事项:
# 1. 基于 Expo,运行说明:https://nervjs.github.io/taro/docs/react-native.html
# 2. 首次运行可能会报错,参见 issue:https://github.com/NervJS/taro/issues/2121
# 3. 当前只适配了 375px 屏幕,若用 iOS 模拟器打开的不是 iPhone 6/7/8,可点击顶部菜单 Hardware -> iOS xx 切换设备
# 2. 当前只适配了 375px 屏幕,若用 iOS 模拟器打开的不是 iPhone 6/7/8,可点击顶部菜单 Hardware -> iOS xx 切换设备
# 3. 首次运行会报错,请手动添加 fbjs 依赖:cd ./.rn_temp && yarn add fbjs
npm run dev:rn
```

Expand Down
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taro-yanxuan",
"version": "1.0.0",
"version": "1.1.0",
"private": true,
"description": "Taro 多端实践之网易严选(微信小程序 + H5 + React Native)",
"scripts": {
Expand All @@ -20,18 +20,18 @@
"author": "js-newbee",
"license": "MIT",
"dependencies": {
"@tarojs/async-await": "1.2.13",
"@tarojs/components": "1.2.13",
"@tarojs/redux": "1.2.13",
"@tarojs/redux-h5": "1.2.13",
"@tarojs/rn-runner": "1.2.13",
"@tarojs/router": "1.2.13",
"@tarojs/taro": "1.2.13",
"@tarojs/taro-alipay": "1.2.13",
"@tarojs/taro-h5": "1.2.13",
"@tarojs/taro-swan": "1.2.13",
"@tarojs/taro-tt": "1.2.13",
"@tarojs/taro-weapp": "1.2.13",
"@tarojs/async-await": "1.2.15",
"@tarojs/components": "1.2.15",
"@tarojs/redux": "1.2.15",
"@tarojs/redux-h5": "1.2.15",
"@tarojs/rn-runner": "1.2.15",
"@tarojs/router": "1.2.15",
"@tarojs/taro": "1.2.15",
"@tarojs/taro-alipay": "1.2.15",
"@tarojs/taro-h5": "1.2.15",
"@tarojs/taro-swan": "1.2.15",
"@tarojs/taro-tt": "1.2.15",
"@tarojs/taro-weapp": "1.2.15",
"blueimp-md5": "^2.10.0",
"nerv-devtools": "^1.3.9",
"nervjs": "^1.3.9",
Expand All @@ -40,11 +40,12 @@
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@tarojs/plugin-babel": "1.2.13",
"@tarojs/plugin-csso": "1.2.13",
"@tarojs/plugin-sass": "1.2.13",
"@tarojs/plugin-uglifyjs": "1.2.13",
"@tarojs/webpack-runner": "1.2.13",
"@tarojs/cli": "1.2.15",
"@tarojs/plugin-babel": "1.2.15",
"@tarojs/plugin-csso": "1.2.15",
"@tarojs/plugin-sass": "1.2.15",
"@tarojs/plugin-uglifyjs": "1.2.15",
"@tarojs/webpack-runner": "1.2.15",
"@types/react": "^16.4.8",
"@types/webpack-env": "^1.13.6",
"babel-eslint": "^8.2.3",
Expand All @@ -55,9 +56,9 @@
"babel-preset-env": "^1.6.1",
"cross-env": "^5.2.0",
"eslint": "^4.19.1",
"eslint-config-taro": "1.2.13",
"eslint-config-taro": "1.2.15",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-taro": "1.2.13"
"eslint-plugin-taro": "1.2.15"
}
}
5 changes: 1 addition & 4 deletions src/components/item-list/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
display: flex;
flex-direction: column;
padding: 0 15px 48px;

/* TODO RN 的 Clickable 处理有问题,暂时用 flex-basis 实现 width */
@include eject(width, 50%);
flex-basis: 50%;
width: 50%;

&-img {
width: 330px;
Expand Down
5 changes: 1 addition & 4 deletions src/pages/home/recommend/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
display: flex;
flex-direction: column;
padding: 0 15px 40px;

// TODO RN 的 Clickable 处理有问题,暂时用 flex-basis 实现 width
@include eject(width, 50%);
flex-basis: 50%;
width: 50%;

&-desc {
padding: 0 12px;
Expand Down
8 changes: 1 addition & 7 deletions src/pages/user/menu/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@
flex-direction: column;
justify-content: center;
align-items: center;
width: 33.3%;
height: 180px;
@include border(right bottom, 1px, solid, rgba(0, 0, 0, .15));

/**
* // TODO RN 中的 View 是没有 onClick 事件的,Taro 做了兼容处理,但对样式处理尚有问题
* 暂时通过 flex-basis 实现 width 效果
*/
@include eject(width, 33.3%);
flex-basis: 33.3%;

&-img {
width: 52px;
height: 52px;
Expand Down
2 changes: 0 additions & 2 deletions src/pages/user/profile/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ $avatarSize: 140px;
flex: 1;
display: flex;
flex-direction: column;
// TODO RN 的 Clickable 处理有问题,此处实际上不需要 justify-content
justify-content: center;
margin-left: 30px;

&-name {
Expand Down
3 changes: 0 additions & 3 deletions src/pages/user/user.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
color: #333;
font-size: 28px;
line-height: 28px;
// TODO RN 的 Clickable 处理有问题,暂时加 width 解决 */
width: 100%;
text-align: center;
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/pages/webview/webview.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Taro, { Component } from '@tarojs/taro'
import { View, WebView } from '@tarojs/components'
import './webview.scss'

/**
* // NOTE Taro 的 RN 端还未提供 WebView 组件,这种情况需要自己根据环境引入原生组件
* 要注意引入写法,按如下方式才行,这样只会在相应环境引入,其他环境不会引入
* // NOTE Taro 的 RN 端还未提供 WebView 组件,可以引入原生组件来解决
* Taro 有开启了 tree shaking,对于未用到的内容编译时会自动去除
* 因此把相应端的内容都 import 进来,再根据环境进行调用即可
*/
const WebViewRN = process.env.TARO_ENV === 'rn' ? require('./rn').default : null
import WebViewRN from './rn'
import './webview.scss'

export default class extends Component {
config = {
Expand All @@ -25,6 +25,7 @@ export default class extends Component {
render () {
return (
<View className='webview'>
{/* // NOTE 编译时只会保留相应端的内容,因此非 RN 端时不会编译 WebViewRN */}
{process.env.TARO_ENV === 'rn' ?
<WebViewRN src={this.url} /> :
<WebView src={this.url} />
Expand Down
Loading

0 comments on commit 34c84df

Please sign in to comment.