Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Taro3 beta1] useShareAppMessage callback 函数初次设置后无法更新. #5837

Closed
cncolder opened this issue Mar 29, 2020 · 3 comments
Closed
Assignees
Milestone

Comments

@cncolder
Copy link
Contributor

问题描述

useShareAppMessage 有时候需要等待异步 API 返回的数据才能决定分享标题和链接, 这个 hook 现在没有第二个 deps 参数, 而 hook 又是不能条件跳过的.

复现步骤

    const { data } = useAsync(...)

    useShareAppMessage(e => {
        return {
            title: data.title || '默认标题',
            path: `/pages/group/join?id=${data.id}`,
        }
    })

期望行为

分享返回值无法动态更新.

报错信息

系统信息

taro 3.0.0-beta.1

补充信息

重写了一个临时的 hook 供项目使用, 不管3721强制覆盖.

export const useShareAppMessage = (callback: (e: Taro.ShareAppMessageObject) => Taro.ShareAppMessageReturn) => {
    if (!Taro.Current.page) return

    Taro.Current.page.onShareAppMessage = callback
}

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Mar 29, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Mar 29, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@liu-jin-yi
Copy link

@Chen-jj hello 这个问题请问有结论了吗?或者有什么替代方案吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants