No Description

index.ios.js 1.1KB

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