【问题标题】:React native deep link breaks UI in AndroidReact 本机深度链接破坏了 Android 中的 UI
【发布时间】:2017-10-25 09:32:29
【问题描述】:

所以我在 react native 中尝试了深度链接,它是用于用户使用 web 视图登录的。 流程是这样的:

  1. 用户点击登录按钮。
  2. 浏览器出现,用户进行登录活动。
  3. 用户登录后,我使用深度链接将用户重定向回我的应用程序

问题是我的应用重新打开后,状态栏不再半透明

这是深度链接之前的图像:

这是深层链接后的图像:

这是使状态栏半透明的代码:

<View style={styles.container}>
  <RootNavigation />
  {Platform.OS === 'android' &&
    <StatusBar
      translucent
      backgroundColor={Token.color.background.statusbar.rgb} />}
  {Platform.OS === 'ios' && <StatusBar barStyle='default' />}
</View>

这是我使用的依赖项,也许它可以帮助:

"axios": "^0.17.0",
"lodash": "^4.17.4",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-fbsdk": "^0.6.3",
"react-native-svg": "^5.4.2",
"react-navigation": "^1.0.0-beta.15",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"

【问题讨论】:

    标签: android react-native deep-linking


    【解决方案1】:

    造成这种情况的可能原因是 Android 应用程序的入口点不同。您需要确保您的 status bar translucent 组件包含在此入口点中。 要复制此行为并在 Android Studio 中测试打开的项目,然后单击 Run -> Edit Configuration。并将启动选项更改为 URL 并将 URL 更新为类似这样的内容 - myapp://article/13 。这将有助于在 Android 模拟器上调试您。

    在 Android 上测试 Deeplink 部分查看更多详细信息 -> https://medium.com/@abhisheknalwaya/react-native-deep-linking-for-ios-and-android-d33abfba7ef3

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-02
      • 1970-01-01
      • 2018-07-20
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多