react-native-image-sequence icon indicating copy to clipboard operation
react-native-image-sequence copied to clipboard

Set resizeMode / size for the images

Open vpsantos opened this issue 5 years ago • 2 comments

Is that possible to set a resizeMode like Image component?

I have a size defined via style for my ImageSequence component, but on Android the images are being resized according the image and not according my style of parent component. If I add a background color to the ImageSequence, I can see its size is correct. I would like to define how the image is handled there, currently it is like "contain" but I would like something like "cover".

Any suggestion?

vpsantos avatar Jun 21 '19 07:06 vpsantos

Hey, Please is this a thing?

papidb avatar Apr 15 '21 12:04 papidb

I create a patch for fixing this issue on android.

Create a new file (react-native-image-sequence+0.7.0.patch) inside patches folder and paste the below code -

diff --git a/node_modules/react-native-image-sequence/android/src/main/java/dk/madslee/imageSequence/RCTImageSequenceView.java b/node_modules/react-native-image-sequence/android/src/main/java/dk/madslee/imageSequence/RCTImageSequenceView.java
index a072809..da8a906 100644
--- a/node_modules/react-native-image-sequence/android/src/main/java/dk/madslee/imageSequence/RCTImageSequenceView.java
+++ b/node_modules/react-native-image-sequence/android/src/main/java/dk/madslee/imageSequence/RCTImageSequenceView.java
@@ -91,6 +91,8 @@ public class RCTImageSequenceView extends ImageView {
     }
 
     public void setImages(ArrayList<String> uris) {
+        this.setScaleType(ScaleType.FIT_XY);
+        
         if (isLoading()) {
             // cancel ongoing tasks (if still loading previous images)
             for (int index = 0; index < activeTasks.size(); index++) {

iamnamitg avatar Jun 02 '21 10:06 iamnamitg