【问题标题】:Apple Authentication Button doesn't show up using expo-apple-authentication packageApple Authentication Button 使用 expo-apple-authentication 包不显示
【发布时间】:2020-01-19 19:02:27
【问题描述】:

我正在尝试使用 expo-apple-authentication 包在我的 iOS 应用程序中实现 Apple 登录,但我无法显示按钮。即使我使用与文档完全相同的代码:

 <AppleAuthentication.AppleAuthenticationButton
   buttonType={
     AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN
   }
   buttonStyle={
     AppleAuthentication.AppleAuthenticationButtonStyle.BLACK
   }
   cornerRadius={5}
   onPress={() => {
   }}
 />

值得注意的是,对 AppleAuthentication.isAvailableAsync() 的调用返回 true。

我正在模拟器中对其进行测试。它不应该在开发环境中工作吗?那我该怎么测试呢?

【问题讨论】:

    标签: ios react-native expo apple-sign-in


    【解决方案1】:

    由于某些奇怪的原因,该按钮没有默认大小。应用您自己的样式可以解决此问题。

    <AppleAuthentication.AppleAuthenticationButton
      onPress={onSignIn}
      buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
      buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
      style={{ width: 200, height: 64 }} // You must choose default size
    />
    

    【讨论】:

      【解决方案2】:

      expo-apple-authentication 为 iOS 13+ 提供 Apple 身份验证。它尚不支持较低的 iOS 版本、Android 或 Web。

      可能是您的模拟器版本较旧。

      【讨论】:

        猜你喜欢
        • 2017-07-09
        • 1970-01-01
        • 2023-03-05
        • 2020-01-06
        • 2011-11-25
        • 2021-07-28
        • 2021-05-10
        • 2012-12-24
        • 1970-01-01
        相关资源
        最近更新 更多