[BUG] 无法获取最新的ref
Opened this issue · 0 comments
canvascat commented
- I'm sure this does not appear in the issue list of the repository
Basic Info
- Package Name And Version: @arco-design/mobile-react@2.32.0
- Phone Model And Version: any
- Reproduction Link: https://codesandbox.io/p/sandbox/8g86yn
打开popup后,调用方法获取ref,返回的popupRef.current不是最新的,全是null
建议调整写法:
useImperativeHandle(
ref,
() => ({
get dom() {
return maskingRef.current?.dom ?? null;
},
get content() {
return maskingRef.current?.content ?? null;
},
get mask() {
return maskingRef.current?.mask ?? null;
},
setCloseScene(scene: string) {
maskingRef.current?.setCloseScene(scene);
},
}),
[],
);
类似的问题还有很多:
arco-design-mobile/packages/arcodesign/components/avatar/group.tsx
Lines 37 to 39 in d4f1119
arco-design-mobile/packages/arcodesign/components/avatar/index.tsx
Lines 51 to 53 in d4f1119
.....