React Native 学习(二)---仿微信我的钱包界面

前端之家收集整理的这篇文章主要介绍了React Native 学习(二)---仿微信我的钱包界面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

效果

里面的图标都是在阿里图标库下载的,挺好用,力推!

以下是代码部分: //下面九宫格我就写了前面三个,后面几个复制就可以

  1. import React,{ Component } from 'react';
  2. import {
  3. View,Text,Image,PixelRatio,StyleSheet,} from 'react-native';
  4. export class WeChat extends Component {
  5. render() {
  6. return(
  7. <View style={ styles.container}>
  8. <View style={ styles.header}>
  9. <View style={[styles.flex, { flexDirection: 'row'}]}>
  10. <View style={[styles.flex, styles.headerArrow]}>
  11. <Image source={ require('../img/wechat/arrow.png')}/>
  12. </View>
  13. <View style={[{flex: 6}]}>
  14. <Text style={styles.headerTitle}>我的钱包</Text>
  15. </View>
  16. <View style={[styles.flex]}>
  17. <Image source={ require('../img/wechat/more.png')}/>
  18. </View>
  19. </View>
  20. </View>
  21. <View style={ [styles.itemRow,styles.part1] }>
  22. <View style={ [styles.item,styles.flex,styles.center] }>
  23. <Image style={[ styles.itemImg]} source={require('../img/wechat/1-1.png')}/>
  24. <Text style={[ styles.itemText]}>收付款</Text>
  25. </View>
  26. <View style={ [styles.item,styles.center] }>
  27. <Image style={[ styles.itemImg]} source={require('../img/wechat/1-2.png')}/>
  28. <Text style={[ styles.itemText]}>零钱</Text>
  29. </View>
  30. <View style={ [styles.item,styles.center] }>
  31. <Image style={[ styles.itemImg]} source={require('../img/wechat/1-3.png')}/>
  32. <Text style={[ styles.itemText]}>银行卡</Text>
  33. </View>
  34. </View>
  35. <View style={styles.part2Header}>
  36. <Text style={[styles.part2HeaderTitle]}>腾讯服务</Text>
  37. </View>
  38. <View style={[styles.part2]}>
  39. <View style={[styles.part2_1,styles.flex]}>
  40. <View style={ [styles.itemRow,styles.lineBottom,styles.center] }>
  41. <View style={ [styles.center ]}>
  42. <Image style={ [styles.img ]} source={require('../img/wechat/2-1.png')}/>
  43. <Text style={ styles.part2ItemText}> 信用卡还款</Text>
  44. </View>
  45. </View>
  46. <View style={ [styles.itemRow,styles.lineLeftRight,styles.center] }>
  47. <View style={ [styles.center ]}>
  48. <Image style={ [styles.img ]} source={require('../img/wechat/2-2.png')}/>
  49. <Text style={ styles.part2ItemText}> 微粒贷借钱</Text>
  50. </View>
  51. </View >
  52. <View style={ [styles.itemRow,styles.center] }>
  53. <View style={ [styles.center ]}>
  54. <Image style={ [styles.img ]} source={require('../img/wechat/2-3.png')}/>
  55. <Text style={ styles.part2ItemText}> 手机充值</Text>
  56. </View>
  57. </View>
  58. </View>
  59. </View>
  60. </View>
  61. );
  62. }
  63. }
  64. const styles = StyleSheet.create({
  65. container: {
  66. flex: 1,},itemRow: {
  67. flexDirection: 'row',height: 100,lineLeftRight: {
  68. borderRightWidth: 1/PixelRatio.get(),borderLeftWidth: 1/PixelRatio.get(),borderColor: '#000',lineBottom: {
  69. borderBottomWidth: 1/PixelRatio.get(),flex: {
  70. flex: 1,center: {
  71. justifyContent: 'center',alignItems: 'center',item: {
  72. height: 100,itemText: {
  73. fontSize: 18,color: '#fff',marginTop: 7,fontSize18: {
  74. fontSize: 18,itemImg: {
  75. width: 50,header: {
  76. height: 70,paddingTop: 20,backgroundColor: '#393A3F',headerTitle: {
  77. fontSize: 20,headerArrow: {
  78. paddingTop: 0,paddingLeft: 10,marginRight: 0,width: 30,part1: {
  79. height: 160,backgroundColor: '#676E78',part2Header: {
  80. height: 50,backgroundColor: '#EFEEF3',part2HeaderTitle: {
  81. color: "#3A393F",marginLeft: 30,paddingTop: 10,fontSize: 20,part2:{
  82. height: 300,part2_1: {
  83. flexDirection: 'row',flex: 1,part2ItemText: {
  84. fontSize: 16,color: '#000',img: {
  85. width: 40,height: 40,});

图标: 链接http://pan.baidu.com/s/1qXPLR2k 密码:iu2u 没有找到微信中一模一样的图标,差不多就行了。 有问题,随时联系,一起交流 Q2279770758

猜你在找的React相关文章