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
4d56c432
Commit
4d56c432
authored
4 years ago
by
CaryaLiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: iOS相关改动
parent
bb8bdbef
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
20 deletions
+131
-20
App.js
+46
-6
CustomerView.js
+26
-13
MapView.js
+58
-0
ios
+1
-1
yarn.lock
+0
-0
No files found.
App.js
View file @
4d56c432
...
...
@@ -9,6 +9,7 @@
import
React
,
{
useState
}
from
'react'
;
import
{
NativeModules
,
NativeEventEmitter
,
SafeAreaView
,
StyleSheet
,
ScrollView
,
...
...
@@ -24,6 +25,7 @@ import {
import
{
BMCUI
}
from
'./ui.js'
import
CustomerView
from
'./CustomerView.js'
import
CustomRoundImageView
from
'./RoundedImage.js'
import
MapView
from
'./MapView.js'
import
{
Header
,
...
...
@@ -33,6 +35,9 @@ import {
ReloadInstructions
,
}
from
'react-native/Libraries/NewAppScreen'
;
var
ToastManager
=
NativeModules
.
ToastManager
;
var
AlertManager
=
NativeModules
.
AlertManager
;
async
function
showConfirmVsCancelPromiseDialog
(
msg
,
leftTip
,
rightTip
)
{
try
{
const
{
...
...
@@ -48,13 +53,42 @@ async function showConfirmVsCancelPromiseDialog(msg, leftTip, rightTip) {
}
}
// class App extends React.Component {
// onRegionChange(event) {
// console.log(event.region.latitude)
// }
// render() {
// const region = {
// latitude: 37.48,
// longitue: -122.16,
// latitudeDelta: 0.1,
// longitudeDelta: 0.1,
// };
// return (
// <MapView
// region={region}
// zoomEnabled={false}
// onRegionChange={this.onRegionChange}
// style={{ flex: 1 }}
// />
// );
// }
// }
const
App
=
()
=>
{
var
index
=
0
;
const
region
=
{
latitude
:
37.48
,
longitue
:
-
122.16
,
latitudeDelta
:
0.1
,
longitudeDelta
:
0.1
,
};
return
(
<>
<
StatusBar
barStyle
=
"dark-content"
/>
<
SafeAreaView
>
<
ScrollView
<
ScrollView
contentInsetAdjustmentBehavior
=
"automatic"
style
=
{
styles
.
scrollView
}
>
{
global
.
HermesInternal
==
null
?
null
:
(
...
...
@@ -63,7 +97,8 @@ const App = () => {
<
/View
>
)}
<
View
style
=
{
styles
.
buttonContainer
}
>
<
CustomerView
/>
<
CustomerView
style
=
{{
height
:
80
}}
/
>
<
MapView
region
=
{
region
}
zoomEnabled
=
{
false
}
style
=
{{
flex
:
1
,
height
:
200
}}
/
>
<
/View
>
<
View
style
=
{
styles
.
body
}
>
<
View
style
=
{
styles
.
buttonContainer
}
>
...
...
@@ -93,7 +128,11 @@ const App = () => {
// NativeModules.BMCUI.showWithDuration("你点击了按钮!", NativeModules.BMCUI.SHORT);
// Alert.alert("你点击了按钮");
}
else
{
Alert
.
alert
(
"ios undefine"
);
// Alert.alert("ios undefine");
// NativeModules.ToastManager
var
alerts
=
"alert..."
+
NativeModules
.
AlertManager
.
alertStyleLight
;
console
.
log
(
alerts
)
AlertManager
.
showAlert
(
"tesss"
)
}
}}
title
=
"吐司"
...
...
@@ -115,6 +154,7 @@ const App = () => {
// }, true, "你点击了按钮222!", "确定");
}
else
{
Alert
.
alert
(
"ios undefine"
);
}
}}
title
=
"单按钮提示框"
...
...
@@ -165,9 +205,9 @@ const App = () => {
<
/View
>
<
LearnMoreLinks
/>
<
/View
>
<
/ScrollView
>
<
/SafeAreaView
>
<
/
>
<
/ScrollView>
<
/SafeAreaView
>
<
/
>
);
};
...
...
This diff is collapsed.
Click to expand it.
CustomerView.js
View file @
4d56c432
...
...
@@ -5,10 +5,12 @@ import {
Image
,
TextInput
,
DeviceEventEmitter
,
NativeEventEmitter
,
TouchableHighlight
,
TouchableNativeFeedback
,
Platform
,
Alert
Alert
,
NativeModules
}
from
'react-native'
;
import
{
BMCUI
,
ImagePicker
}
from
'./ui.js'
...
...
@@ -73,18 +75,25 @@ export default class CustomerView extends React.Component {
componentDidMount
()
{
console
.
log
(
"CustomerView componentDidMount"
);
this
.
eventListener
=
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
);
if
(
Platform
.
OS
==
'android'
)
{
this
.
eventListener
=
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
);
});
});
});
}
else
{
const
alertEmitter
=
new
NativeEventEmitter
(
NativeModules
.
AlertManager
)
this
.
subscription
=
alertEmitter
.
addListener
(
'msg'
,
(
a
)
=>
{
console
.
log
(
"你收到事件"
+
a
.
test
);
});
}
}
shouldComponentUpdate
(
nextProps
,
nextState
,
nextContext
)
{
...
...
@@ -98,7 +107,11 @@ export default class CustomerView extends React.Component {
componentWillUnmount
()
{
console
.
log
(
"CustomerView componentWillUnmount"
);
this
.
eventListener
.
remove
();
// Removes the listener
if
(
Platform
.
OS
==
'android'
)
{
this
.
eventListener
.
remove
();
// Removes the listener
}
else
{
this
.
subscription
.
remove
();
}
}
componentDidCatch
(
error
,
errorInfo
)
{
...
...
This diff is collapsed.
Click to expand it.
MapView.js
0 → 100644
View file @
4d56c432
import
PropTypes
from
'prop-types'
;
import
React
from
'react'
;
import
{
requireNativeComponent
}
from
'react-native'
;
class
MapView
extends
React
.
Component
{
_onRegionChange
=
(
event
)
=>
{
if
(
!
this
.
props
.
onRegionChange
)
{
return
;
}
this
.
props
.
onRegionChange
(
event
.
nativeEvent
);
}
render
()
{
return
(
<
RNTMap
{...
this
.
props
}
onRegionChange
=
{
this
.
_onRegionChange
}
/
>
);
}
}
MapView
.
prototypes
=
{
/**
* A Boolean value that determines whether the user may use pinch
* gestures to zoom in and out of the map.
*/
zoomEnabled
:
PropTypes
.
bool
,
/**
* 地图要显示的区域。
*
* 区域由中心点坐标和区域范围坐标来定义。
*
*/
region
:
PropTypes
.
shape
({
/**
* 地图中心点的坐标。
*/
latitude
:
PropTypes
.
number
.
isRequired
,
longitude
:
PropTypes
.
number
.
isRequired
,
/**
* 最小/最大经、纬度间的距离。
*
*/
latitudeDelta
:
PropTypes
.
number
.
isRequired
,
longitudeDelta
:
PropTypes
.
number
.
isRequired
,
}),
/**
* Callback that is called continuously when the user is dragging the map.
*/
onRegionChange
:
PropTypes
.
func
,
};
const
RNTMap
=
requireNativeComponent
(
'RNTMap'
,
MapView
);
export
default
MapView
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ios
@
34c64df5
Subproject commit
b7b2f8ccbd271883333f7aaa95186bfd5a0946bc
Subproject commit
34c64df58686624bb36578bba6f101b2745e6693
This diff is collapsed.
Click to expand it.
yarn.lock
View file @
4d56c432
This source diff could not be displayed because it is too large. You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
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