0.9.2 • Published 5 years ago

react-native-styled-markup v0.9.2

Weekly downloads
46
License
MIT
Repository
github
Last release
5 years ago

react-native-styled-markup

Markup text with formatting capability for react native.

Usage

Check it out on expo.io

import MarkupText from 'react-native-styled-markup';

<MarkupText
  linkEvents={[
    () => alert('The first link is pressed!'),
    () => alert('The second link is pressed!'),
  ]}
  linkTextStyle={{
    textDecorationLine: 'underline',
    color: 'darkblue',
    fontWeight: 'bold',
  }}
  imageSources={[require('./150.png')]}>
  [b]Lorem ipsum dolor[/b] sit amet, consectetur
  [color=#FA5544]adipiscing elit, sed do eiusmod[/color] tempor
  incididunt ut [u]labore et dolore magna[/u] aliqua. Ut enim ad
  [s]minim veniam, quis[/s] nostrud exercitation
  [image=https://via.placeholder.com/150 width=50 height=20
  resizeMode=contain/] ullamco laboris nisi ut [linkedImage width=50
  height=20 resizeMode=contain/] aliquip ex ea commodo consequat. And
  here is a [link]link[/link]! And another [link]link[/link]!
  sit[br]amet,[br]consectetur
</MarkupText>

MarkupText

Properties

PropertyTypeDefaultDescription
textStyleTextStyle | undefined-The text style for the parent Text component
regularTextStyleTextStyle | undefined{ fontSize: 14, lineHeight: 22, letterSpacing: -0.21, color: 'black' }The text style for the unformatted texts
coloredTextStyleTextStyle | undefined-The text style for the colored texts
boldTextStyleTextStyle | undefined{ fontWeight: 'bold' }The text style for the bold texts
italicTextStyleTextStyle | undefined{ fontStyle: 'italic' }The text style for the italic texts
underlineTextStyleTextStyle | undefined{ textDecorationLine: 'underline' }The text style for the underlined texts
strikethroughTextStyleTextStyle | undefined{ textDecorationLine: 'line-through' }The text style for the texts with strikethrough
linkTextStyleTextStyle | undefined-The text style for the texts with links
styleViewStyle | undefined-Container View style
regularColorstring | undefinedblackDefault color for the text
linkEvents() => void | undefined-When link is used in a text, events can be attached to these partial texts with linkEvents through their indices.
imageSourcesImageSourcePropType[] | undefined-When linkedImage is used in a text, local images can be attached to these partial texts with imageSources through their indices.
0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago