Sharing is unresponsive when using React-Native-Wechat components

problem description

if the APP project uses React Native, you need to use the Wechat sharing interface, and then use the react-native-wechat build. Two modules in the project, a product list module and a document list module, can be shared. Now there is a very strange problem, that is, the sharing of the document module can be opened and shared by Wechat. But the sharing of the product module is always unresponsive

.

related codes

the code for the sharing operation is as follows:

WeChat.isWXAppInstalled().then((isInstalled) => {
    console.log("isInstalled:" + isInstalled);
    //
    if(isInstalled){
        WeChat.isWXAppSupportApi().then((isSupportApi) => {
            console.log("isSupportApi:" + isSupportApi);
            //
            if(isSupportApi){
                var shareData = {
                    type: "news",
                    title: Share_reducers.ShareName,
                    description: Share_reducers.description?Share_reducers.description:""+Login_reducers.userInfo.CompanyName+"",
                    webpageUrl: Share_reducers.emailUrl+"&logId="+res+"&shareType=1",
                    thumbImage: thumb,
                };
                console.log("-----------------------------------------------------------------");
                console.log(JSON.stringify(shareData));
                console.log("-----------------------------------------------------------------");
                //
                WeChat.shareToSession(shareData).then(res=>{
                    console.log("......shared........");
                    dispatch({
                        type: "hide",
                    });
                    msg("");
                }).catch(res=>{
                    console.log("......error........");
                    console.log(JSON.stringify(res));
                    msg("");
                    dispatch({
                        type: "hide",
                    });
                }).finally(function() {
                    console.log("finally..................................");
                    console.log(JSON.stringify(arguments));
                });
            }else{
                msg( "" );
                dispatch({
                    type: "hide",
                });
            }
        });
    }else{
        msg( "" );
        dispatch({
            type: "hide",
        });
    }
});

when using Android debugging, the document sharing print log is as follows:

07-11 14:45:31.926: I/ReactNativeJS(10950): isInstalled:true
07-11 14:45:31.965: I/ReactNativeJS(10950): isSupportApi:true
07-11 14:45:31.965: I/ReactNativeJS(10950): -----------------------------------------------------------------
07-11 14:45:31.965: I/ReactNativeJS(10950): {"type":"news","title":"&","description":"","webpageUrl":"http://admin.zsgc.online/zhizaohui/file_list.html?shareId=B504144231070969&id=298&shareFileType=1&platform=app&logId=1958&shareType=1","thumbImage":"https://img.codeshelper.com/upload/img/2021/03/27/ygzqkgejh3s13578.png"}
07-11 14:45:31.965: I/ReactNativeJS(10950): -----------------------------------------------------------------
07-11 14:46:24.131: I/ReactNativeJS(10950): ......shared........
07-11 14:46:24.167: I/ReactNativeJS(10950): finally..................................
07-11 14:46:24.167: I/ReactNativeJS(10950): {}

the product sharing log is as follows:

07-11 14:46:56.919: I/ReactNativeJS(10950): isInstalled:true
07-11 14:46:56.958: I/ReactNativeJS(10950): isSupportApi:true
07-11 14:46:56.959: I/ReactNativeJS(10950): -----------------------------------------------------------------
07-11 14:46:56.959: I/ReactNativeJS(10950): {"type":"news","title":"Dyson","description":"","webpageUrl":"http://admin.zsgc.online/zhizaohui/product_center.html?shareId=B504144231070969&id=171&type=1&platform=app&logId=1959&shareType=1","thumbImage":"https://img.codeshelper.com/upload/img/2021/03/27/ctkcfz2fyrj13579.png"}
07-11 14:46:56.959: I/ReactNativeJS(10950): -----------------------------------------------------------------

ask the great god for help to see how to solve

Mar.28,2021

found the reason. It turns out that the thumbImage is too large when sharing, which is basically above 700KB. Use nginx's http_image_filter_module to deal with pictures when sharing. If you use third-party image storage, such as Aliyun OSS, you can provide corresponding processing features such as: domain name / sample.jpg?x-oss-process=style/stylename, which can be configured on the Aliyun console

.
Menu