Skip to content

Commit

Permalink
Merge pull request #3 from harsh25jai/0.0.1
Browse files Browse the repository at this point in the history
Merging 0.0.7
  • Loading branch information
harsh25jai authored Jun 30, 2021
2 parents 84311c5 + 73bcb3c commit 40c68a9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ npm install --save react-native-advance-image
| resizeMode | enum('cover', 'contain', 'stretch', 'repeat', 'center') | Determines how to resize the image when the frame doesn't match the raw image dimensions. | cover |
| borderRadius | number | Define border Radius for Image | |
| backgroundColor | ColorValue | Define Background Color for Loading Image | |
| loadingType |enum('image', 'skeleton', 'icon', 'indicator', 'none') | Choose Loading type when image will be fetched | indicator |
| loadingType |enum('image', 'indicator', 'none') | Choose a Loading type to be shown when the image will be fetched | indicator |
| loadingIndicatorStyle | Image Style Props |
| loadingImageSource | ImageSource | The image source (either a remote URL or a local file resource) for showing image on Loading. |
| ErrorImageSource | ImageSource | The image source (either a remote URL or a local file resource) for showing image on Error. | |
Expand Down Expand Up @@ -62,15 +62,12 @@ const App = () => {

export default App;
```

[Expo Snack Example](https://snack.expo.io/OylhjVOSVj)
## Peer Dependencies
| Library |
| ------ |
| react |
| react-native
| react-native-skeleton-placeholder |
| prop-types |

| react-native |

## License

Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-advance-image",
"version": "0.0.5",
"version": "0.0.7",
"description": "An Advanced Image component supporting multiple props and methods to show image on react native application in a better way.",
"main": "index.tsx",
"scripts": {
Expand All @@ -12,7 +12,12 @@
"background image",
"react-native",
"react",
"react-component"
"react-component",
"image loader",
"react-native-advance-image",
"custom loader",
"image loader",
"react native image"
],
"author": "Harsh Jaiswal <[email protected]> (https://github.com/harsh25jai)",
"license": "MIT",
Expand All @@ -21,15 +26,11 @@
"url": "https://github.com/harsh25jai/react-native-advance-image"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.11",
"react": "^17.0.1",
"react-native": "^0.64.2",
"react-native-skeleton-placeholder": "^4.0.0"
"react-native": "^0.64.2"
},
"peerDependencies": {
"@react-native-community/masked-view": ">=0.1.11",
"react": ">=16.0.1",
"react-native": ">=0.60.0",
"react-native-skeleton-placeholder": ">=4.0.0"
"react-native": ">=0.60.0"
}
}
20 changes: 9 additions & 11 deletions src/AdvanceImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Image, ActivityIndicator, ImageBackground, StyleProp, ImageStyle, ImageSourcePropType, ImageResizeMode, ColorValue, ImagePropTypes } from 'react-native';
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
// import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
import { defaultError, defaultLoading } from './assets';

interface AdvanceImageProps {
Expand Down Expand Up @@ -80,13 +80,11 @@ interface AdvanceImageProps {
*
* - `image`: A loading image passed through prop loadingImageSource or a default loading image while loading the source image.
*
* - `skeleton`: A placeholder skeleton is shown while loading the image.
*
* - `indicator`: An indicator is shown while loading the image.
*
* - `none`: To display none while loading the image
*/
loadingType?: 'image' | 'skeleton' | 'indicator' | 'none';
loadingType?: 'image' | 'indicator' | 'none';

/**
* Style for Loading Indicator
Expand Down Expand Up @@ -165,13 +163,13 @@ export default function AdvanceImage({
);
}

if (type == 'skeleton') {
return (
<SkeletonPlaceholder>
<View style={style} />
</SkeletonPlaceholder>
);
}
// if (type == 'skeleton') {
// return (
// <SkeletonPlaceholder>
// <View style={style} />
// </SkeletonPlaceholder>
// );
// }

return (
<ActivityIndicator
Expand Down
20 changes: 8 additions & 12 deletions src/AdvanceImageBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,11 @@ interface AdvanceImageProps {
*
* - `image`: A loading image passed through prop loadingImageSource or a default loading image while loading the source image.
*
* - `skeleton`: A placeholder skeleton is shown while loading the image.
*
* - `icon`: An icon is shown while loading the image.
*
* - `indicator`: An indicator is shown while loading the image.
*
* - `none`: To display none while loading the image
*/
loadingType?: 'image' | 'skeleton' | 'icon' | 'indicator' | 'none';
loadingType?: 'image' | 'indicator' | 'none';

/**
* Style for Loading Indicator
Expand Down Expand Up @@ -170,13 +166,13 @@ export default function AdvanceImage({
);
}

if (type == 'skeleton') {
return (
<SkeletonPlaceholder>
<View style={style} />
</SkeletonPlaceholder>
);
}
// if (type == 'skeleton') {
// return (
// <SkeletonPlaceholder>
// <View style={style} />
// </SkeletonPlaceholder>
// );
// }

return (
<ActivityIndicator
Expand Down

0 comments on commit 40c68a9

Please sign in to comment.