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

Commit

Permalink
Use community WebView fork (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahstro authored and simison committed Sep 5, 2019
1 parent 1ad239d commit 2a10e7e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
22 changes: 7 additions & 15 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@

// External dependencies
import React from 'react';
import {
Alert,
BackHandler,
Linking,
Platform,
StatusBar,
StyleSheet,
View,
WebView,
} from 'react-native';
import { Alert, BackHandler, Linking, Platform, StatusBar, StyleSheet, View } from 'react-native';
import { WebView } from 'react-native-webview';
import Constants from 'expo-constants';
import { Notifications } from 'expo';

Expand Down Expand Up @@ -276,12 +268,12 @@ export default class App extends React.Component {
console.log('handleLoadEnd');
this.webView.injectJavaScript(
// This is needed because we want to subscribe notifications only
// if user is authenticated window.postMessage accepts one
// argument, data, which will be available on the event object,
// event.nativeEvent.data. data must be a string.
// if user is authenticated window.ReactNativeWebView.postMessage
// accepts one argument, data, which will be available on the event
// object, event.nativeEvent.data. data must be a string.
`
if (window.user && window.user._id && typeof window.postMessage === 'function') {
window.postMessage('{ "action": "authenticated" }');
if (window.user && window.user._id && typeof window.ReactNativeWebView.postMessage === 'function') {
window.ReactNativeWebView.postMessage('{ "action": "authenticated" }');
}
${this.appInfoJavaScript}
`
Expand Down
17 changes: 14 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"react": "16.8.3",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-web": "^0.11.4"
"react-native-web": "^0.11.4",
"react-native-webview": "^5.8.2"
},
"devDependencies": {
"babel-preset-expo": "^5.1.1",
Expand Down

0 comments on commit 2a10e7e

Please sign in to comment.