Toggle navigation
Toggle navigation
This project
Loading...
Sign in
罗广聪
/
ProtectGod
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
罗广聪
2017-09-28 16:07:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3893bfe1c5505948520c417a29e7946572b8f83e
3893bfe1
1 parent
b4c8e4a1
可以打电话了
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
src/pages/Mine/index.js
src/pages/Mine/index.js
View file @
3893bfe
...
...
@@ -11,39 +11,40 @@ import {
AsyncStorage
,
Button
,
ScrollView
,
Linking
Linking
,
Platform
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
const
LaunchURL
=
function
(
url
)
{
Linking
.
canOpenURL
(
url
).
then
(
supported
=>
{
const
LaunchURL
=
function
(
url
)
{
Linking
.
canOpenURL
(
url
)
.
then
(
supported
=>
{
if
(
!
supported
)
{
console
.
log
(
'Can\'t handle url: '
+
url
);
console
.
log
(
"Can't handle url: "
+
url
);
}
else
{
Linking
.
openURL
(
url
)
.
catch
(
err
=>
{
if
(
url
.
includes
(
'telprompt'
))
{
Linking
.
openURL
(
url
).
catch
(
err
=>
{
if
(
url
.
includes
(
"telprompt"
))
{
// telprompt was cancelled and Linking openURL method sees this as an error
// it is not a true error so ignore it to prevent apps crashing
// see https://github.com/anarchicknight/react-native-communications/issues/39
}
else
{
console
.
warn
(
'openURL error'
,
err
)
console
.
warn
(
"openURL error"
,
err
);
}
});
}
}).
catch
(
err
=>
console
.
warn
(
'An unexpected error happened'
,
err
));
})
.
catch
(
err
=>
console
.
warn
(
"An unexpected error happened"
,
err
));
};
const
phonecall
=
function
(
phoneNumber
,
prompt
)
{
const
phonecall
=
function
(
phoneNumber
,
prompt
)
{
let
url
;
if
(
Platform
.
OS
!==
'android'
)
{
url
=
prompt
?
'telprompt:'
:
'tel:'
;
}
else
{
url
=
'tel:'
;
if
(
Platform
.
OS
!==
"android"
)
{
url
=
prompt
?
"telprompt:"
:
"tel:"
;
}
else
{
url
=
"tel:"
;
}
url
+=
phoneNumber
;
LaunchURL
(
url
);
}
}
;
export
default
class
Mine
extends
Component
{
constructor
(
props
)
{
...
...
@@ -325,9 +326,12 @@ export default class Mine extends Component {
/
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
phonecall
(
"4001-608876"
,
true
);
}}
>
}}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Text
style
=
{
styles
.
leftTitle
}
>
客服电话
<
/Text
>
<
/View
>
...
...
Please
register
or
login
to post a comment