xref: /MusicFree/src/components/base/fastImage.tsx (revision 1574be2be30dccf99989a1912b89911f5d39b100)
1*1574be2bS猫头猫import React from 'react';
2*1574be2bS猫头猫import {StyleSheet, Text, View} from 'react-native';
3*1574be2bS猫头猫import rpx from '@/utils/rpx';
4*1574be2bS猫头猫import FastImage, {FastImageProps} from 'react-native-fast-image';
5*1574be2bS猫头猫
6*1574be2bS猫头猫interface IFastImageProps {
7*1574be2bS猫头猫  style: FastImageProps['style'];
8*1574be2bS猫头猫  defaultSource?: FastImageProps['defaultSource'];
9*1574be2bS猫头猫  emptySrc?: number;
10*1574be2bS猫头猫  uri?: string;
11*1574be2bS猫头猫}
12*1574be2bS猫头猫export default function (props: IFastImageProps) {
13*1574be2bS猫头猫  const {style, emptySrc, uri, defaultSource} = props ?? {};
14*1574be2bS猫头猫  const source = uri
15*1574be2bS猫头猫    ? {
16*1574be2bS猫头猫        uri,
17*1574be2bS猫头猫      }
18*1574be2bS猫头猫    : emptySrc;
19*1574be2bS猫头猫  return (
20*1574be2bS猫头猫    <FastImage
21*1574be2bS猫头猫      style={style}
22*1574be2bS猫头猫      source={source}
23*1574be2bS猫头猫      defaultSource={defaultSource}></FastImage>
24*1574be2bS猫头猫  );
25*1574be2bS猫头猫}
26*1574be2bS猫头猫
27*1574be2bS猫头猫const style = StyleSheet.create({
28*1574be2bS猫头猫  wrapper: {
29*1574be2bS猫头猫    width: rpx(750),
30*1574be2bS猫头猫  },
31*1574be2bS猫头猫});
32