Commit 85cef32e by leiyongsheng

修正事件接受

parent 2315939a
android @ 730a204a
Subproject commit 0d1c0f28436083a4e7fbc31ab9d4fab192013f7b
Subproject commit 730a204af28cca2e52e86d5ea01ed84289e4d78a
ios @ 068d46e2
Subproject commit 23d836dd8a0094562cc0944b892c8d1688103a72
Subproject commit 068d46e210861b0b45160b9696df3031527cd46d
......@@ -85,15 +85,27 @@ export default class CustomerView extends React.Component {
componentDidMount() {
console.log("CustomerView componentDidMount");
if (Platform.OS == 'android') {
this.eventListener = DeviceEventEmitter.addListener('msg', (a) => {
// alert('收到通知:' + a);
console.log("收到通知:" + a);
// this.subscription = DeviceEventEmitter.addListener('msg', (a) => {
// // alert('收到通知:' + a);
// console.log("收到通知:" + a);
// if (a && a.test) {
// tip = a.test
// } else {
// tip = a
// }
// BMCUI.showConfirmDialogWithCancelable(false, "收到新消息:" + tip, "确定", (result) => {
// console.log("你点击了取确定按钮,结果为:" + result);
// });
// });
//
const alertEmitter = new NativeEventEmitter()
this.subscription = alertEmitter.addListener('msg', (a) => {
if (a && a.test) {
tip = a.test
} else {
tip = a
}
BMCUI.showConfirmDialogWithCancelable(false, "收到新消息:" + tip, "确定", (result) => {
BMCUI.showConfirmDialogWithCancelable(false, "收到新消息(CustomerView):" + tip, "确定", (result) => {
console.log("你点击了取确定按钮,结果为:" + result);
});
});
......@@ -118,7 +130,7 @@ export default class CustomerView extends React.Component {
componentWillUnmount() {
console.log("CustomerView componentWillUnmount");
if (Platform.OS == 'android') {
this.eventListener.remove(); // Removes the listener
this.subscription.remove();// Removes the listener
} else {
this.subscription.remove();
}
......
import React from 'react';
import PropTypes from "prop-types";
import { requireNativeComponent, View } from 'react-native';
import { requireNativeComponent, View, NativeEventEmitter } from 'react-native';
import { BMCUI, ImagePicker } from './ui.js'
/**
* Composes `View`.
......@@ -56,8 +56,25 @@ export default class CustomRoundImageView extends React.Component {
};
}
componentDidMount() {
const alertEmitter = new NativeEventEmitter()
this.subscription = alertEmitter.addListener('msg', (a) => {
if (a && a.test) {
tip = a.test
} else {
tip = a
}
BMCUI.showConfirmDialogWithCancelable(false, "收到新消息(RoundedImage):" + tip, "确定", (result) => {
console.log("你点击了取确定按钮,结果为:" + result);
});
});
console.log("CustomRoundImageView componentDidMount : " + RoundImage + " / default img:" + this.state.imgUrl);
}
componentWillUnmount() {
console.log("CustomRoundImageView componentWillUnmount");
this.subscription.remove();// Removes the listener
}
_onChange(event) {
console.log("onChange props:" + this.props + " / event:" + event);
if (event.nativeEvent.message) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment