Skip to content

Commit

Permalink
chore(rn): 优化 taro-rn 目录结构
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Apr 18, 2019
1 parent e1850a3 commit 46f7915
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 71 deletions.
7 changes: 7 additions & 0 deletions packages/taro-components-rn/.expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null
}
3 changes: 3 additions & 0 deletions packages/taro-rn/example/pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react'
import Taro, { Component } from '@tarojs/taro-rn'
import { View, Text, StyleSheet, Button } from 'react-native'
import { chooseImage } from '../../../src/api/image'
import * as toast from '../../../src/api/interface'

console.log('toast', toast)

const styles = StyleSheet.create({
index: {
Expand Down
57 changes: 0 additions & 57 deletions packages/taro-rn/src/api/WxPreviewImage/index.js

This file was deleted.

4 changes: 3 additions & 1 deletion packages/taro-rn/src/api/interface/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export {showActionSheet} from './showActionSheet'
export { showActionSheet } from './showActionSheet'
export { showModal } from './showModal'
export { showLoading, showToast, hideToast, hideLoading } from './toast'
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ function showModal (obj) {
}
}

export default {showModal}
export { showModal }
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function showToast (options) {
console.error(res.errMsg)
return Promise.reject(res)
}

const res = {errMsg: 'showToast:ok'}
let {title = '', icon = 'success', image, duration = 1500, mask, success, fail, complete} = options || {} // eslint-disable-line
let source
Expand Down Expand Up @@ -156,11 +156,13 @@ function hideToast () {
global.wxToastRootSiblings = undefined
}

wx = {
function hideLoading () {
hideToast()
}

export {
showToast,
showLoading,
hideToast,
hideLoading: hideToast
hideLoading
}

export default wx
10 changes: 3 additions & 7 deletions packages/taro-rn/src/native-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import others from './api/others'
// import file from './api/file'
import webSocket from './api/webSocket'
// import geolocation from './api/geolocation'
import toast from './api/WxToast'
import showModal from './api/WxModal'
import { showActionSheet } from './api/interface'
import { previewImage } from './api/image'
import * as toast from './api/interface'
import * as image from './api/image'
import web from './api/web'

function processApis (taro) {
Expand Down Expand Up @@ -57,9 +55,7 @@ export default function initNativeApi (taro) {
webSocket,
// geolocation,
toast,
showModal,
showActionSheet,
previewImage,
image,
others
)
}

0 comments on commit 46f7915

Please sign in to comment.