Skip to content

Commit

Permalink
feat: add useShareTimeline hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yeojongki authored and luckyadam committed Jul 14, 2020
1 parent 3d2c3e3 commit 03e3196
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/taro-weapp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
useResize,
useShareAppMessage,
useTabItemTap,
useShareTimeline,
useRouter,
useScope,
useRef,
Expand Down Expand Up @@ -79,6 +80,7 @@ export const Taro = {
useResize,
useShareAppMessage,
useTabItemTap,
useShareTimeline,
useRouter,
useScope,
useRef,
Expand Down
4 changes: 4 additions & 0 deletions packages/taro/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export function useTabItemTap (callback) {
usePageLifecycle(callback, 'onTabItemTap')
}

export function useShareTimeline (callback) {
usePageLifecycle(callback, 'onShareTimeline')
}

export function useRouter () {
const hook = getHooks(Current.index++)
if (!hook.router) {
Expand Down
4 changes: 4 additions & 0 deletions packages/taro/types/taro.hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ declare namespace Taro {
* 点击 tab 时触发
*/
function useTabItemTap (callback: (obj: TabItemTapObject) => any)
/**
* 监听右上角菜单“分享到朋友圈”按钮的行为,并自定义发享内容。
*/
function useShareTimeline (callback: () => ShareTimelineReturn)
/**
* 获取页面传入路由相关参数
*/
Expand Down

0 comments on commit 03e3196

Please sign in to comment.