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-19 15:36:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5f36e599d3ebac0095fe92f4a57f704ce9b68747
5f36e599
1 parent
e92dc7f9
准备引入toast
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
6 deletions
src/pages/Discover/index.js
src/pages/Discover/index.js
View file @
5f36e59
...
...
@@ -7,6 +7,8 @@ import {
Dimensions
,
ScrollView
,
Text
,
Clipboard
,
TouchableOpacity
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
...
...
@@ -15,8 +17,12 @@ export default class Discover extends Component {
super
(
props
);
this
.
state
=
{
image
:
""
,
word
:
""
,
};
}
handleCopyPress
(
string
)
{
Clipboard
.
setString
(
string
);
}
componentWillMount
()
{
this
.
getImages
();
}
...
...
@@ -32,7 +38,7 @@ export default class Discover extends Component {
}
})
.
then
(
resp
=>
{
console
.
log
(
"大爷"
,
resp
);
console
.
log
(
"大爷"
,
resp
);
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
}
else
{
...
...
@@ -44,23 +50,28 @@ export default class Discover extends Component {
alert
(
respJson
.
cnmsg
);
}
else
{
that
.
setState
({
image
:
respJson
.
data
.
image
image
:
respJson
.
data
.
image
,
word
:
respJson
.
data
.
word
});
console
.
log
(
"图片文章"
,
respJson
.
data
);
}
});
}
render
()
{
const
{
image
}
=
this
.
state
;
const
{
image
,
word
}
=
this
.
state
;
return
(
<
View
style
=
{
styles
.
container
}
>
{
/* <Text>图片首页</Text> */
}
<
Image
style
=
{
styles
.
image
}
source
=
{{
uri
:
image
}}
source
=
{{
uri
:
image
}}
resizeMode
=
"contain"
>
<
Text
>
中央文案
<
/Text
>
<
Text
selectable
=
{
true
}
style
=
{
styles
.
word
}
>
{
word
}
<
/Text
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
this
.
handleCopyPress
(
word
)}}
>
<
Text
style
=
{
styles
.
buttonText
}
>
复制文案
<
/Text
>
<
/TouchableOpacity
>
<
/Image
>
<
/View
>
);
...
...
@@ -76,6 +87,26 @@ const styles = StyleSheet.create({
width
:
Dimensions
.
get
(
"window"
).
width
,
height
:
Dimensions
.
get
(
"window"
).
height
,
justifyContent
:
"center"
,
alignItems
:
"center"
},
word
:
{
marginLeft
:
15
,
marginRight
:
15
,
fontSize
:
15
,
lineHeight
:
25
,
color
:
"white"
,
backgroundColor
:
"rgba(0,0,0,0)"
},
button
:
{
width
:
80
,
height
:
40
,
marginTop
:
20
,
backgroundColor
:
"rgba(0,0,0,0.2)"
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
borderRadius
:
5
,
},
buttonText
:
{
color
:
"white"
,
}
});
...
...
Please
register
or
login
to post a comment