罗广聪

发现 样式OK

No preview for this file type
... ... @@ -7,6 +7,7 @@ import {
Dimensions,
ScrollView,
Text,
TouchableOpacity
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
... ... @@ -14,7 +15,9 @@ export default class Discover extends Component {
constructor(props) {
super(props);
this.state = {
image: "",
// image: "",
word: "",
date: {}
};
}
componentWillMount() {
... ... @@ -32,7 +35,7 @@ export default class Discover extends Component {
}
})
.then(resp => {
console.log("大爷",resp);
console.log("大爷", resp);
if (resp.status === 200) {
return resp.json();
} else {
... ... @@ -44,38 +47,102 @@ export default class Discover extends Component {
alert(respJson.cnmsg);
} else {
that.setState({
image: respJson.data.image
word: respJson.data.word,
date: respJson.data.date
});
console.log("图片文章", respJson.data);
console.log("发现", respJson.data);
}
});
}
render() {
const { image } = this.state;
const { word, date } = this.state;
return (
<View style={styles.container}>
{/* <Text>图片首页</Text> */}
<Image
style={styles.image}
source={{uri: image}}
resizeMode="contain"
style={styles.container}
source={require("../../assets/discover/bg.png")}
>
<Text>中央文案</Text>
</Image>
<View style={styles.date}>
<Text style={styles.day}>{date.day}</Text>
<View style={styles.leftContaier}>
<Text style={styles.month}>{date.month}</Text>
<Text style={styles.week}>{date.week}</Text>
</View>
</View>
<View style={styles.wordConatier}>
<Text style={styles.word}>{word}}</Text>
</View>
<TouchableOpacity style={styles.button}>
<Image style={styles.btnImg} source={require("../../assets/discover/ic_copy.png")} />
<Text style={styles.btnText}>复制文案</Text>
</TouchableOpacity>
</Image>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "white"
width: Dimensions.get("window").width,
height: Dimensions.get("window").height
},
date: {
backgroundColor: "rgba(255,255,255,0)",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
marginLeft: 100,
marginRight: 100,
marginTop: 25,
marginBottom: 25
},
day: {
fontSize: 75,
color: "#fff"
},
image: {
leftContaier: {
marginLeft: 12
},
month: {
fontSize: 23,
color: "#fff"
},
week: {
fontSize: 17,
color: "#fff"
},
wordConatier: {
backgroundColor: "#FFFFFF",
justifyContent: "center",
alignItems: "center",
borderRadius: 5,
marginLeft: 20,
marginRight: 20,
paddingLeft: 22,
paddingRight: 22,
paddingTop: 28,
paddingBottom: 28,
},
word: {
fontSize: 15,
color: "#242424",
lineHeight: 24
},
button: {
width: Dimensions.get("window").width,
height: Dimensions.get("window").height,
backgroundColor: "rgba(255,255,255,0)",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
position: "absolute",
bottom: 150,
},
btnImg: {
width: 13,
height: 15,
marginRight: 5,
},
btnText: {
color: "white",
fontSize: 15,
}
});
... ...