native-wechat icon indicating copy to clipboard operation
native-wechat copied to clipboard

It just return undefined if wechat not installed

Open meooxx opened this issue 3 years ago • 1 comments

Is it possible to return a more specific message or error?

const res = await shareText({
text: 'text',
scene: NativeWechatConstants.WXSceneSession
}).catch(e=>{
  console.log(e) // e == undefined
})
// res == undefined

ps: there's a mistake in your demonstrate

import {registerApp} from 'native-wechat';

useEffect(()=>{
         // `registerApp` should accept a request-type argument
         // the blow code causes the crash, It makes me  almost give up
        // and the right way is registerApp({appId:'wx964290141ebe9b7b'})
	return registerApp('wx964290141ebe9b7b');
}, [])

Would you like to add some argument checks or catch errors in case of an app crash?

meooxx avatar Dec 20 '22 02:12 meooxx

Sure, I'll try.

Hector-Zhuang avatar Dec 20 '22 15:12 Hector-Zhuang