Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
banma_credit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hik_rn
project
banma_credit
Commits
85cef32e
Commit
85cef32e
authored
Oct 19, 2020
by
leiyongsheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正事件接受
parent
2315939a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
8 deletions
+37
-8
android
+1
-1
ios
+1
-1
src/test/CustomerView.js
+17
-5
src/test/RoundedImage.js
+18
-1
No files found.
android
@
730a204a
Subproject commit
0d1c0f28436083a4e7fbc31ab9d4fab192013f7b
Subproject commit
730a204af28cca2e52e86d5ea01ed84289e4d78a
ios
@
068d46e2
Subproject commit
23d836dd8a0094562cc0944b892c8d1688103a72
Subproject commit
068d46e210861b0b45160b9696df3031527cd46d
src/test/CustomerView.js
View file @
85cef32e
...
...
@@ -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
();
}
...
...
src/test/RoundedImage.js
View file @
85cef32e
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment