Ai
1 Star 0 Fork 1

碳猫科技/react-native-code-push

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
AlertAdapter.js 703 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jonathan Carter 提交于 2016-04-09 05:11 +08:00 . Updating alert adapter
import React, { Platform } from "react-native";
let { Alert } = React;
if (Platform.OS === "android") {
const { NativeModules: { CodePushDialog } } = React;
Alert = {
alert(title, message, buttons) {
if (buttons.length > 2) {
throw "Can only show 2 buttons for Android dialog.";
}
const button1Text = buttons[0] ? buttons[0].text : null,
button2Text = buttons[1] ? buttons[1].text : null;
CodePushDialog.showDialog(
title, message, button1Text, button2Text,
(buttonId) => { buttons[buttonId].onPress && buttons[buttonId].onPress(); },
(error) => { throw error; });
}
};
}
module.exports = { Alert };
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Objective-C
1
https://gitee.com/hackcat/react-native-code-push.git
git@gitee.com:hackcat/react-native-code-push.git
hackcat
react-native-code-push
react-native-code-push
master

搜索帮助