MainPage.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from "react"
  2. import { StyleSheet, Text, View, ImageBackground, TouchableOpacity } from "react-native"
  3. import { unitWidth, unitHeight, getStatusBarHeight } from "../utils/AdapterUtil";
  4. export default class MainPage extends React.Component {
  5. toMeet = () => {
  6. const { navigation } = this.props;
  7. navigation.navigate("Meet")
  8. }
  9. render() {
  10. return (
  11. <View style={styles.container}>
  12. <ImageBackground source={require('../../static/homeMatch.png')}
  13. style={styles.topBgc}
  14. >
  15. <Text style={styles.bgcText}>你会不会催好朋友还钱?</Text>
  16. </ImageBackground>
  17. <TouchableOpacity onPress={this.toMeet}>
  18. <View style={styles.itemArea} >
  19. <Text style={styles.itemText}>A 不催,催账可能产生不必要的隔阂</Text>
  20. </View>
  21. </TouchableOpacity>
  22. <View style={styles.itemArea}>
  23. <Text style={styles.itemText}>B 催,珍惜彼此的信用</Text>
  24. </View>
  25. </View>
  26. )
  27. }
  28. }
  29. const styles = StyleSheet.create({
  30. container: {
  31. flex: 1,
  32. paddingTop: getStatusBarHeight() + unitHeight * 30,
  33. paddingLeft: unitWidth * 60,
  34. paddingRight: unitWidth * 60,
  35. alignItems: "center",
  36. position: "relative"
  37. },
  38. topBgc: {
  39. width: unitWidth * 702,
  40. height: unitHeight * 160,
  41. justifyContent: "center",
  42. alignItems: "center",
  43. paddingTop: unitHeight * 20,
  44. marginBottom: unitHeight * 40
  45. },
  46. bgcText: {
  47. fontSize: unitWidth * 36,
  48. color: "#fff"
  49. },
  50. itemArea: {
  51. width: unitWidth * 702,
  52. height: unitHeight * 108,
  53. borderColor: "#ccc",
  54. borderWidth: 1,
  55. borderRadius: unitHeight * 10,
  56. marginBottom: unitHeight * 40,
  57. justifyContent: "center",
  58. paddingLeft: unitWidth * 40
  59. },
  60. itemText: {
  61. fontSize: unitWidth * 28,
  62. color: "#333333"
  63. }
  64. })