admin管理员组文章数量:1397192
I'm currently building an app that allows a user to call API endpoints and display the JSON API response in an uneditable text input.
The issue I'm facing is when the keyboard is disabled I'm able to scroll inside the text input box but when editable is set to false and the keyboard doesn't show up then I'm unable to scroll inside the text input
<TextInput
multiline={true}
style={styles.multilineText}
value={JSON.stringify([this.state.apiResponse], null, '\t')}
editable={false}
/>
Please help
I'm currently building an app that allows a user to call API endpoints and display the JSON API response in an uneditable text input.
The issue I'm facing is when the keyboard is disabled I'm able to scroll inside the text input box but when editable is set to false and the keyboard doesn't show up then I'm unable to scroll inside the text input
<TextInput
multiline={true}
style={styles.multilineText}
value={JSON.stringify([this.state.apiResponse], null, '\t')}
editable={false}
/>
Please help
Share Improve this question edited Feb 8, 2019 at 12:05 Firdous nath 1,5871 gold badge17 silver badges40 bronze badges asked Feb 7, 2019 at 22:20 Chris MarshallChris Marshall 8082 gold badges13 silver badges31 bronze badges 3- 1 If you want to display non editable text , why don't you use simple Text ponent inside ScrollView ! – Firdous nath Commented Feb 8, 2019 at 11:27
- Very good point and a massive oversight on my part done the trick, cheers – Chris Marshall Commented Feb 8, 2019 at 19:56
- I am glad to help, you may upvote my ment :) – Firdous nath Commented Feb 9, 2019 at 5:01
1 Answer
Reset to default 4Making the text input to scroll in react native, you have to add numberOflines to it, this is the property which takes the value as int, how much lines you want to display in text input you have to provide the number and after that, the text input will get scroll property automatically.
<TextInput
{...this.props} // Inherit any props passed to it; e.g., multiline, numberOfLines below
editable = {false}
multiline = {true}
numberOfLines={3}
/>
本文标签:
版权声明:本文标题:javascript - React-Native multiline TextInput component: how to allow scroll when editable set to false - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744149837a2593010.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论