2021-11-17 19:59:53 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Image } from 'react-native';
|
|
|
|
import { FastImageProps } from '@rocket.chat/react-native-fast-image';
|
|
|
|
|
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 {
|
2020-07-17 17:39:06 +00:00
|
|
|
const FastImage = require('@rocket.chat/react-native-fast-image').default;
|
2020-06-26 20:22:56 +00:00
|
|
|
Component = FastImage;
|
|
|
|
}
|
|
|
|
return Component;
|
|
|
|
};
|