@umituz/react-native-image 1.3.15 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-image",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "Image manipulation and viewing for React Native apps - resize, crop, rotate, flip, compress, gallery viewer",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -81,6 +81,7 @@ export { ImageGallery, type ImageGalleryProps } from './presentation/components/
81
81
  export { TextEditorSheet, type TextEditorSheetProps } from './presentation/components/editor/TextEditorSheet';
82
82
  export { StickerPickerSheet, type StickerPickerSheetProps } from './presentation/components/editor/StickerPickerSheet';
83
83
  export { FilterPickerSheet, type FilterPickerSheetProps } from './presentation/components/editor/FilterPickerSheet';
84
+ export { AtomicImage, type AtomicImageProps } from './presentation/components/image/AtomicImage';
84
85
 
85
86
  export { useImage } from './presentation/hooks/useImage';
86
87
  export { useImageTransform } from './presentation/hooks/useImageTransform';
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { Image as ExpoImage, ImageProps as ExpoImageProps } from 'expo-image';
3
+ import { StyleSheet, ViewStyle } from 'react-native';
4
+
5
+ export type AtomicImageProps = ExpoImageProps & {
6
+ rounded?: boolean;
7
+ };
8
+
9
+ export const AtomicImage: React.FC<AtomicImageProps> = ({
10
+ style,
11
+ rounded,
12
+ contentFit = 'cover',
13
+ transition = 300,
14
+ ...props
15
+ }) => {
16
+ const flattenedStyle = StyleSheet.flatten(style) as ViewStyle;
17
+
18
+ return (
19
+ <ExpoImage
20
+ style={[
21
+ style,
22
+ rounded && { borderRadius: flattenedStyle?.width ? Number(flattenedStyle.width) / 2 : 9999 }
23
+ ]}
24
+ contentFit={contentFit}
25
+ transition={transition}
26
+ {...props}
27
+ />
28
+ );
29
+ };