nftGroupCard.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * 首页 NFT Group 卡片
  3. */
  4. import React, { useState, useEffect } from 'react';
  5. import { postRequest } from '@/netWork/index';
  6. import { getStorageData, setStorageData } from '@/storage/index';
  7. import { Alert, Image, StyleSheet, Text, View, Pressable } from 'react-native';
  8. export const NftGroupCard = (props: any) => {
  9. const jumpDetail = (groupId: any) => {
  10. props.navigation.navigate('NftGroupDetail', {
  11. groupId,
  12. navigation: props.navigation,
  13. });
  14. };
  15. return (
  16. <View style={styles.groupCard}>
  17. {props.nftData.length > 0 && (
  18. <Text style={styles.title}>NFT Group</Text>
  19. )}
  20. <View style={styles.groupList}>
  21. {props.nftData.map(
  22. (item: {
  23. nftGroupId: any;
  24. nftGroupIcon: any;
  25. nftGroupName: String;
  26. }) => (
  27. <Pressable
  28. style={styles.groupItem}
  29. onPress={() => {
  30. jumpDetail(item.nftGroupId)
  31. }}
  32. key={item.nftGroupId}>
  33. <Image
  34. style={styles.groupIcon}
  35. source={{ uri: item.nftGroupIcon }}
  36. />
  37. <Text style={styles.groupName}>
  38. {item.nftGroupName}
  39. </Text>
  40. </Pressable>
  41. ),
  42. )}
  43. </View>
  44. </View>
  45. );
  46. };
  47. const styles = StyleSheet.create({
  48. groupCard: {
  49. flex: 1,
  50. paddingLeft: 16,
  51. paddingRight: 16,
  52. },
  53. groupList: {
  54. backgroundColor: '#fff',
  55. borderRadius: 10,
  56. },
  57. groupItem: {
  58. paddingTop: 12,
  59. paddingBottom: 12,
  60. paddingLeft: 20,
  61. paddingRight: 20,
  62. flexDirection: 'row',
  63. },
  64. title: {
  65. marginTop: 25,
  66. marginBottom: 8,
  67. },
  68. groupIcon: {
  69. width: 40,
  70. height: 40,
  71. borderRadius: 4,
  72. marginRight: 20,
  73. },
  74. groupName: {
  75. height: 30,
  76. lineHeight: 30,
  77. fontSize: 16,
  78. },
  79. });