I have a React Native app. One of my data fields has multiple lines of text. That is being passed to my form. When the form displays, it uses TextInput with multiline. But it only shows the first two lines of input in the field. When I click on it (giving it focus) it shows all the content. But I have to click on the page to display all the data in that field. So I know the data is there, but by default it will not show all the data.
Any ideas?
Screenshot #1 – This is my list of blog posts. It displays as expected (with an imposed limit on the amount of text to display).
Screenshot #2 - When I click on the blog posts, it shows the form page. But only the first two lines appear (in this case line 2 is blank).
Screenshot #3 - Same page, but after I click somewhere, it populates all the data.
So it is not an issue of state since the data is there. But somehow a restriction on how much data will display by default. That’s my best understanding of what’s going wrong.
This happens whether or not the TextField is set to readonly or not set to readonly.
The code for the TextField …
<ScrollView
style={styles.bodyInput}
showsVerticalScrollIndicator={true}
>
<TextInput
editable={!readOnly}
multiline={true}
placeholder="Text ..."
onChangeText={newText => {
setNewBlogPost({...newBlogPost, body: newText})
}}
defaultValue={newBlogPost.body}
/>
</ScrollView>