mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 17:02:10 +08:00
修复键盘事件问题
This commit is contained in:
parent
e8901864b3
commit
6f0a8e017c
@ -57,7 +57,6 @@
|
||||
"react-native-background-timer": "^2.4.1",
|
||||
"react-native-crypto": "^2.2.0",
|
||||
"react-native-exception-handler": "^2.10.10",
|
||||
"react-native-extra-dimensions-android": "^1.2.5",
|
||||
"react-native-fs": "^2.19.0",
|
||||
"react-native-navigation": "^7.26.0",
|
||||
"react-native-pager-view": "^5.4.15",
|
||||
|
@ -6,11 +6,11 @@ export default () => {
|
||||
const [keyboardHeight, setKeyboardHeight] = useState(0)
|
||||
|
||||
const handleKeyboardDidShow = e => {
|
||||
const isShow = e.endCoordinates.height > 115
|
||||
setShown(isShow)
|
||||
setKeyboardHeight(isShow ? e.endCoordinates.height : 0)
|
||||
// setShown(true)
|
||||
// setKeyboardHeight(e.endCoordinates.height)
|
||||
// const isShow = e.endCoordinates.height > 115
|
||||
// setShown(isShow)
|
||||
// setKeyboardHeight(isShow ? e.endCoordinates.height : 0)
|
||||
setShown(true)
|
||||
setKeyboardHeight(e.endCoordinates.height)
|
||||
}
|
||||
|
||||
const handleKeyboardDidHide = () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Platform, NativeModules, ToastAndroid, BackHandler, Linking, Dimensions, Alert } from 'react-native'
|
||||
import ExtraDimensions from 'react-native-extra-dimensions-android'
|
||||
// import ExtraDimensions from 'react-native-extra-dimensions-android'
|
||||
import Clipboard from '@react-native-clipboard/clipboard'
|
||||
import { getData, setData, getAllKeys, removeData, removeDataMultiple, setDataMultiple, getDataMultiple } from '@/plugins/storage'
|
||||
import { storageDataPrefix } from '@/config'
|
||||
@ -37,23 +37,24 @@ const handleSaveListScrollPosition = throttle(data => {
|
||||
// fix https://github.com/facebook/react-native/issues/4934
|
||||
export const getWindowSise = windowDimensions => {
|
||||
if (!windowDimensions) windowDimensions = Dimensions.get('window')
|
||||
if (Platform.OS === 'ios') return windowDimensions
|
||||
const windowSize = {
|
||||
width: ExtraDimensions.getRealWindowWidth(),
|
||||
height: ExtraDimensions.getRealWindowHeight(),
|
||||
}
|
||||
if (
|
||||
(windowDimensions.height > windowDimensions.width && windowSize.height < windowSize.width) ||
|
||||
(windowDimensions.width > windowDimensions.height && windowSize.width < windowSize.height)
|
||||
) {
|
||||
windowSize.height = windowSize.width
|
||||
}
|
||||
windowSize.width = windowDimensions.width
|
||||
// if (Platform.OS === 'ios') return windowDimensions
|
||||
return windowDimensions
|
||||
// const windowSize = {
|
||||
// width: ExtraDimensions.getRealWindowWidth(),
|
||||
// height: ExtraDimensions.getRealWindowHeight(),
|
||||
// }
|
||||
// if (
|
||||
// (windowDimensions.height > windowDimensions.width && windowSize.height < windowSize.width) ||
|
||||
// (windowDimensions.width > windowDimensions.height && windowSize.width < windowSize.height)
|
||||
// ) {
|
||||
// windowSize.height = windowSize.width
|
||||
// }
|
||||
// windowSize.width = windowDimensions.width
|
||||
|
||||
if (ExtraDimensions.isSoftMenuBarEnabled()) {
|
||||
windowSize.height -= ExtraDimensions.getSoftMenuBarHeight()
|
||||
}
|
||||
return windowSize
|
||||
// if (ExtraDimensions.isSoftMenuBarEnabled()) {
|
||||
// windowSize.height -= ExtraDimensions.getSoftMenuBarHeight()
|
||||
// }
|
||||
// return windowSize
|
||||
}
|
||||
|
||||
|
||||
|
@ -5977,11 +5977,6 @@ react-native-exception-handler@^2.10.10:
|
||||
resolved "https://registry.yarnpkg.com/react-native-exception-handler/-/react-native-exception-handler-2.10.10.tgz#b6bfe2b7e6ea4a4deb1f518f48ce2ee1d4843497"
|
||||
integrity sha512-otAXGoZDl1689OoUJWN/rXxVbdoZ3xcmyF1uq/CsizdLwwyZqVGd6d+p/vbYvnF996FfEyAEBnHrdFxulTn51w==
|
||||
|
||||
react-native-extra-dimensions-android@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/react-native-extra-dimensions-android/-/react-native-extra-dimensions-android-1.2.5.tgz#8ade91029aaac7519bf305116d39019e618a60f0"
|
||||
integrity sha512-eorFo9X1vEqAWUkgcZ300yKBG1wtgNeE7tdWAH2CE+P50FGTniJg5Sr6l1iPWG8ZskQOuF+KeiSTFlDa4vLfMw==
|
||||
|
||||
react-native-fs@^2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.19.0.tgz#5747eb52a5a3d2b31c8fb76f5f8044d0a855122c"
|
||||
|
Loading…
x
Reference in New Issue
Block a user