componentDidUpdate 未触发 - React Native

问题描述

在没有调用 txnToken .componentDidUpdate 之后,我想在 componentDidUpdate 内部调用 startRawTransaction。 获取 txtnToken ->

@H_502_2@initiateTransaction = () =>{ const data = { mid:mid,orderId:this.state.orderId,value:this.state.amount,custId:this.state.storeId } // console.log(data); this.props.dispatch({type:'INITIATE_TRANSACTION_API',data:data}) }

componentDidUpdate ->

@H_502_2@componentDidUpdate = (prevProps) => { console.log(this.props.isToken) if (prevProps.isToken !== this.props.isToken) { console.log('hi'); this.startRawTransaction } }

startTransaction 方法->

@H_502_2@startRawTransaction = ()=> { const orderId = this.state.orderId; const mid = MID; const tranxToken = this.props.txtnToken; const amount = this.state.amount; const isstaging = this.state.isstaging; const callbackurl = 'https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID='+orderId; const appInvokeRestricted = true; AllInOne@R_540_502[email protected]( orderId,mid,tranxToken,amount,callbackurl,isstaging,appInvokeRestricted,) .then((result) => { console.log("result",result); }) .catch((err) => { console.log(err) }); }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)