React Native android 许可理性警报上的正面和负面按钮

positive and negative button on react native android permission rational alert

我是 React Native 新手,需要实现 React Native android 权限。

可以选择为 AndroidPermissions 中的 rational alert 传递 titlemessage,但我找不到添加 Positive 的方法和理性警报上的 Negative 按钮。

这对我来说看起来很陌生,因为在 android 通常我们在每个 dialog/Alert 上至少有一个 "OK" 按钮。

https://github.com/facebook/react-native/issues/13920 上也有人问过同样的问题,但没有任何解决方案就关闭了。

我知道现在回答有点晚了,但这可能对以后的人有所帮助。

在基本原理对象中使用 buttonNeutral、buttonNegative 和 buttonPositive,如下所示

const locationPermissionRationale = {
title: "Location Access",
message: 'Need for detect your location to select location nearby you easily'
// how to create Positive and Negative alert dialog button here ?
buttonNeutral: "Ask Me Later",
buttonNegative:"Cancel",
buttonPositive: "OK"

}

上面的解决方案来自此处引用的问题https://github.com/facebook/react-native/issues/13920