Merge branch 'master' of https://git.bimwe.com/bimwe/mini-programs
This commit is contained in:
@@ -48,7 +48,14 @@ const CustomPopup: React.FC<CustomPopupProps> = ({
|
|||||||
const touchStartY = useRef(0)
|
const touchStartY = useRef(0)
|
||||||
|
|
||||||
// 使用全局键盘状态
|
// 使用全局键盘状态
|
||||||
const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener } = useKeyboardHeight()
|
const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener, setKeyboardVisible } = useKeyboardHeight()
|
||||||
|
|
||||||
|
// 当弹窗显示时,设置键盘为不可见
|
||||||
|
useEffect(() => {
|
||||||
|
if (visible) {
|
||||||
|
setKeyboardVisible(false)
|
||||||
|
}
|
||||||
|
}, [visible, setKeyboardVisible])
|
||||||
|
|
||||||
// 使用全局键盘状态监听
|
// 使用全局键盘状态监听
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
}, ref) => {
|
}, ref) => {
|
||||||
const [openPicker, setOpenPicker] = useState(false); //为了解决上传图片时按钮样式问题
|
const [openPicker, setOpenPicker] = useState(false); //为了解决上传图片时按钮样式问题
|
||||||
const [scrollTop, setScrollTop] = useState(0);
|
const [scrollTop, setScrollTop] = useState(0);
|
||||||
const [isTextareaFocused, setIsTextareaFocused] = useState(false); // 记录 TextareaTag 是否 focus
|
|
||||||
const { getDictionaryValue } = useDictionaryActions()
|
const { getDictionaryValue } = useDictionaryActions()
|
||||||
const court_type = getDictionaryValue('court_type') || []
|
const court_type = getDictionaryValue('court_type') || []
|
||||||
const court_surface = getDictionaryValue('court_surface') || []
|
const court_surface = getDictionaryValue('court_surface') || []
|
||||||
@@ -200,13 +199,6 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当键盘显示且 TextareaTag 当前 focus 时才触发 changeTextarea
|
|
||||||
useEffect(() => {
|
|
||||||
if (isKeyboardVisible && isTextareaFocused) {
|
|
||||||
changeTextarea(true)
|
|
||||||
}
|
|
||||||
}, [isKeyboardVisible, isTextareaFocused])
|
|
||||||
|
|
||||||
const changePicker = (value:boolean) => {
|
const changePicker = (value:boolean) => {
|
||||||
setOpenPicker(value);
|
setOpenPicker(value);
|
||||||
}
|
}
|
||||||
@@ -272,11 +264,9 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateFormData(item.prop, value)
|
updateFormData(item.prop, value)
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
// onBlur={() => {
|
||||||
setIsTextareaFocused(false)
|
// }}
|
||||||
}}
|
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
setIsTextareaFocused(true)
|
|
||||||
changeTextarea(true)
|
changeTextarea(true)
|
||||||
}}
|
}}
|
||||||
placeholder='有其他场地信息可备注'
|
placeholder='有其他场地信息可备注'
|
||||||
|
|||||||
@@ -150,12 +150,13 @@ export const useKeyboardStore = create<KeyboardStore>((set, get) => ({
|
|||||||
|
|
||||||
// 导出便捷的 hooks
|
// 导出便捷的 hooks
|
||||||
export const useKeyboardHeight = () => {
|
export const useKeyboardHeight = () => {
|
||||||
const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener } = useKeyboardStore()
|
const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener, setKeyboardVisible } = useKeyboardStore()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
keyboardHeight,
|
keyboardHeight,
|
||||||
isKeyboardVisible,
|
isKeyboardVisible,
|
||||||
addListener,
|
addListener,
|
||||||
initializeKeyboardListener
|
initializeKeyboardListener,
|
||||||
|
setKeyboardVisible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user