|
|
@@ -2,13 +2,13 @@ import Taro from "@tarojs/taro";
|
|
|
import { useEffect, useState, useCallback } from "react";
|
|
|
import { useAppStore } from "@/store/appStore";
|
|
|
export const useKeyboard = (scrollViewRef: React.MutableRefObject<any>, contentId: string, scrollViewId: string ) => {
|
|
|
-
|
|
|
+
|
|
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
|
const [contentHeight, setContentHeight] = useState(0);
|
|
|
const [scrollViewHeight, setScrollViewHeight] = useState(0);
|
|
|
const [updateTrigger, setUpdateTrigger] = useState(0);
|
|
|
const bottomSafeHeight = useAppStore((state) => state.bottomSafeHeight);
|
|
|
-
|
|
|
+
|
|
|
// 计算 marginTopOffset 偏移的距离
|
|
|
const marginTopOffset = (() => {
|
|
|
// console.log(contentHeight, keyboardHeight,scrollViewHeight, 9999)
|
|
|
@@ -38,8 +38,8 @@ export const useKeyboard = (scrollViewRef: React.MutableRefObject<any>, contentI
|
|
|
if (res.height <= 0) {
|
|
|
return setKeyboardHeight(0);
|
|
|
}
|
|
|
-
|
|
|
- setKeyboardHeight(res.height - bottomSafeHeight + 16);
|
|
|
+ // console.log(bottomSafeHeight, res.height, 3333)
|
|
|
+ setKeyboardHeight(res.height - bottomSafeHeight);
|
|
|
});
|
|
|
|
|
|
return () => {
|
|
|
@@ -92,4 +92,4 @@ export const useKeyboard = (scrollViewRef: React.MutableRefObject<any>, contentI
|
|
|
setContentHeight,
|
|
|
setScrollViewHeight,
|
|
|
}
|
|
|
-}
|
|
|
+}
|