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

When textInput enabled multiline, the field would be hidden by keyboard even it get focused #48

Open
MarkRunWu opened this issue Apr 12, 2019 · 8 comments

Comments

@MarkRunWu
Copy link
Contributor

MarkRunWu commented Apr 12, 2019

as title description.

related issue: facebook/react-native#16826

Reproduce by code example:

// FromScreen.js: append `multiline={true}` to the last one of textinput
  ...
     <FormField index={4} style={styles.input}>
            {props => (
              <View style={styles.inputContainer}>
                <TextInput
                  ref={props.focusableRef}
                  onSubmitEditing={props.onSubmitEditing}
                  blurOnSubmit={props.blurOnSubmit}
                  multiline={true} <---- this line
                  placeholder="Input 5"
                />
              </View>
            )}
       </FormField>
  ...

Result:

The last textInput is focused, but it's behind keyboard.
Simulator Screen Shot - iPhone X - 2019-04-12 at 16 20 10

@louischan-oursky
Copy link
Collaborator

I just tested and it works fine even for multiline TextInput. Have you set autoScrollToFocusedInput to true?

Meanwhile I make the example to reflect you should set autoScrollToFocusedInput to true.

<Form autoScrollToFocusedInput={true}>
  <FormField index={0} />
  <FormField index={1} />
</Form>

@louischan-oursky
Copy link
Collaborator

@cychiuae Any reason why we did not set autoScrollToFocusedInput to true by default?

@MarkRunWu
Copy link
Contributor Author

Amazing it works.

@MarkRunWu
Copy link
Contributor Author

MarkRunWu commented Apr 12, 2019

@louischan-oursky
Found on android it can work without this property, but it would do focus animation twice if it were enabled. So it's better to turn off if it's running on android platform.

@louischan-oursky
Copy link
Collaborator

Thanks for reporting the android issue.

@cychiuae Can you have a look when you have time?

@cychiuae
Copy link
Contributor

Any reason why we did not set autoScrollToFocusedInput to true by default?

It is just a bug

Can you have a look when you have time?

Okay

@cychiuae
Copy link
Contributor

cychiuae commented May 8, 2019

Found on android it can work without this property, but it would do focus animation twice if it were enabled. So it's better to turn off if it's running on android platform.

It seems it will have scrolling twice even disable the option. Btw, you will lose ability to make the next input scroll to visible window automatically if you disable the option

@louischan-oursky
Copy link
Collaborator

It seems that it is not easy to prevent the scroll view from auto scrolling to just focused view https://stackoverflow.com/questions/6176391/stop-scrollview-from-auto-scrolling-to-an-edittext

There are many answers. Some say setting two focus related properties while some say change windowSoftInputMode.

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

No branches or pull requests

3 participants