Skip to content

Commit c3977fe

Browse files
committed
Merge branch 'master' into shirakaba/animated-support
* master: chore(release): 8.0.6 [skip ci] fix(Android): Revert "Redirected URLs now redirect correctly. (react-native-webview#991)" (react-native-webview#1177) chore(release): 8.0.5 [skip ci] fix(Android): Redirected URLs now redirect correctly. (react-native-webview#991) chore(example): Added three test examples: Alerts, Scrolling, and Background. chore(release): 8.0.4 [skip ci] fix(iOS): Meta method 'UIScrollViewContentInsetAdjustmentBehavior:' conflict warning chore(example): Added example app chore(iOS): Extract wkWebViewConfig setup to setUpWkWebViewConfig function chore(release): 8.0.3 [skip ci] fix(whitelisted origins): Prevent handling of un-whitelisted URLs chore(README): Lean Core badge
2 parents a231d26 + 31d015b commit c3977fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3898
-376
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
55
[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)
66
[![Known Vulnerabilities](https://snyk.io/test/github/react-native-community/react-native-webview/badge.svg?style=flat-square)](https://snyk.io/test/github/react-native-community/react-native-webview)
7-
<a href="https://www.npmjs.com/package/react-native-webview"><img src="https://img.shields.io/npm/v/react-native-webview.svg"></a>
7+
[![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
8+
[![Lean Core Extracted](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square)][lean-core-issue]
89

910
**React Native WebView** is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
1011

@@ -101,3 +102,5 @@ MIT
101102
This readme is available in:
102103

103104
- [Brazilian portuguese](docs/README.portuguese.md)
105+
106+
[lean-core-issue]: https://github.com/facebook/react-native/issues/23313

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module.exports = function(api) {
66
presets: ['module:metro-react-native-babel-preset'],
77
},
88
},
9+
presets: ['module:metro-react-native-babel-preset'],
910
};
1011
};

example/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

example/.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# Visual Studio Code
34+
#
35+
.vscode/
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
42+
43+
# BUCK
44+
buck-out/
45+
\.buckd/
46+
*.keystore
47+
!debug.keystore
48+
49+
# fastlane
50+
#
51+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
52+
# screenshots whenever they are needed.
53+
# For more information about the recommended setup visit:
54+
# https://docs.fastlane.tools/best-practices/source-control/
55+
56+
*/fastlane/report.xml
57+
*/fastlane/Preview.html
58+
*/fastlane/screenshots
59+
60+
# Bundle artifact
61+
*.jsbundle
62+
63+
# CocoaPods
64+
/ios/Pods/

example/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

example/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

example/App.tsx

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
import React, {Component} from 'react';
2+
import {
3+
StyleSheet,
4+
SafeAreaView,
5+
Text,
6+
TouchableOpacity,
7+
View,
8+
Keyboard,
9+
Button,
10+
} from 'react-native';
11+
12+
import Alerts from './examples/Alerts';
13+
import Scrolling from './examples/Scrolling';
14+
import Background from './examples/Background';
15+
16+
const TESTS = {
17+
Alerts: {
18+
title: 'Alerts',
19+
testId: 'alerts',
20+
description: 'Alerts tests',
21+
render() {
22+
return <Alerts />;
23+
},
24+
},
25+
Scrolling: {
26+
title: 'Scrolling',
27+
testId: 'scrolling',
28+
description: 'Scrolling event test',
29+
render() {
30+
return <Scrolling />;
31+
},
32+
},
33+
Background: {
34+
title: 'Background',
35+
testId: 'background',
36+
description: 'Background color test',
37+
render() {
38+
return <Background />;
39+
},
40+
},
41+
};
42+
43+
type Props = {};
44+
type State = {restarting: boolean, currentTest: Object};
45+
46+
export default class App extends Component<Props, State> {
47+
state = {
48+
restarting: false,
49+
currentTest: TESTS.Alerts,
50+
};
51+
52+
_simulateRestart = () => {
53+
this.setState({restarting: true}, () => this.setState({restarting: false}));
54+
};
55+
56+
_changeTest = testName => {
57+
this.setState({currentTest: TESTS[testName]});
58+
};
59+
60+
render() {
61+
const {restarting, currentTest} = this.state;
62+
return (
63+
<SafeAreaView style={styles.container}>
64+
<TouchableOpacity
65+
style={styles.closeKeyboardView}
66+
onPress={() => Keyboard.dismiss()}
67+
testID="closeKeyboard"
68+
/>
69+
70+
<TouchableOpacity
71+
testID="restart_button"
72+
onPress={this._simulateRestart}
73+
style={styles.restartButton}
74+
activeOpacity={0.6}>
75+
<Text>Simulate Restart</Text>
76+
</TouchableOpacity>
77+
78+
<View style={styles.testPickerContainer}>
79+
<Button
80+
testID="testType_alerts"
81+
title="Alerts"
82+
onPress={() => this._changeTest('Alerts')}
83+
/>
84+
<Button
85+
testID="testType_scrolling"
86+
title="Scrolling"
87+
onPress={() => this._changeTest('Scrolling')}
88+
/>
89+
<Button
90+
testID="testType_background"
91+
title="Background"
92+
onPress={() => this._changeTest('Background')}
93+
/>
94+
</View>
95+
96+
{restarting ? null : (
97+
<View
98+
testID={`example-${currentTest.testId}`}
99+
key={currentTest.title}
100+
style={styles.exampleContainer}>
101+
<Text style={styles.exampleTitle}>{currentTest.title}</Text>
102+
<Text style={styles.exampleDescription}>
103+
{currentTest.description}
104+
</Text>
105+
<View style={styles.exampleInnerContainer}>
106+
{currentTest.render()}
107+
</View>
108+
</View>
109+
)}
110+
</SafeAreaView>
111+
);
112+
}
113+
}
114+
115+
const styles = StyleSheet.create({
116+
container: {
117+
flex: 1,
118+
backgroundColor: '#F5FCFF',
119+
padding: 8,
120+
},
121+
exampleContainer: {
122+
padding: 16,
123+
backgroundColor: '#FFF',
124+
borderColor: '#EEE',
125+
borderTopWidth: 1,
126+
borderBottomWidth: 1,
127+
flex: 1,
128+
},
129+
exampleTitle: {
130+
fontSize: 18,
131+
},
132+
exampleDescription: {
133+
color: '#333333',
134+
marginBottom: 16,
135+
},
136+
exampleInnerContainer: {
137+
borderColor: '#EEE',
138+
borderTopWidth: 1,
139+
paddingTop: 10,
140+
flex: 1,
141+
},
142+
restartButton: {
143+
padding: 6,
144+
fontSize: 16,
145+
borderRadius: 5,
146+
backgroundColor: '#F3F3F3',
147+
alignItems: 'center',
148+
justifyContent: 'center',
149+
alignSelf: 'flex-end',
150+
},
151+
closeKeyboardView: {
152+
width: 5,
153+
height: 5,
154+
},
155+
testPickerContainer: {
156+
flexDirection: 'row',
157+
flexWrap: 'wrap',
158+
},
159+
});

example/android/app/_BUCK

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.example",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.example",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

0 commit comments

Comments
 (0)