'use strict';

const React = require('react-native');
const Alipay = React.NativeModules.MartianRnAlipay;

module.exports = Alipay;
'use strict';

import {
    NativeModules,
    DeviceEventEmitter
} from "react-native";
const Alipay = NativeModules.MartianRnAlipay;

let MtRnAlipay;

if( Platform.os === 'ios' ) {
    MtRnAlipay = new class {
        pay(options) {
            return new Promise(
                (resolve, reject) => {
                    Alipay.pay(options)
                        .then(
                            resolve
                        )
                        .catch(
                            reject
                        );
                    DeviceEventEmitter.on("alipaySuccess", (result) => {
                        DeviceEventEmitter.removeAllListeners("alipaySuccess");
                        resolve(result);
                    });
                }
            );
        }
    };
}
else  {
    MtRnAlipay = Alipay;
}

module.exports = MtRnAlipay;

修改了ios的返回方式使上下层统一（未测试）