Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set stretch mode in updateViewSize #38

Conversation

tomups
Copy link

@tomups tomups commented Dec 29, 2020

Should fix #37 for Android.

I can't currently build nor test iOS, so would be good to know if #37 even happens in iOS at all or not. A friend helped me test in iOS and this bug is not present there, it's only in Android.

I am not sure if this is the best solution, I see that the scale types used in the plug-in come from com.facebook.drawee.drawable.ScalingUtils.ScaleType but when using those in setScaleType, I was getting a "wrong parameter" error from Android, only using the types from android.widget.ImageView.ScaleType worked.

@farfromrefug
Copy link
Member

@tomtastico did you try it? As per fresco doc this is not the right way to do it. I am waiting on an answer from the fresco repo here facebook/fresco#2565

@tomups
Copy link
Author

tomups commented Dec 29, 2020

Yes it works for me like this:

image

I suspect it's not the most correct way, but if I use Fresco's StyleType for setScaleType the app crashes and in logcat I get:

JNI DETECTED ERROR IN APPLICATION: bad arguments passed to void android.widget.ImageView.setScaleType(android.widget.ImageView$ScaleType) (see above for details)

@tomups
Copy link
Author

tomups commented Dec 30, 2020

Also not sure what is going on with the image borders with this fix, it's like the image is drawn over them...

@farfromrefug
Copy link
Member

@tomtastico thanks i ll merge it for now and wait for a better answer from the fresco team.
Not sure about the borders. Have to think about it

@farfromrefug farfromrefug merged commit d843df4 into nativescript-community:master Dec 30, 2020
@tomups
Copy link
Author

tomups commented Dec 30, 2020

@farfromrefug I think I found a better way, please check the new merge request #39 , this one uses Fresco, but I could not test it because somehow my test app has broken and I can't seem to run it again (getting TypeError: Cannot read property 'imagepipeline' of undefined no matter what I try...). If you can give it a test and see if it works the same...

@tomups
Copy link
Author

tomups commented Dec 30, 2020

I fixed my test app, it seems this doesn't work 😞 So skip the merge request, I will close it. No idea how to do it with Fresco...

@farfromrefug
Copy link
Member

@tomtastico just so you know i rollbacked your PR. Found the right way to fix the original issue. It has been published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stretch setting not working with ImageSource as src
3 participants