Skip to content

Commit

Permalink
chore: added tintColor prop on source image
Browse files Browse the repository at this point in the history
  • Loading branch information
Efstathios Ntonas committed May 11, 2023
1 parent 457fcff commit 8c91921
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ await CacheManager.isImageCached(uri);
| `onLoadEnd` | `Func` | Invoked when load either succeeds or fails |
| `resizeMode` | `String` | React native Image component [resizeMode](https://reactnative.dev/docs/image#resizemode) defaults to `contain` |
| `testID` | `String` | testID, useful for tests |
| `tintColor` | `String` | tintColor of the source image |
| `style` | `Object` | `source` AND `thumbnailSource` image style |
| `options` | `Object` | custom options for the fetch image http request eg. `{headers:{}, body:{}}` |
| `accessibilityHint` | `string` | accessibility hint for `source` (optional) |
Expand Down
4 changes: 3 additions & 1 deletion src/CachedImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function useStateIfMounted<S>(
const [state, setState] = React.useState(initialState);

const newSetState = useCallback(
value => {
(value: any) => {
if (isComponentMounted.current) {
setState(value);
}
Expand Down Expand Up @@ -231,6 +231,8 @@ const CachedImage = (props: IProps & typeof defaultProps) => {
onLoad={onImageLoad}
onLoadEnd={props.onLoadEnd}
resizeMode={resizeMode || 'contain'}
// @ts-ignore, reanimated image doesn't have tintColor typing
tintColor={props.tintColor}
// @ts-ignore
source={imageSource}
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface IProps {
testID?: string;
thumbnailAnimationDuration?: number;
thumbnailSource?: string;
tintColor?: string;
}

export interface Config {
Expand Down

0 comments on commit 8c91921

Please sign in to comment.