-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebview.js
More file actions
56 lines (46 loc) · 1.73 KB
/
webview.js
File metadata and controls
56 lines (46 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, { Component } from 'react';
import { WebView } from 'react-native';
import { StackActions } from 'react-navigation'
import firebase from 'react-native-firebase'
export default class App extends React.Component {
static navigationOptions = {
header: null,
};
constructor() {
super();
this.state = {
// firebase things?
link: 'https://tedarik.sefamerve.com',
};
}
async componentDidMount() {
const { navigation, screenProps } = this.props
if (screenProps.webViewLink != null) {
this.setState({ link: screenProps.webViewLink })
console.log("webview:" + screenProps.webViewLink)
}
this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen: NotificationOpen) => {
// Get the action triggered by the notification being opened
const action = notificationOpen.action;
// Get information about the notification that was opened
const notification: Notification = notificationOpen.notification;
if (notification.data.link) {
this.setState({ link: notification.data.link })
}
});/*
const gelenLink = this.props.navigation.getParam('webViewLink', 'http://www.google.com/')
console.log("webviewden bildiriyorum: "+gelenLink)
this.setState({link: gelenLink})*/
}
componentWillUnmount() {
this.notificationOpenedListener();
}
render() {
return (
<WebView
source={{ uri: this.state.link }}
style={{ marginTop: 20 }}
/>
);
}
}