解决按钮问题与键盘弹出问题
This commit is contained in:
@@ -70,7 +70,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
stadium,
|
||||
onAnyInput
|
||||
}, ref) => {
|
||||
const [openPicker, setOpenPicker] = useState(false);
|
||||
const [openPicker, setOpenPicker] = useState(false); //为了解决上传图片时按钮样式问题
|
||||
const [scrollTop, setScrollTop] = useState(0);
|
||||
const { getDictionaryValue } = useDictionaryActions()
|
||||
const court_type = getDictionaryValue('court_type') || []
|
||||
@@ -194,7 +194,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
const changeTextarea = (value: boolean) => {
|
||||
if (value) {
|
||||
// 先滚动到底部
|
||||
setScrollTop(scrollTop ? scrollTop + 15 : 9999);
|
||||
setScrollTop(140);
|
||||
// 使用 setTimeout 确保滚动后再更新 openPicker
|
||||
}
|
||||
}
|
||||
@@ -206,18 +206,25 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
}
|
||||
}, [isKeyboardVisible])
|
||||
|
||||
const changePicker = (value) => {
|
||||
const changePicker = (value:boolean) => {
|
||||
setOpenPicker(value);
|
||||
}
|
||||
|
||||
console.log(stadium,'stadiumstadium');
|
||||
|
||||
// 计算滚动区域的最大高度
|
||||
const scrollMaxHeight = isKeyboardVisible
|
||||
? `calc(100vh - ${keyboardHeight+40}px)`
|
||||
: '60vh'
|
||||
|
||||
return (
|
||||
<View className='stadium-detail'>
|
||||
<ScrollView
|
||||
className='stadium-detail-scroll'
|
||||
refresherBackground="#FAFAFA"
|
||||
scrollY
|
||||
scrollY={!openPicker}
|
||||
scrollTop={scrollTop}
|
||||
style={{ maxHeight: scrollMaxHeight }}
|
||||
>
|
||||
{/* 已选球场 */}
|
||||
<View
|
||||
@@ -262,11 +269,11 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
<TextareaTag
|
||||
value={formData[item.prop]}
|
||||
onChange={(value) => {
|
||||
changeTextarea(true)
|
||||
//changeTextarea(true)
|
||||
updateFormData(item.prop, value)
|
||||
}}
|
||||
// onBlur={() => changeTextarea(false)}
|
||||
//onFocus={() => changeTextarea(true)}
|
||||
onFocus={() => changeTextarea(true)}
|
||||
placeholder='有其他场地信息可备注'
|
||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user