From 144474088115a02a47e98362d9ca281c1c7084f8 Mon Sep 17 00:00:00 2001 From: CHEN Jiajie Date: Mon, 3 Jul 2017 14:21:06 +0800 Subject: [PATCH] Added props to customize text content inside Modal --- src/RichTextEditor.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/RichTextEditor.js b/src/RichTextEditor.js index 26199ba3..a91d8aed 100644 --- a/src/RichTextEditor.js +++ b/src/RichTextEditor.js @@ -23,12 +23,26 @@ export default class RichTextEditor extends Component { hiddenTitle: PropTypes.bool, enableOnChange: PropTypes.bool, footerHeight: PropTypes.number, - contentInset: PropTypes.object + contentInset: PropTypes.object, + + //customize link modal + linkTitleText: PropTypes.string, + linkURLText: PropTypes.string, + linkCancelText: PropTypes.string, + linkInsertText: PropTypes.string, + linkUpdateText: PropTypes.string, }; static defaultProps = { contentInset: {}, - style: {} + style: {}, + + //customize link modal + linkTitleText: 'Title', + linkURLText: 'URL', + linkCancelText: 'Cancel', + linkInsertText: 'Insert', + linkUpdateText: 'Update', }; constructor(props) { @@ -92,7 +106,7 @@ export default class RichTextEditor extends Component { const editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing; this.setEditorHeight(editorAvailableHeight); } - + onBridgeMessage(str){ try { const message = JSON.parse(str); @@ -209,7 +223,7 @@ export default class RichTextEditor extends Component { > - Title + {this.props.linkTitleText} - URL + {this.props.linkURLText} - {this._upperCaseButtonTextIfNeeded('Cancel')} + {this._upperCaseButtonTextIfNeeded(this.props.linkCancelText)} - {this._upperCaseButtonTextIfNeeded(this._linkIsNew() ? 'Insert' : 'Update')} + {this._upperCaseButtonTextIfNeeded(this._linkIsNew() ? this.props.linkInsertText : this.props.linkUpdateText)} @@ -352,7 +366,7 @@ export default class RichTextEditor extends Component { selectionChangeListeners: [...this.state.selectionChangeListeners, listener] }); } - + enableOnChange() { this._sendAction(actions.enableOnChange); }