Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 2a10e7e

Browse files

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

App.js

+7-15
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,8 @@
88

99
// External dependencies
1010
import React from 'react';
11-
import {
12-
Alert,
13-
BackHandler,
14-
Linking,
15-
Platform,
16-
StatusBar,
17-
StyleSheet,
18-
View,
19-
WebView,
20-
} from 'react-native';
11+
import { Alert, BackHandler, Linking, Platform, StatusBar, StyleSheet, View } from 'react-native';
12+
import { WebView } from 'react-native-webview';
2113
import Constants from 'expo-constants';
2214
import { Notifications } from 'expo';
2315

@@ -276,12 +268,12 @@ export default class App extends React.Component {
276268
console.log('handleLoadEnd');
277269
this.webView.injectJavaScript(
278270
// This is needed because we want to subscribe notifications only
279-
// if user is authenticated window.postMessage accepts one
280-
// argument, data, which will be available on the event object,
281-
// event.nativeEvent.data. data must be a string.
271+
// if user is authenticated window.ReactNativeWebView.postMessage
272+
// accepts one argument, data, which will be available on the event
273+
// object, event.nativeEvent.data. data must be a string.
282274
`
283-
if (window.user && window.user._id && typeof window.postMessage === 'function') {
284-
window.postMessage('{ "action": "authenticated" }');
275+
if (window.user && window.user._id && typeof window.ReactNativeWebView.postMessage === 'function') {
276+
window.ReactNativeWebView.postMessage('{ "action": "authenticated" }');
285277
}
286278
${this.appInfoJavaScript}
287279
`

package-lock.json

+14-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"react": "16.8.3",
2121
"react-dom": "^16.8.6",
2222
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
23-
"react-native-web": "^0.11.4"
23+
"react-native-web": "^0.11.4",
24+
"react-native-webview": "^5.8.2"
2425
},
2526
"devDependencies": {
2627
"babel-preset-expo": "^5.1.1",

0 commit comments

Comments
 (0)