This commit is contained in:
筱野
2025-10-12 22:53:05 +08:00
2 changed files with 36 additions and 64 deletions

View File

@@ -60,6 +60,8 @@ const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
const inputDomRef = useRef(null);
const [adjust, setAdjust] = useState(false);
useImperativeHandle(ref, () => ({
show: (_params: CommentInputReplyParamsType | undefined) => {
setVisible(true);
@@ -82,6 +84,7 @@ const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
function onClose() {
setVisible(false);
setValue("");
setAdjust(false);
inputDomRef.current && inputDomRef.current?.blur();
}
return (
@@ -91,20 +94,30 @@ const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
hideFooter
zIndex={1002}
onClose={onClose}
style={{ height: "60px!important", minHeight: "unset" }}
style={{
height: "60px!important",
minHeight: "unset",
}}
enableDragToClose={false}
>
<View className={styles.inputContainer}>
<View className={styles.inputWrapper}>
<Input
adjustPosition={adjust}
ref={inputDomRef}
className={styles.input}
value={value}
onInput={(e) => setValue(e.detail.value)}
cursorSpacing={20}
placeholder={
params?.reply_to_user_id ? `回复 @${params.nickname}` : "写评论"
}
focus
onFocus={() => {
setTimeout(() => {
setAdjust(true);
}, 10);
}}
maxlength={100}
/>
</View>