【问题标题】:Screens appear sometimes moved to the right on iOS在 iOS 上,屏幕有时会向右移动
【发布时间】:2020-03-31 17:55:41
【问题描述】:

有时当我导航到屏幕时,屏幕似乎向右移动。这只发生在 iOS 上。 我已经尝试删除 KeyboardAviodingViewSaveAreaView(也使用 react 导航提供的 SafeAreaView)、包装整个应用程序的视图以检查是否有其中任何一个导致问题,但没有运气。

package.json 依赖:

{
    "@unimodules/core": "~5.0.0",
    "axios": "^0.19.0",
    "expo": "^36.0.0",
    "expo-application": "^2.0.0",
    "expo-constants": "^8.0.0",
    "expo-font": "~8.0.0",
    "expo-linear-gradient": "~8.0.0",
    "expo-localization": "~8.0.0",
    "expo-secure-store": "~8.0.0",
    "expo-server-sdk": "^3.3.0",
    "formik": "^2.1.4",
    "i18n-js": "^3.3.0",
    "i18next": "^19.3.2",
    "immutable": "^4.0.0-rc.12",
    "lottie-react-native": "~2.6.1",
    "moment": "^2.24.0",
    "nyc": "^14.1.1",
    "react": "^16.12.0",
    "react-dom": "16.9.0",
    "react-hook-form": "^3.26.4",
    "react-i18next": "^11.3.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
    "react-native-animatable": "^1.3.3",
    "react-native-appearance": "~0.3.1",
    "react-native-calendars": "^1.264.0",
    "react-native-elements": "^1.2.7",
    "react-native-formik": "^1.7.7",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-modal": "^11.5.1",
    "react-native-modal-datetime-picker": "^8.1.1",
    "react-native-paper": "^3.5.1",
    "react-native-parallax-scroll-view": "^0.21.3",
    "react-native-platform-touchable": "^1.1.1",
    "react-native-reanimated": "~1.4.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.12",
    "react-native-shared-element": "~0.5.1",
    "react-native-snap-carousel": "^3.8.4",
    "react-native-svg": "9.13.3",
    "react-native-svg-uri": "^1.2.3",
    "react-native-vector-icons": "^6.6.0",
    "react-native-web": "^0.11.7",
    "react-native-workers": "^0.3.1",
    "react-navigation": "4.1.1",
    "react-navigation-animated-switch": "^0.3.2",
    "react-navigation-collapsible": "^3.0.3",
    "react-navigation-drawer": "^2.2.2",
    "react-navigation-fluid-transitions": "^0.3.2",
    "react-navigation-header-buttons": "^3.0.3",
    "react-navigation-material-bottom-tabs": "2.1.2",
    "react-navigation-shared-element": "^0.5.0",
    "react-navigation-stack": "1.9.3",
    "react-navigation-tabs": "^2.5.6",
    "react-redux": "^7.1.1",
    "recompose": "^0.30.0",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0",
    "remove": "^0.1.5",
    "sentry-expo": "^2.0.1",
    "yup": "^0.27.0"
}

编辑:该错误仅在我在屏幕 B 中显示键盘然后返回屏幕 A 时发生

【问题讨论】:

  • 嗨!您应该创建一个 mcve (stackoverflow.com/help/mcve) - 如果您在这样做的过程中没有自己弄清楚,它将给出一个其他人可以帮助您的示例!
  • 请添加代码以便更好地理解

标签: reactjs react-native react-navigation expo react-native-paper


【解决方案1】:

问题发生在以下情况:

1) 我导航到一个屏幕 -> this.props.navigation.navigate ('');

2) 我把应用程序放在前台;

3) 返回 -> navigation.goBack();

4) 我发现屏幕向右移动了。

【讨论】:

  • 1) 和 3),特别不是 3,因为我使用 navigation.pop()
【解决方案2】:

react-navigation-stack 升级到2.3.11 解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    • 2021-10-28
    相关资源
    最近更新 更多