Skip to content

Commit

Permalink
fix: fix resize mode crash on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Mar 31, 2024
1 parent ba59f3c commit 2fc0c7b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
setViewBorderRadius(view, borderRadius.toInt())
}

view.scaleType = RESIZE_MODE[resizeMode]
if (RESIZE_MODE.containsKey(resizeMode)) {
view.scaleType = RESIZE_MODE[resizeMode]
} else {
view.scaleType = ScaleType.FIT_CENTER
}

val drawablePlaceholder: Drawable? = base64Placeholder?.let { getDrawableFromBase64(it, view) }
val failureDrawable: Drawable? = failureImage?.let { getDrawableFromBase64(it, view) }
Expand Down
40 changes: 20 additions & 20 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { ImageStyle, requireNativeComponent } from 'react-native';

export type IOSImageResizeMode = 'fill'
| 'contain'
| 'cover'
| 'center'
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'topLeft'
| 'topRight'
| 'bottomLeft'
| 'bottomRight'
export type IOSImageResizeMode =
| 'fill'
| 'contain'
| 'cover'
| 'center'
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'topLeft'
| 'topRight'
| 'bottomLeft'
| 'bottomRight';

export type AndroidImageResizeMode = 'fill'
| 'contain'
| 'cover'
| 'center'
| 'top'
| 'bottom'
| 'left'
| 'right'
export type AndroidImageResizeMode =
| 'fill'
| 'contain'
| 'cover'
| 'center'
| 'top'
| 'bottom';

/*
* @property {string} url - URL of the image **required**
Expand Down

0 comments on commit 2fc0c7b

Please sign in to comment.