diff --git a/examples/src/example.js b/examples/src/example.js index a6a6ced..c1ed741 100644 --- a/examples/src/example.js +++ b/examples/src/example.js @@ -16,6 +16,7 @@ import { View, } from 'react-native'; import {RichEditor, RichToolbar} from 'react-native-pell-rich-editor'; +import {InsertLinkModal} from './insertLink'; const initHTML = `
Pell.js Rich Editor
@@ -27,6 +28,7 @@ const initHTML = `
class Example extends React.Component { richText = React.createRef(); + linkModal = React.createRef(); constructor(props) { super(props); @@ -39,6 +41,7 @@ class Example extends React.Component { that.onTheme = ::that.onTheme; that.onPressAddImage = ::that.onPressAddImage; that.onInsertLink = ::that.onInsertLink; + that.onLinkDone = ::that.onLinkDone; that.themeChange = ::that.themeChange; } @@ -78,7 +81,12 @@ class Example extends React.Component { } onInsertLink() { - this.richText.current?.insertLink('Google', 'http://google.com'); + // this.richText.current?.insertLink('Google', 'http://google.com'); + this.linkModal.current?.setModalVisible(true); + } + + onLinkDone({title, url}) { + this.richText.current?.insertLink(title, url); } onHome() { @@ -109,6 +117,13 @@ class Example extends React.Component { const themeBg = {backgroundColor}; return ( +