Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-fcm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-fcm
Commits
8245f7e8
Commit
8245f7e8
authored
May 03, 2017
by
Libin Lu
Committed by
GitHub
May 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #384 from coreform/master
Added copy-to-clipboard feature for token
parents
d6d18dc0
f439fdb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
Examples/simple-fcm-client/app/App.js
Examples/simple-fcm-client/app/App.js
+26
-5
No files found.
Examples/simple-fcm-client/app/App.js
View file @
8245f7e8
...
...
@@ -9,7 +9,8 @@ import {
StyleSheet
,
Text
,
TouchableOpacity
,
View
View
,
Clipboard
}
from
'
react-native
'
;
import
PushController
from
"
./PushController
"
;
...
...
@@ -20,12 +21,13 @@ export default class App extends Component {
super
(
props
);
this
.
state
=
{
token
:
""
token
:
""
,
tokenCopyFeedback
:
""
}
}
render
()
{
let
{
token
}
=
this
.
state
;
let
{
token
,
tokenCopyFeedback
}
=
this
.
state
;
return
(
<
View
style
=
{
styles
.
container
}
>
...
...
@@ -36,10 +38,14 @@ export default class App extends Component {
Welcome
to
Simple
Fcm
Client
!
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
<
Text
s
electable
=
{
true
}
onPress
=
{()
=>
this
.
setClipboardContent
(
this
.
state
.
token
)}
s
tyle
=
{
styles
.
instructions
}
>
Token
:
{
this
.
state
.
token
}
<
/Text
>
<
Text
style
=
{
styles
.
feedback
}
>
{
this
.
state
.
tokenCopyFeedback
}
<
/Text
>
<
TouchableOpacity
onPress
=
{()
=>
firebaseClient
.
sendNotification
(
token
)}
style
=
{
styles
.
button
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Send
Notification
<
/Text
>
<
/TouchableOpacity
>
...
...
@@ -54,6 +60,16 @@ export default class App extends Component {
<
/View
>
);
}
setClipboardContent
(
text
)
{
Clipboard
.
setString
(
text
);
this
.
setState
({
tokenCopyFeedback
:
"
Token copied to clipboard.
"
});
setTimeout
(()
=>
{
this
.
clearTokenCopyFeedback
()},
2000
);
}
clearTokenCopyFeedback
()
{
this
.
setState
({
tokenCopyFeedback
:
""
});
}
}
const
styles
=
StyleSheet
.
create
({
...
...
@@ -71,7 +87,12 @@ const styles = StyleSheet.create({
instructions
:
{
textAlign
:
'
center
'
,
color
:
'
#333333
'
,
marginBottom
:
5
,
marginBottom
:
2
,
},
feedback
:
{
textAlign
:
'
center
'
,
color
:
'
#996633
'
,
marginBottom
:
3
,
},
button
:
{
backgroundColor
:
"
teal
"
,
...
...
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