解决按钮问题与键盘弹出问题
This commit is contained in:
@@ -3,6 +3,12 @@
|
|||||||
.common-popup {
|
.common-popup {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 9999 !important;
|
z-index: 9999 !important;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-height: calc(100vh - 10px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: theme.$page-background-color;
|
||||||
&:global(.nut-popup-bottom.nut-popup-round) {
|
&:global(.nut-popup-bottom.nut-popup-round) {
|
||||||
border-radius: 20px 20px 0 0 !important;
|
border-radius: 20px 20px 0 0 !important;
|
||||||
}
|
}
|
||||||
@@ -32,12 +38,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
max-height: calc(100vh - 10px);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background-color: theme.$page-background-color;
|
|
||||||
|
|
||||||
// .common-popup__header {
|
// .common-popup__header {
|
||||||
// padding: 12px 16px;
|
// padding: 12px 16px;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ 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') || []
|
||||||
@@ -199,12 +200,12 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当键盘显示时触发 changeTextarea
|
// 当键盘显示且 TextareaTag 当前 focus 时才触发 changeTextarea
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isKeyboardVisible) {
|
if (isKeyboardVisible && isTextareaFocused) {
|
||||||
changeTextarea(true)
|
changeTextarea(true)
|
||||||
}
|
}
|
||||||
}, [isKeyboardVisible])
|
}, [isKeyboardVisible, isTextareaFocused])
|
||||||
|
|
||||||
const changePicker = (value:boolean) => {
|
const changePicker = (value:boolean) => {
|
||||||
setOpenPicker(value);
|
setOpenPicker(value);
|
||||||
@@ -269,11 +270,15 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
<TextareaTag
|
<TextareaTag
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
//changeTextarea(true)
|
|
||||||
updateFormData(item.prop, value)
|
updateFormData(item.prop, value)
|
||||||
}}
|
}}
|
||||||
// onBlur={() => changeTextarea(false)}
|
onBlur={() => {
|
||||||
onFocus={() => changeTextarea(true)}
|
setIsTextareaFocused(false)
|
||||||
|
}}
|
||||||
|
onFocus={() => {
|
||||||
|
setIsTextareaFocused(true)
|
||||||
|
changeTextarea(true)
|
||||||
|
}}
|
||||||
placeholder='有其他场地信息可备注'
|
placeholder='有其他场地信息可备注'
|
||||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user