question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scrolling form TextInput in Scroll View doesn't work when textAlign in set to right or center(android only)

See original GitHub issue

Is this a bug report?

YES

Have you read the Contributing Guidelines?

NO

Environment

Environment: OS: Linux 4.8 Node: 8.6.0 Yarn: 1.1.0 npm: 5.3.0 Watchman: Not Installed Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react-native: 0.48.4 => 0.48.4 react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Target Platform: Android (6.0.1)

Steps to Reproduce

  1. Created a scroll view with some text Input component inside of it
  2. set textAlign : ‘right’ or ‘center’ in text Input styles
  3. try to scroll down or up from inside of text input, but text Input is focused and doesn’t scroll up or down in scroll view the issue is present in android only

Expected Behavior

it must be possible to scroll in the scroll view when you tap a text Input, and then scroll, it works on textAlign : ‘left’,

Actual Behavior

the scrolling doesn’t work if you start scrolling on a text input

Reproducible Demo

cause my country restriction, I don’t have access to expo, so I just shared a small code that reproduce the problem export default class ScrollViewWithTextInput extends React.Component { render() { return ( <ScrollView> <TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /> <TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /><TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /><TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /> <TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /> <TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /><TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /><TextInput style={styles.input} placeholder={'توضیحات'} underlineColorAndroid='transparent' /> </ScrollView> ) }} const styles = StyleSheet.create({ Container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, input: { width: 350, height: 100, margin: 5, borderColor: 'black', borderWidth: 2, textAlign: 'right' }})

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chamilebcommented, Jun 21, 2018

I have been experiencing this issue since yesterday, issue is still alive. i’m using react native 0.53. This is only in android not in ios. The workaround is to add multiline={true} but my problem is it doesn’t help with my scenario i cannot have multiline enabled.

2reactions
ghostcommented, Oct 10, 2017

@Luckygirlllll add multiline={true} , keyboardType={‘default’}, maxLength={10} to textInput props. it should work, i think that maxLength isn’t necessary, but I didn’t check

Read more comments on GitHub >

github_iconTop Results From Across the Web

scrollview can't scroll when focus textinput react native
In my case this was being caused by the alignment of the input text—the issue appears when the text is center-aligned or right-aligned....
Read more >
nested textinput on scrollview react native - You.com | The AI ...
When a TextInput with has textAlign: 'right' inside a ScrollView and you press on it for scrolling it will focus instead (only on...
Read more >
TextInput - React Native
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >
LinearLayout | Android Developers
For example, the snippet above sets android:gravity to "center". ... Allow a user to over-scroll this view only if the content is large...
Read more >
Today's React Native Tip: Keyboard issues in ScrollView
The keyboardShouldPersistTaps property can be set inside the ScrollView. This fixes the double tap issue and ensures that the keyboard doesn't come in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found