Open NapChen opened 2 years ago
componentDidMount() { Alipay.setAlipayScheme('uiwjspay'); AppState.addEventListener('change', this._handleAppStateChange); } componentWillUnmount(){ AppState.removeEventListener('change', this._handleAppStateChange) } // [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'inactive' // [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'background' // [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'active' // [info][tid:com.facebook.react.JavaScript] 'nextAppState:res:', null _handleAppStateChange = (nextAppState) => { console.log('nextAppState:', nextAppState) if(nextAppState==='active'){ Linking.getInitialURL().then(res => { console.log('nextAppState:res:', res) }) } } aliPay = () => { // return_url= const payInfo = `...`; Alipay.alipay(payInfo, (resule) => { console.log('resule-->>>', resule) }); }
代码逻辑与这个一致,但是Android端在调起支付宝支付时,我的应用首先会进入background,在弹出支付宝支付界面时,会触发一次active状态(正常情况下不应该有),然后再次进入background,这会导致触发在_handleAppStateChange中的逻辑。我在接入微信支付时调起微信支付不存在这样的问题。另外此插件在iOS端也是正常的
background
active
_handleAppStateChange
代码逻辑与这个一致,但是Android端在调起支付宝支付时,我的应用首先会进入
background
,在弹出支付宝支付界面时,会触发一次active
状态(正常情况下不应该有),然后再次进入background
,这会导致触发在_handleAppStateChange
中的逻辑。我在接入微信支付时调起微信支付不存在这样的问题。另外此插件在iOS端也是正常的