Skip to content

Conversation

@HuangFeiPeng
Copy link

PR 描述

概述

此PR在UI组件的回调函数中添加了安全检查,以防止在将非函数类型传递给回调参数时出现运行时错误。

更改内容

对三个文件进行了修改,在回调函数执行前添加类型检查:

  1. packages/react-native-chat-uikit/src/biz/hooks/useCloseAlert.tsx - 添加 typeof onFinished === 'function' 检查
  2. packages/react-native-chat-uikit/src/biz/hooks/useCloseMenu.tsx - 添加 typeof onFinished === 'function' 检查
  3. packages/react-native-chat-uikit/src/ui/Modal/SlideModal.tsx - 添加 typeof onf === 'function' 检查,并恢复了有关性能优化的注释代码

动机

防止因传入非函数类型的回调参数而导致的运行时错误,提高组件的健壮性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant