diff --git a/ReactNativeClient/lib/components/note-body-viewer.js b/ReactNativeClient/lib/components/note-body-viewer.js index b76d12a10..aa18411fe 100644 --- a/ReactNativeClient/lib/components/note-body-viewer.js +++ b/ReactNativeClient/lib/components/note-body-viewer.js @@ -61,9 +61,9 @@ class NoteBodyViewer extends Component { }, 100); }, highlightedKeywords: this.props.highlightedKeywords, - resources: this.props.noteResources, // await shared.attachedResources(bodyToRender), + resources: this.props.noteResources, codeTheme: theme.codeThemeCss, - postMessageSyntax: 'window.ReactNativeWebView.postMessage', + postMessageSyntax: 'window.joplinPostMessage_', }; const result = await this.markupToHtml_.render( @@ -82,6 +82,9 @@ class NoteBodyViewer extends Component { const injectedJs = []; injectedJs.push(shim.injectedJs('webviewLib')); + // Note that this postMessage function accepts two arguments, for compatibility with the desktop version, but + // the ReactNativeWebView actually supports only one, so the second arg is ignored (and currently not needed for the mobile app). + injectedJs.push('window.joplinPostMessage_ = (msg, args) => { console.info("AAAAAAAAAAAAAAAAA"); return window.ReactNativeWebView.postMessage(msg); };'); injectedJs.push('webviewLib.initialize({ postMessage: msg => { return window.ReactNativeWebView.postMessage(msg); } });'); injectedJs.push(` const readyStateCheckInterval = setInterval(function() { diff --git a/ReactNativeClient/main.js b/ReactNativeClient/main.js index 236ef98c2..adfc576e5 100644 --- a/ReactNativeClient/main.js +++ b/ReactNativeClient/main.js @@ -8,7 +8,7 @@ // console.disableYellowBox = true -import { YellowBox, AppRegistry, NativeModules } from 'react-native'; +import { YellowBox, AppRegistry } from 'react-native'; YellowBox.ignoreWarnings([ 'Require cycle: node_modules/react-native-', 'Require cycle: node_modules/rn-fetch-blob', @@ -19,11 +19,12 @@ YellowBox.ignoreWarnings([ const { Root } = require('./root.js'); // Disable buggy Fast Refresh -if (__DEV__) { - const { DevSettings } = NativeModules; - DevSettings.setHotLoadingEnabled(false); - DevSettings.setLiveReloadEnabled(false); -} +// NOTE: not working - can make the app go into an infinite crash/restart loop +// if (__DEV__) { +// const { DevSettings } = NativeModules; +// DevSettings.setHotLoadingEnabled(false); +// DevSettings.setLiveReloadEnabled(false); +// } function main() { AppRegistry.registerComponent('Joplin', () => Root);