react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Flexbox] How to properly wrap text elements when mixed with image elements

Open janmonschke opened this issue 11 years ago • 7 comments

Hey,

I was looking for a trick to make a group of Text elements that are mixed with Image elements (for icons in text) wrap as if they were normal Text elements.

screen shot 2015-06-25 at 16 08 00 For the example app see: https://rnplay.org/apps/PRQO0Q

The text does not wrap.

If I set the container's flexWrap to wrap it cuts off the line, rather then wrapping the elements:

screen shot 2015-06-25 at 16 09 34

What would you recommend in this case? Use an icon-font?

janmonschke avatar Jun 25 '15 14:06 janmonschke

@janmonschke Did you ever find a solution to this issue? I'm running into something similar when trying to turn web urls inside a paragraph of text into tappable links. Thanks!

udfalkso avatar Sep 20 '15 01:09 udfalkso

@janmonschke Same here - please respond if you found a way around... Thank you in advance!

yuriyvl avatar Nov 25 '15 05:11 yuriyvl

@janmonschke @udfalkso @yuriyvl Are these icons included in some iconic font ? If so ,you should just use these iconic font . Check this out https://github.com/sospartan/react-native-iconic-font

sospartan avatar Nov 25 '15 06:11 sospartan

On iOS I believe Images within Text are now supported.

From a practical standpoint I am going to use a custom icon font for Android. It's simple and should work well.

ide avatar Nov 25 '15 15:11 ide

@sospartan - thanks for pointing out the iconic font! But unfortunately it does not fit my use case. In fact I was hoping I could place any image of my choice along side the text.

@ide - We do have a working solution with a custom native implementation (we could bridge that class over). But I was wondering if there is a "React Native way" for this, so we don't have to resort to custom modules.

yuriyvl avatar Nov 28 '15 04:11 yuriyvl

@facebook-github-bot stack-overflow

bestander avatar Mar 20 '16 18:03 bestander

Hey @janmonschke and thanks for posting this! @bestander tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.

facebook-github-bot avatar Mar 20 '16 18:03 facebook-github-bot