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

[BUG] BottomSheetDialogFragment jumps to top when using CardInputWidget with co-branded cards. #9130

Open
rscherf opened this issue Aug 27, 2024 · 0 comments
Labels

Comments

@rscherf
Copy link

rscherf commented Aug 27, 2024

Summary

I believe this was introduced with #8625. I am using the CardInputWidget in a BottomSheetDialogFragment to comply with the co-badged card compliance requirements. As you can see in the following videos, when the CardInputWidget refreshes to display the card selection dropdown, the BottomSheetDialogFragment shifts to the top, then back to the bottom as typing continues. I've tried adjusting the SoftInputMode, but nothing works.

Code to reproduce

public class CardInputBottomSheet extends BottomSheetDialogFragment {
    private CardInputWidget cardInputWidget;
    private MaterialButton chargeButton;
    private OnViewCreatedListener viewCreatedListener;

    public interface OnViewCreatedListener {
        void onViewCreated();
    }

    public void setOnViewCreatedListener(OnViewCreatedListener listener) {
        this.viewCreatedListener = listener;
    }

    public MaterialButton getChargeButton() {
        return chargeButton;
    }

    public CardInputWidget getCardInputWidget() {
        return cardInputWidget;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.pv_stripe_card_input_widget, container, false);

        cardInputWidget = view.findViewById(R.id.cardInputWidget);
        chargeButton = view.findViewById(R.id.chargeButton);

        if (viewCreatedListener != null) {
            viewCreatedListener.onViewCreated();
        }

        return view;
    }

    @Override
    public void onStart() {
        super.onStart();
        BottomSheetDialog dialog = (BottomSheetDialog) getDialog();
        FrameLayout bottomSheet = dialog.findViewById(com.google.android.material.R.id.design_bottom_sheet);
        BottomSheetBehavior<View> behavior = BottomSheetBehavior.from(bottomSheet);
        behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        behavior.setSkipCollapsed(false);
    }

    @Override
    public void onResume() {
        super.onResume();
        getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    }
}

Android version

compileSdk 34

Impacted devices

The videos were from the Emulator.

Installation method

implementation('com.stripe:stripe-android:20.48.6')

SDK classes

CardInputWidget

Video

US video (view does not need to refresh):
us.webm

EUR video (view needs to refresh to show dropdown):
eur.webm

Other information

@rscherf rscherf added the bug label Aug 27, 2024
@samer-stripe samer-stripe changed the title [BUG] [BUG] BottomSheetDialogFragment jumps to top when using CardInputWidget with co-branded cards. Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant