0

我想在我的 React-native 应用程序中添加“使用 Apple 登录”功能。我已经搜索并用谷歌搜索了它,但无法自定义我的 Apple Button 但强制使用默认的 Apple 按钮。如果可能的话,我怎么能做到这一点。我想要这个设计。

在此处输入图像描述

4

2 回答 2

0

我正在使用@invertase/react-native-apple-authentication,它使您能够创建您的按钮设计。这样你就可以调用 performRequest() onPress。然后我将此调用的响应发送到节点服务器以验证 jwt 令牌

于 2021-05-26T06:34:57.553 回答
0

是的,我做到了这一点,Apple 也批准了这一点。我正在使用“react-native-apple-authentication”库(非常简单的库)。

                  {Platform.OS === 'ios' && <View>
                    <ImgButtonComp
                      iconRight={require('../../../assets/apple-icon.png')}
                      onPress={SignInWithAppleButton({
                        callBack: this.appleSignIn,
                      })}
                      isloading={this.state.setAppleLoading}
                      text={Trans.translate("sign_in_with_apple")}
                      style={{ backgroundColor: 'white', borderColor: "#000000", borderWidth: 1.5 }}
                      textcolor='black'
                      iconLeft={require('../../../assets/polygon.png')}
                    />
                    <View style={{ position: 'absolute', width: '100%', height: 60 }}>
                      {SignInWithAppleButton({
                        buttonStyle: { height: 60 },
                        callBack: this.appleSignIn,
                        buttonText: " ",
                      })}
                    </View>
                  </View>} 

在上面的代码中,“ImgButtonComp”是我根据设计的苹果按钮,在下面,我在它上面使用了透明按钮“查看”,由 Apple 提供。现在它工作得很好。

于 2021-06-09T05:38:56.637 回答