Skip to content

Commit

Permalink
Merge branch 'shirakaba/animated-support' into shirakaba/animated-sup…
Browse files Browse the repository at this point in the history
…port-fabric

* shirakaba/animated-support:
  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
  • Loading branch information
shirakaba committed Feb 12, 2020
2 parents 76f9b5e + c3977fe commit 2610049
Show file tree
Hide file tree
Showing 67 changed files with 3,898 additions and 376 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)
[![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)
<a href="https://www.npmjs.com/package/react-native-webview"><img src="https://img.shields.io/npm/v/react-native-webview.svg"></a>
[![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
[![Lean Core Extracted](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square)][lean-core-issue]

**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)).

Expand Down Expand Up @@ -101,3 +102,5 @@ MIT
This readme is available in:

- [Brazilian portuguese](docs/README.portuguese.md)

[lean-core-issue]: https://github.com/facebook/react-native/issues/23313
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = function(api) {
presets: ['module:metro-react-native-babel-preset'],
},
},
presets: ['module:metro-react-native-babel-preset'],
};
};
1 change: 1 addition & 0 deletions example/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
64 changes: 64 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# Visual Studio Code
#
.vscode/

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
6 changes: 6 additions & 0 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
159 changes: 159 additions & 0 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import React, {Component} from 'react';
import {
StyleSheet,
SafeAreaView,
Text,
TouchableOpacity,
View,
Keyboard,
Button,
} from 'react-native';

import Alerts from './examples/Alerts';
import Scrolling from './examples/Scrolling';
import Background from './examples/Background';

const TESTS = {
Alerts: {
title: 'Alerts',
testId: 'alerts',
description: 'Alerts tests',
render() {
return <Alerts />;
},
},
Scrolling: {
title: 'Scrolling',
testId: 'scrolling',
description: 'Scrolling event test',
render() {
return <Scrolling />;
},
},
Background: {
title: 'Background',
testId: 'background',
description: 'Background color test',
render() {
return <Background />;
},
},
};

type Props = {};
type State = {restarting: boolean, currentTest: Object};

export default class App extends Component<Props, State> {
state = {
restarting: false,
currentTest: TESTS.Alerts,
};

_simulateRestart = () => {
this.setState({restarting: true}, () => this.setState({restarting: false}));
};

_changeTest = testName => {
this.setState({currentTest: TESTS[testName]});
};

render() {
const {restarting, currentTest} = this.state;
return (
<SafeAreaView style={styles.container}>
<TouchableOpacity
style={styles.closeKeyboardView}
onPress={() => Keyboard.dismiss()}
testID="closeKeyboard"
/>

<TouchableOpacity
testID="restart_button"
onPress={this._simulateRestart}
style={styles.restartButton}
activeOpacity={0.6}>
<Text>Simulate Restart</Text>
</TouchableOpacity>

<View style={styles.testPickerContainer}>
<Button
testID="testType_alerts"
title="Alerts"
onPress={() => this._changeTest('Alerts')}
/>
<Button
testID="testType_scrolling"
title="Scrolling"
onPress={() => this._changeTest('Scrolling')}
/>
<Button
testID="testType_background"
title="Background"
onPress={() => this._changeTest('Background')}
/>
</View>

{restarting ? null : (
<View
testID={`example-${currentTest.testId}`}
key={currentTest.title}
style={styles.exampleContainer}>
<Text style={styles.exampleTitle}>{currentTest.title}</Text>
<Text style={styles.exampleDescription}>
{currentTest.description}
</Text>
<View style={styles.exampleInnerContainer}>
{currentTest.render()}
</View>
</View>
)}
</SafeAreaView>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
padding: 8,
},
exampleContainer: {
padding: 16,
backgroundColor: '#FFF',
borderColor: '#EEE',
borderTopWidth: 1,
borderBottomWidth: 1,
flex: 1,
},
exampleTitle: {
fontSize: 18,
},
exampleDescription: {
color: '#333333',
marginBottom: 16,
},
exampleInnerContainer: {
borderColor: '#EEE',
borderTopWidth: 1,
paddingTop: 10,
flex: 1,
},
restartButton: {
padding: 6,
fontSize: 16,
borderRadius: 5,
backgroundColor: '#F3F3F3',
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'flex-end',
},
closeKeyboardView: {
width: 5,
height: 5,
},
testPickerContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
},
});
55 changes: 55 additions & 0 deletions example/android/app/_BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#

load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")

lib_deps = []

create_aar_targets(glob(["libs/*.aar"]))

create_jar_targets(glob(["libs/*.jar"]))

android_library(
name = "all-libs",
exported_deps = lib_deps,
)

android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)

android_build_config(
name = "build_config",
package = "com.example",
)

android_resource(
name = "res",
package = "com.example",
res = "src/main/res",
)

android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)
Loading

0 comments on commit 2610049

Please sign in to comment.