-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[Text] Text doesn't wrap #1438
Comments
@bogdantmm92 - can you post a complete minimal example on rnplay.org please? |
@bogdantmm92 - the problem is that it won't wrap because the |
Thanks for testing & fixing this so fast! Really appreciate it! |
Try add |
@peter4k That's not works in my case.
|
@mvnnn You have to add it to your component, like:
|
@peter4k thanks, I also try this but that's not working inside |
Hey there @mvnnn, I was able to get this to work by adding a 'flex: 1' property to the text element. Hopefully it works in your situation, as well.
|
I think this also work
|
I tried @a11y1337 's method and it didn't work for me. I have a situation where I have text sitting in a Markup: <View style={styles.container}>
<AlbumCover
image={album_cover}
width={smallAlbumCover}
height={smallAlbumCover}
borderRadius={6}
/>
<View style={styles.info}>
<Text style={styles.title} allowFontScaling={false}>{title}</Text>
<Text style={styles.author} allowFontScaling={false}>{author}</Text>
</View>
</View> Styles: export default StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
},
info: {
flexGrow: 1,
marginLeft: gutter,
},
title: {
fontSize: 16,
fontFamily: sansSerifLight,
color: nearlyBlack,
},
author: {
fontSize: 12,
fontFamily: sansSerif,
color: greyishBrown,
}
}); As I said, I tried all of the the suggestions here and nothing seemed to work. WHAT DID WORK was adding a info: {
width: 0,
flexGrow: 1,
marginLeft: gutter,
}, and voilà: |
@dwilt That helped! |
@a11y1337 ... that saved me ton of headache! thank you. |
thanks a lot, it is great help for me! |
@dwilt thanks for the solution. By the way what does the flexGrow do? I check it https://facebook.github.io/react-native/docs/layout-props.html there and it give me nothing. thanks |
@IrvanWijaya read this guide which is probably implemented the same way on React Native. |
Hello All, |
Solution found in this link: facebook/react-native#1438
Hi all, Text supports
|
@dabit1 thanks! Example that works: Code
Styles
|
After a bit of hard time I've found out that adding |
So far @gusgard answer always worked for me but I just faced this issue and despite all of the documented solution no one actually worked except for that one : I found this gem https://stackoverflow.com/questions/38233789/react-native-view-auto-width-by-text-inside. the accepted answer tells us that 👍
I don't know you but I really didn't know. Just tested it and it worked like a charm. |
@pie6k solution is the best subjectively approach but put it on the |
@pie6k You saved my day. Many thanks for your sharing! |
this worked for me:
|
All of the above solutions didn't work for me, I had a fairly complicated view hierarchy, simpler versions always worked as expected. Also, I was using The correct solution (for me) was to ensure that I had So - check your view hierarchy, you can do this in the browser using the Element Inspector (Computed Styles), just walk up from the non-wrapping node and check for NB: |
@dmeehan1968 your solution solved this problem on one occasion thank you ! There are a lot of solutions to this problem |
This commit fixes a visual bug that caused text not to wrap properly for some paragraphs. I was able to solve this thanks to this thread: <facebook/react-native#1438>
|
http://puu.sh/i407j/805ec722a0.png
Text doesn't wrap when it's wrapped inside :
The text was updated successfully, but these errors were encountered: