If the aspectRatio prop on Android is {width: 9, height: 16} then the "free" aspect ratio is not working when keepAspectRatio is false.
native code responsible:
@ReactProp(name = KEEP_ASPECT_RATIO_PROP)
fun setFixedAspectRatio(view: CropImageView, fixed: Boolean) {
view.setFixedAspectRatio(fixed)
}
@ReactProp(name = ASPECT_RATIO_PROP)
fun setAspectRatio(view: CropImageView, aspectRatio: ReadableMap?) {
if (aspectRatio != null) {
view.setAspectRatio(aspectRatio.getInt("width"), aspectRatio.getInt("height"))
}else {
view.clearAspectRatio() <<<<--------- if we set aspectRatio to null on props it works as charm since we hit here
}
}
Setting {width: 0, height: 0} on Android will throw error that the values must be bigger than 0, on iOS there is no issue with this.
Since types have
aspectRatio?: {
width: number;
height: number;
};
if we set it to null then we get a typing error.
Proposal:
Allow above prop to accept null.
edit: disregard the issue, i've just used undefined :face-palm:
I think this should be documented though, maybe the user wants to change the ratio on the fly as per the gifs on README
If the
aspectRatio
prop on Android is{width: 9, height: 16}
then the "free" aspect ratio is not working whenkeepAspectRatio
isfalse
.native code responsible:
Setting
{width: 0, height: 0}
on Android will throw error that the values must be bigger than 0, on iOS there is no issue with this.Since types have
if we set it to
null
then we get a typing error.Proposal: Allow above prop to accept null.
edit: disregard the issue, i've just used
undefined
:face-palm:I think this should be documented though, maybe the user wants to change the ratio on the fly as per the gifs on README