Hector-Chong / native-wechat

A React Native library for supporting Wechat APIs on Android and iOS

Home Page:https://native-wechat.hector.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It just return undefined if wechat not installed

meooxx opened this issue · 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?

Sure, I'll try.