klarna / klarna-mobile-sdk

Klarna Mobile SDK for iOS
https://docs.klarna.com/mobile-sdk/ios/
Apache License 2.0
29 stars 12 forks source link

Android: KlarnaCheckoutView and WRAP_CONTENT layout params #178

Open erik-kallen opened 1 year ago

erik-kallen commented 1 year ago

Describe the bug For my life, I just can't make the KlarnaCheckoutView size dynamically to its content.

I have a React Native application, that I am trying to add the KlarnaCheckoutView to. The problem is that I want the containing view to automatically resize to the current size of the KlarnaCheckoutView.

What I am doing is

public class KlarnaCheckoutViewWrapper extends FrameLayout {
    public KlarnaCheckoutViewWrapper(ThemedReactContext context) {
        super(context);
        setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        mKlarnaCheckout = new KlarnaCheckoutView(context.getCurrentActivity());
        mKlarnaCheckout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        addView(mKlarnaCheckout);
    }
}

but whatever I do, the KlarnaCheckoutView always has 0 height.

Expected behavior I would expect the KlarnaCheckoutView to report a height greater than zero

Device and version:

Merchant Name Rather not say

Impact Level Blocker