This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1+ ext {
2+ copyEditorHtmlToAppAssets = { dir ->
3+ def fromF = new File (dir, ' /draftjs-html-source/draftjs-source.html' );
4+ def toF = new File (projectDir, ' /src/main/assets/' );
5+ println (' Copying Draft js html asset file from ' + fromF. toString() + ' to ' + toF. toString());
6+
7+ copy {
8+ from fromF
9+ into toF
10+ }
11+ }
12+ }
Original file line number Diff line number Diff line change 11import React , { Component } from "react" ;
2- import { ViewPropTypes } from "react-native" ;
2+ import { ViewPropTypes , Platform } from "react-native" ;
33import WebView from "react-native-webview" ;
44import PropTypes from "prop-types" ;
55
6- const draftJsHtml = require ( "./draftjs-html-source/index .html" ) ;
6+ const draftJsHtml = require ( "./draftjs-html-source/draftjs-source .html" ) ;
77
88class RNDraftView extends Component {
99 static propTypes = {
@@ -66,7 +66,6 @@ class RNDraftView extends Component {
6666 blockRenderMap,
6767 onEditorReady = ( ) => null
6868 } = this . props ;
69- onEditorReady ( ) ;
7069 if ( defaultValue ) {
7170 this . executeScript ( "setDefaultValue" , defaultValue ) ;
7271 }
@@ -93,6 +92,7 @@ class RNDraftView extends Component {
9392 console . error ( e ) ;
9493 }
9594 }
95+ onEditorReady ( ) ;
9696 } ;
9797
9898 focus = ( ) => {
@@ -109,7 +109,14 @@ class RNDraftView extends Component {
109109 < WebView
110110 ref = { this . _webViewRef }
111111 style = { style }
112- source = { draftJsHtml }
112+ source = {
113+ Platform . OS === "ios"
114+ ? draftJsHtml
115+ : { uri : "file:///android_asset/draftjs-source.html" }
116+ }
117+ useWebKit = { true }
118+ keyboardDisplayRequiresUserAction = { false }
119+ originWhitelist = { [ "*" ] }
113120 onMessage = { this . _onMessage }
114121 />
115122 ) ;
You can’t perform that action at this time.
0 commit comments