Commit dd4bf4e7 by CaryaLiu

Merge branch 'develop' of http://git.hikcreate.com/hikrn/project/banma_credit into develop

# Conflicts:
#	ios
parents ab3dcf19 85cef32e
...@@ -85,15 +85,27 @@ export default class CustomerView extends React.Component { ...@@ -85,15 +85,27 @@ export default class CustomerView extends React.Component {
componentDidMount() { componentDidMount() {
console.log("CustomerView componentDidMount"); console.log("CustomerView componentDidMount");
if (Platform.OS == 'android') { if (Platform.OS == 'android') {
this.eventListener = DeviceEventEmitter.addListener('msg', (a) => { // this.subscription = DeviceEventEmitter.addListener('msg', (a) => {
// alert('收到通知:' + a); // // alert('收到通知:' + a);
console.log("收到通知:" + 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) { if (a && a.test) {
tip = a.test tip = a.test
} else { } else {
tip = a tip = a
} }
BMCUI.showConfirmDialogWithCancelable(false, "收到新消息:" + tip, "确定", (result) => { BMCUI.showConfirmDialogWithCancelable(false, "收到新消息(CustomerView):" + tip, "确定", (result) => {
console.log("你点击了取确定按钮,结果为:" + result); console.log("你点击了取确定按钮,结果为:" + result);
}); });
}); });
...@@ -118,7 +130,7 @@ export default class CustomerView extends React.Component { ...@@ -118,7 +130,7 @@ export default class CustomerView extends React.Component {
componentWillUnmount() { componentWillUnmount() {
console.log("CustomerView componentWillUnmount"); console.log("CustomerView componentWillUnmount");
if (Platform.OS == 'android') { if (Platform.OS == 'android') {
this.eventListener.remove(); // Removes the listener this.subscription.remove();// Removes the listener
} else { } else {
this.subscription.remove(); this.subscription.remove();
} }
......
import React from 'react'; import React from 'react';
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { requireNativeComponent, View } from 'react-native'; import { requireNativeComponent, View, NativeEventEmitter } from 'react-native';
import { BMCUI, ImagePicker } from './ui.js' import { BMCUI, ImagePicker } from './ui.js'
/** /**
* Composes `View`. * Composes `View`.
...@@ -56,8 +56,25 @@ export default class CustomRoundImageView extends React.Component { ...@@ -56,8 +56,25 @@ export default class CustomRoundImageView extends React.Component {
}; };
} }
componentDidMount() { 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); console.log("CustomRoundImageView componentDidMount : " + RoundImage + " / default img:" + this.state.imgUrl);
} }
componentWillUnmount() {
console.log("CustomRoundImageView componentWillUnmount");
this.subscription.remove();// Removes the listener
}
_onChange(event) { _onChange(event) {
console.log("onChange props:" + this.props + " / event:" + event); console.log("onChange props:" + this.props + " / event:" + event);
if (event.nativeEvent.message) { 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