|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+/**
|
|
|
2
|
+ * Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
3
|
+ *
|
|
|
4
|
+ * This source code is licensed under the MIT license found in the
|
|
|
5
|
+ * LICENSE file in the root directory of this source tree.
|
|
|
6
|
+ *
|
|
|
7
|
+ * @format
|
|
|
8
|
+ * @flow
|
|
|
9
|
+ */
|
|
|
10
|
+
|
|
|
11
|
+import React, {Component} from 'react';
|
|
|
12
|
+import {Text, View} from 'react-native';
|
|
|
13
|
+
|
|
|
14
|
+import WebView from 'react-native-webview';
|
|
|
15
|
+
|
|
|
16
|
+const HTML = `
|
|
|
17
|
+<!DOCTYPE html>\n
|
|
|
18
|
+<html>
|
|
|
19
|
+ <head>
|
|
|
20
|
+ <title>Hello World</title>
|
|
|
21
|
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
22
|
+ <meta name="viewport" content="width=320, user-scalable=no">
|
|
|
23
|
+ <style type="text/css">
|
|
|
24
|
+ body {
|
|
|
25
|
+ margin: 0;
|
|
|
26
|
+ padding: 0;
|
|
|
27
|
+ font: 62.5% arial, sans-serif;
|
|
|
28
|
+ background: transparent;
|
|
|
29
|
+ }
|
|
|
30
|
+ </style>
|
|
|
31
|
+ </head>
|
|
|
32
|
+ <body>
|
|
|
33
|
+ <p>HTML content in transparent body.</p>
|
|
|
34
|
+ </body>
|
|
|
35
|
+</html>
|
|
|
36
|
+`;
|
|
|
37
|
+
|
|
|
38
|
+type Props = {};
|
|
|
39
|
+type State = {
|
|
|
40
|
+ backgroundColor: string,
|
|
|
41
|
+};
|
|
|
42
|
+
|
|
|
43
|
+export default class Background extends Component<Props, State> {
|
|
|
44
|
+ state = {
|
|
|
45
|
+ backgroundColor: '#FF00FF00'
|
|
|
46
|
+ };
|
|
|
47
|
+
|
|
|
48
|
+ render() {
|
|
|
49
|
+ return (
|
|
|
50
|
+ <View>
|
|
|
51
|
+ <View style={{backgroundColor:'red'}}>
|
|
|
52
|
+ <View style={{ height: 120 }}>
|
|
|
53
|
+ <WebView
|
|
|
54
|
+ source={{html: HTML}}
|
|
|
55
|
+ automaticallyAdjustContentInsets={false}
|
|
|
56
|
+ style={{backgroundColor:'#00000000'}}
|
|
|
57
|
+ />
|
|
|
58
|
+ </View>
|
|
|
59
|
+ </View>
|
|
|
60
|
+ <Text>WebView is transparent contained in a View with a red backgroundColor</Text>
|
|
|
61
|
+ </View>
|
|
|
62
|
+ );
|
|
|
63
|
+ }
|
|
|
64
|
+}
|