Ei kuvausta

app.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. View
  6. } from 'react-native';
  7. import RichTextEditor from 'react-native-ZSSRichTextEditor'
  8. export default class RichTextExample extends Component {
  9. constructor(props) {
  10. super(props);
  11. this.getHTML = this.getHTML.bind(this);
  12. }
  13. render() {
  14. return (
  15. <View style={styles.container}>
  16. <RichTextEditor
  17. ref={(r)=>this.richtext = r}
  18. style={styles.richText}
  19. initialHTML={'Hello <b>World</b> <p>this is a new paragraph</p> <p>this is another new paragraph</p>'}
  20. />
  21. </View>
  22. );
  23. }
  24. async getHTML() {
  25. const html = await this.richtext.getHtml();
  26. }
  27. componentDidMount() {
  28. setTimeout(()=>{
  29. this.getHTML();
  30. }, 3000);
  31. }
  32. }
  33. const styles = StyleSheet.create({
  34. container: {
  35. flex: 1,
  36. flexDirection: 'column',
  37. backgroundColor: '#F5FCFF',
  38. paddingTop: 40
  39. },
  40. richText: {
  41. alignItems:'center',
  42. justifyContent: 'center',
  43. backgroundColor: 'transparent',
  44. },
  45. });