RecommendStore.jsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import * as WebBrowser from 'expo-web-browser';
  2. import * as React from 'react';
  3. import { StyleSheet, View } from 'react-native';
  4. import { Flex, WingBlank } from '@ant-design/react-native';
  5. import { Card } from 'react-native-paper';
  6. import { Div, Button, Text, Image } from 'react-native-magnus';
  7. import { useNavigation } from '@react-navigation/native';
  8. import useModel from 'flooks';
  9. import HomeModel from './model';
  10. function CardCom({ info, onPress }) {
  11. return (
  12. <Button bg="hide" block flex={1} onPress={onPress}>
  13. <Div px={5} flex={1} alignItems="center">
  14. <Image w={46} h={46} rounded="xs" source={{ uri: info.logo }} />
  15. <Text fontSize="xs" textAlign="center" color="gray300">
  16. {info.showName}
  17. </Text>
  18. <Text fontSize="xs" textAlign="center" color="red500">
  19. 1.1km
  20. </Text>
  21. </Div>
  22. </Button>
  23. );
  24. }
  25. export default function RecommendStore() {
  26. const { newMerchants } = useModel(HomeModel, ['newMerchants']);
  27. const navigation = useNavigation();
  28. return (
  29. <Div p={15}>
  30. <Div row>
  31. <Text flex={1} fontSize="xl" textweight="bold">
  32. 新店推荐
  33. </Text>
  34. <Button
  35. bg="white"
  36. fontSize="xs"
  37. color="gray600"
  38. py={5}
  39. px={10}
  40. onPress={() => {
  41. navigation.navigate('MerchantsList');
  42. }}
  43. >
  44. 更多新店&gt;
  45. </Button>
  46. </Div>
  47. <Div row>
  48. {newMerchants.map((item) => {
  49. return (
  50. <CardCom
  51. key={item.id}
  52. info={item}
  53. onPress={() => {
  54. navigation.navigate('MerchantDetail', {
  55. merchantId: item.id,
  56. });
  57. }}
  58. />
  59. );
  60. })}
  61. </Div>
  62. </Div>
  63. );
  64. }
  65. const styles = StyleSheet.create({
  66. image2: {
  67. width: 47,
  68. height: 47,
  69. alignSelf: 'center',
  70. marginHorizontal: 10,
  71. borderRadius: 3,
  72. },
  73. main2: {
  74. marginTop: 7,
  75. paddingHorizontal: 0,
  76. },
  77. card: {
  78. marginVertical: 5,
  79. borderWidth: 0,
  80. elevation: 0,
  81. shadowOffset: {
  82. width: 0,
  83. height: 0,
  84. },
  85. shadowOpacity: 0,
  86. shadowRadius: 0,
  87. },
  88. });