NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

As a user, in a modal I should be able unset focus from input fields

Open Viraj-10 opened this issue 1 year ago • 0 comments

Discussed in https://github.com/GeekyAnts/NativeBase/discussions/5176

Originally posted by shashank1010 June 8, 2022

Description

When you open the modal for this example https://snack.expo.dev/@shashank1010/modal-checkbox-click-issue

You would notice that the first field has focus. In this example, I simulated a vertical space with a height of 500px and then there is a checkbox. When, the first field has focus and you scroll down to click on the checkbox, modal body scrolls up to the first field.

Also, in this case, after scrolling down, if I click on the modal body itself, even then it scrolls up to the first field. The example in the doc works beautifully, however, only when there is no scroll.

Problem Statement

In a modal that has input fields, scrolling and then clicking outside a field scrolls the modal to the last selected field.

Proposed Solution or API

... <FocusScope contain={visible && props.containScope} . . . .

... </FocusScope>

Alternatives

I've tried all possible hacky solutions to resolve this issue, but the field just keeps retaining focus.

Additional Information

https://snack.expo.dev/@shashank1010/modal-checkbox-click-issue

Viraj-10 avatar Jul 21 '22 12:07 Viraj-10