Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/taro-plugin-react/src/runtime/connect-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,21 @@ export function createNativeComponentConfig (Component, react: typeof React, rea
}
}

if (process.env.TARO_ENV === 'alipay') {
/**
* 支付宝需要修改生命周期 同时宿主需要开启component2
* 如果不开启 props对象中的函数参数会被忽略 导致无法调用
* @see https://opendocs.alipay.com/mini/03dbc3#compileOptions
* @returns
*/
componentObj.onInit = componentObj.created
componentObj.didMount = componentObj.attached
componentObj.didUpdate = function () {
this.data.props = this.props.props
this?.component?.forceUpdate?.()
}
componentObj.didUnmount = componentObj.detached
}
return componentObj
}

Expand Down