https://github.com/jeduan/react-native-htmltext2
https://github.com/jeduan/react-native-htmltext2
react-native
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jeduan/react-native-htmltext2
- Owner: jeduan
- Created: 2016-03-30T01:05:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T21:43:20.000Z (over 10 years ago)
- Last Synced: 2025-04-01T19:53:50.730Z (over 1 year ago)
- Topics: react-native
- Language: JavaScript
- Size: 84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-htmltext
WIP: Experiment to use HTML like markup to create stylized text in react-native.
## Why?
React Native provide a Text element for stylized text. Instead of using ``NSAttributedString``,
you creat nested Text:
```
I am bold
and red
```
While this approach is excellent for static interface text, what if we have dynamic text with format we
do not know until we use it? ``HtmlText`` is a component to present a limited subset of HTML as
React Native views.
**Important**: This is not going to replace your ``WebView`` for HTML rendering, instead it use a
limited subset of HTML and try to present it using native ``Text`` elements in a reasonable way.
## Example
### Input
```javascript
render: function() {
var html = `
Hello world world foo bar hahh
`
return (
);
}
```
### Input
```javascript
render: function() {
var html = `
Hello world world foo
bar hahh
`
return (
);
}
```
