alibaba / alibaba/rax

[BUG] <title> 分享微信小程序页面到朋友圈,不支持自定义title和imageUrl

Open
#2,425 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
8k
Forks
611
PR merge metrics
No merged PRs in 30d

Description

### ⌨️

- [ ] Would you like to work on a fix?

### Where is the bug from?

Rax Core

### Minimal code and steps to reproduce the bug

export default function ComicHome() {
const shareWechatMoments = () => {
return {
title: 'Play Intime~',
imageUrl: 'https://img2.baidu.com/it/u=3724468603,2892834211&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
};
}

addNativeEventListener('onShareTimeline', shareWechatMoments);
useEffect(() => {
return () => {
removeNativeEventListener('onShareTimeline', shareWechatMoments);
}
});
}
registerNativeEventListeners(ComicHome, ['onShareTimeline']);

### Current and expected behavior

onShareTimeline的回调函数返回一个对象,自定义title和imageUrl不生效

### Environment

"rax": "^1.2.0",
"rax-app": "3.8.14"

### build.json

_No response_

### Possible solution

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in Rax Core's handling of addNativeEventListener, registerNativeEventListeners, and the onShareTimeline callback. Reproduce the example with rax 1.2.0 and rax-app 3.8.14, then verify that the returned title and imageUrl are applied when sharing the WeChat mini-program page to Moments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.