2021-11-17 19:59:53 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Image } from 'react-native';
|
2022-05-31 16:08:18 +00:00
|
|
|
import { FastImageProps } from 'react-native-fast-image';
|
2021-11-17 19:59:53 +00:00
|
|
|
|
2020-06-26 20:22:56 +00:00
|
|
|
import { types } from './types';
|
|
|
|
|
2021-11-17 19:59:53 +00:00
|
|
|
export const ImageComponent = (type?: string): React.ComponentType<Partial<Image> | FastImageProps> => {
|
2020-06-26 20:22:56 +00:00
|
|
|
let Component;
|
|
|
|
if (type === types.REACT_NATIVE_IMAGE) {
|
|
|
|
const { Image } = require('react-native');
|
|
|
|
Component = Image;
|
|
|
|
} else {
|
2022-05-31 16:08:18 +00:00
|
|
|
const FastImage = require('react-native-fast-image');
|
2020-06-26 20:22:56 +00:00
|
|
|
Component = FastImage;
|
|
|
|
}
|
|
|
|
return Component;
|
|
|
|
};
|