Merge pull request #1 from react-native-community/master
Merge with master
169
.eslintrc
@ -1,170 +1,3 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"jasmine": true
|
||||
},
|
||||
"ecmaFeatures": {
|
||||
"arrowFunctions": true,
|
||||
"blockBindings": true,
|
||||
"classes": true,
|
||||
"defaultParams": true,
|
||||
"destructuring": true,
|
||||
"forOf": true,
|
||||
"generators": false,
|
||||
"modules": true,
|
||||
"objectLiteralComputedProperties": true,
|
||||
"objectLiteralDuplicateProperties": false,
|
||||
"objectLiteralShorthandMethods": true,
|
||||
"objectLiteralShorthandProperties": true,
|
||||
"spread": true,
|
||||
"superInFunctions": true,
|
||||
"templateStrings": true,
|
||||
"jsx": true
|
||||
},
|
||||
"rules": {
|
||||
/**
|
||||
* Strict mode
|
||||
*/
|
||||
// babel inserts "use strict"; for us
|
||||
// http://eslint.org/docs/rules/strict
|
||||
"strict": [2, "never"],
|
||||
|
||||
/**
|
||||
* ES6
|
||||
*/
|
||||
"no-var": 0, // http://eslint.org/docs/rules/no-var
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*/
|
||||
"no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
|
||||
"no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
|
||||
"no-unused-vars": [0, { // http://eslint.org/docs/rules/no-unused-vars
|
||||
"vars": "local",
|
||||
"args": "after-used"
|
||||
}],
|
||||
"no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
|
||||
|
||||
/**
|
||||
* Possible errors
|
||||
*/
|
||||
"comma-dangle": [2, "always-multiline"], // http://eslint.org/docs/rules/comma-dangle
|
||||
"no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign
|
||||
"no-console": 0, // http://eslint.org/docs/rules/no-console
|
||||
"no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
|
||||
"no-alert": 1, // http://eslint.org/docs/rules/no-alert
|
||||
"no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition
|
||||
"no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys
|
||||
"no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
|
||||
"no-empty": 2, // http://eslint.org/docs/rules/no-empty
|
||||
"no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
|
||||
"no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
|
||||
"no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
|
||||
"no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
|
||||
"no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
|
||||
"no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp
|
||||
"no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace
|
||||
"no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls
|
||||
"no-reserved-keys": 0, // http://eslint.org/docs/rules/no-reserved-keys
|
||||
"no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays
|
||||
"no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable
|
||||
"use-isnan": 2, // http://eslint.org/docs/rules/use-isnan
|
||||
"block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var
|
||||
|
||||
/**
|
||||
* Best practices
|
||||
*/
|
||||
"consistent-return": 2, // http://eslint.org/docs/rules/consistent-return
|
||||
"curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly
|
||||
"default-case": 2, // http://eslint.org/docs/rules/default-case
|
||||
"dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation
|
||||
"allowKeywords": true
|
||||
}],
|
||||
"eqeqeq": ["error", "smart"], // http://eslint.org/docs/rules/eqeqeq
|
||||
"guard-for-in": 2, // http://eslint.org/docs/rules/guard-for-in
|
||||
"no-caller": 2, // http://eslint.org/docs/rules/no-caller
|
||||
"no-else-return": 2, // http://eslint.org/docs/rules/no-else-return
|
||||
"no-eq-null": 0, // http://eslint.org/docs/rules/no-eq-null
|
||||
"no-eval": 2, // http://eslint.org/docs/rules/no-eval
|
||||
"no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native
|
||||
"no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind
|
||||
"no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough
|
||||
"no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal
|
||||
"no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval
|
||||
"no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks
|
||||
"no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func
|
||||
"no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str
|
||||
"no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign
|
||||
"no-new": 2, // http://eslint.org/docs/rules/no-new
|
||||
"no-new-func": 2, // http://eslint.org/docs/rules/no-new-func
|
||||
"no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers
|
||||
"no-octal": 2, // http://eslint.org/docs/rules/no-octal
|
||||
"no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape
|
||||
"no-param-reassign": 2, // http://eslint.org/docs/rules/no-param-reassign
|
||||
"no-proto": 2, // http://eslint.org/docs/rules/no-proto
|
||||
"no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
|
||||
"no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
|
||||
"no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
|
||||
"no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
|
||||
"no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
|
||||
"no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
|
||||
"no-with": 2, // http://eslint.org/docs/rules/no-with
|
||||
"radix": 2, // http://eslint.org/docs/rules/radix
|
||||
"vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top
|
||||
"wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
|
||||
"yoda": 2, // http://eslint.org/docs/rules/yoda
|
||||
|
||||
/**
|
||||
* Style
|
||||
*/
|
||||
"indent": [2, 2], // http://eslint.org/docs/rules/
|
||||
"brace-style": [2, // http://eslint.org/docs/rules/brace-style
|
||||
"1tbs", {
|
||||
"allowSingleLine": true
|
||||
}],
|
||||
"quotes": [
|
||||
2, "single", "avoid-escape" // http://eslint.org/docs/rules/quotes
|
||||
],
|
||||
"camelcase": [2, { // http://eslint.org/docs/rules/camelcase
|
||||
"properties": "never"
|
||||
}],
|
||||
"comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing
|
||||
"before": false,
|
||||
"after": true
|
||||
}],
|
||||
"comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style
|
||||
"eol-last": 2, // http://eslint.org/docs/rules/eol-last
|
||||
"func-names": 1, // http://eslint.org/docs/rules/func-names
|
||||
"key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing
|
||||
"beforeColon": false,
|
||||
"afterColon": true
|
||||
}],
|
||||
"new-cap": [2, { // http://eslint.org/docs/rules/new-cap
|
||||
"newIsCap": true
|
||||
}],
|
||||
"no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
|
||||
"max": 2
|
||||
}],
|
||||
"no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
|
||||
"no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
|
||||
"no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
|
||||
"no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
|
||||
"no-wrap-func": 2, // http://eslint.org/docs/rules/no-wrap-func
|
||||
"no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle
|
||||
"one-var": [2, "never"], // http://eslint.org/docs/rules/one-var
|
||||
"padded-blocks": 0, // http://eslint.org/docs/rules/padded-blocks
|
||||
"semi": [2, "always"], // http://eslint.org/docs/rules/semi
|
||||
"semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing
|
||||
"before": false,
|
||||
"after": true
|
||||
}],
|
||||
"space-after-keywords": 2, // http://eslint.org/docs/rules/space-after-keywords
|
||||
"space-before-blocks": 2, // http://eslint.org/docs/rules/space-before-blocks
|
||||
"space-before-function-paren": [2, "never"], // http://eslint.org/docs/rules/space-before-function-paren
|
||||
"space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
|
||||
"space-return-throw-case": 2, // http://eslint.org/docs/rules/space-return-throw-case
|
||||
"spaced-line-comment": 2 // http://eslint.org/docs/rules/spaced-line-comment
|
||||
}
|
||||
"extends": "@react-native-community"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
examples
|
||||
example
|
||||
|
||||
# Assets
|
||||
docs
|
||||
|
8
.prettierrc
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"requirePragma": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": false,
|
||||
"jsxBracketSameLine": true,
|
||||
"parser": "flow"
|
||||
}
|
4
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"eslint.autoFixOnSave": true,
|
||||
"editor.formatOnSave": true
|
||||
}
|
113
README.md
@ -1,12 +1,11 @@
|
||||
[![npm version](https://badge.fury.io/js/react-native-blur.svg)](https://badge.fury.io/js/react-native-blur)
|
||||
# `@react-native-community/blur`
|
||||
|
||||
### React Native Blur
|
||||
[![npm version](https://badge.fury.io/js/%40react-native-community%2Fblur.svg)](https://badge.fury.io/js/%40react-native-community%2Fblur)
|
||||
|
||||
A component for UIVisualEffectView's blur and vibrancy effect on iOS, and [500px-android-blur](https://github.com/500px/500px-android-blur) on Android.<br>
|
||||
|
||||
<img src='https://cloud.githubusercontent.com/assets/139536/25066337/3c9d44c0-224d-11e7-8ca6-028478bf4a7d.gif' />
|
||||
|
||||
|
||||
### Content
|
||||
|
||||
- [Installation](#installation)
|
||||
@ -15,27 +14,31 @@ A component for UIVisualEffectView's blur and vibrancy effect on iOS, and [500px
|
||||
- [Example React Native app](#example-react-native-app)
|
||||
- [Questions?](#questions)
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
**NOTE:** Latest version of the package is available in npm as `react-native-blur@3.0.0-alpha`
|
||||
1. Install the library using either Yarn:
|
||||
|
||||
1. Install package via npm:
|
||||
```
|
||||
yarn add @react-native-community/blur
|
||||
```
|
||||
|
||||
```
|
||||
npm install react-native-blur
|
||||
```
|
||||
or npm:
|
||||
|
||||
```
|
||||
npm install --save @react-native-community/blur
|
||||
```
|
||||
|
||||
2. Link your native dependencies:
|
||||
```
|
||||
react-native link react-native-blur
|
||||
```
|
||||
|
||||
```
|
||||
react-native link @react-native-community/blur
|
||||
```
|
||||
|
||||
3. (Android only) Add the following to `android/app/build.gradle`
|
||||
|
||||
```
|
||||
android {
|
||||
// make sure to use 23.0.3 instead of 23.0.1
|
||||
// make sure to use 23.0.3 or greater
|
||||
buildToolsVersion '23.0.3'
|
||||
|
||||
// ...
|
||||
@ -47,18 +50,30 @@ android {
|
||||
}
|
||||
```
|
||||
|
||||
4. Include the library in your code:
|
||||
4. (Android only, optional)
|
||||
If you've defined _[project-wide properties](https://developer.android.com/studio/build/gradle-tips.html)_ (**recommended**) in your root `build.gradle`, this library will detect the presence of the following properties:
|
||||
|
||||
```javascript
|
||||
import { BlurView, VibrancyView } from 'react-native-blur';
|
||||
```groovy
|
||||
buildscript {...}
|
||||
allprojects {...}
|
||||
|
||||
// OR
|
||||
/**
|
||||
+ Project-wide Gradle configuration properties
|
||||
*/
|
||||
ext {
|
||||
compileSdkVersion = 27
|
||||
targetSdkVersion = 27
|
||||
buildToolsVersion = "27.0.3"
|
||||
}
|
||||
```
|
||||
|
||||
const { BlurView, VibrancyView } = require('react-native-blur');
|
||||
```
|
||||
5. Include the library in your code:
|
||||
|
||||
5. Compile and have fun!
|
||||
```javascript
|
||||
import { BlurView, VibrancyView } from "@react-native-community/blur";
|
||||
```
|
||||
|
||||
6. Compile and have fun!
|
||||
|
||||
### BlurView
|
||||
|
||||
@ -69,8 +84,8 @@ android {
|
||||
- `light` - light blur type
|
||||
- `dark` - dark blur type
|
||||
- `extraDark` - extra dark blur type (tvOS only)
|
||||
- `regular` - regular blur type (tvOS only)
|
||||
- `prominent` - prominent blur type (tvOS only)
|
||||
- `regular` - regular blur type (iOS 10+ and tvOS only)
|
||||
- `prominent` - prominent blur type (iOS 10+ and tvOS only)
|
||||
- `blurAmount` (Default: 10, Number)
|
||||
- `0-100` - Adjusts blur intensity
|
||||
|
||||
@ -79,9 +94,9 @@ android {
|
||||
> Complete usage example that works on iOS and Android:
|
||||
|
||||
```javascript
|
||||
import React, { Component } from 'react';
|
||||
import { View, Image, Text, findNodeHandle, StyleSheet } from 'react-native';
|
||||
import { BlurView } from 'react-native-blur';
|
||||
import React, { Component } from "react";
|
||||
import { View, Image, Text, findNodeHandle, StyleSheet } from "react-native";
|
||||
import { BlurView } from "@react-native-community/blur";
|
||||
|
||||
export default class Menu extends Component {
|
||||
constructor(props) {
|
||||
@ -96,19 +111,21 @@ export default class Menu extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Image
|
||||
ref={(img) => { this.backgroundImage = img; }}
|
||||
source={{uri}}
|
||||
style={styles.absolute}
|
||||
onLoadEnd={this.imageLoaded.bind(this)}
|
||||
/>
|
||||
<Text>Hi, I am some unblurred text</Text>
|
||||
<BlurView
|
||||
style={styles.absolute}
|
||||
viewRef={this.state.viewRef}
|
||||
blurType="light"
|
||||
blurAmount={10}
|
||||
/>
|
||||
<Text>Hi, I am some unblurred text</Text>
|
||||
<Image
|
||||
ref={img => {
|
||||
this.backgroundImage = img;
|
||||
}}
|
||||
source={{ uri }}
|
||||
style={styles.absolute}
|
||||
onLoadEnd={this.imageLoaded.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@ -116,13 +133,16 @@ export default class Menu extends Component {
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
},
|
||||
absolute: {
|
||||
position: "absolute",
|
||||
top: 0, left: 0, bottom: 0, right: 0,
|
||||
},
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
@ -139,12 +159,12 @@ Note that `viewRef` is only required if you need to support Android. See the [An
|
||||
> (Note: `VibrancyView` is only supported on iOS. Also note that the `VibrancyView` must contain nested views.)
|
||||
|
||||
```javascript
|
||||
import { VibrancyView } from 'react-native-blur';
|
||||
import { VibrancyView } from "@react-native-community/blur";
|
||||
|
||||
export default class Menu extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Image source={{uri}} style={styles.absolute}>
|
||||
<Image source={{ uri }} style={styles.absolute}>
|
||||
<VibrancyView blurType="light" style={styles.flex}>
|
||||
<Text>Hi, I am some vibrant text.</Text>
|
||||
</VibrancyView>
|
||||
@ -160,17 +180,16 @@ Android uses the [500px-android-blur](https://github.com/500px/500px-android-blu
|
||||
|
||||
The Android library introduces some limitations:
|
||||
|
||||
* `BlurView` cannot be a child of the view that is being blurred (this would cause an infinite loop)
|
||||
* `BlurView` cannot contain any child components.
|
||||
- `BlurView` cannot be a child of the view that is being blurred (this would cause an infinite loop)
|
||||
- `BlurView` cannot contain any child components.
|
||||
|
||||
If you only need to support iOS, then you can safely ignore these limitations.
|
||||
|
||||
In addition to `blurType` and `blurAmount`, Android has some extra props that can be used to override the default behavior (or configure Android-specific behavior):
|
||||
|
||||
- `blurRadius` (Number - between 0 and 25) - Manually adjust the blur radius. (Default: matches iOS blurAmount)
|
||||
- `blurRadius` (Number - between 0 and 25) - Manually adjust the blur radius. (Default: matches iOS blurAmount)
|
||||
- `downsampleFactor` (Number - between 0 and 25) - Scales down the image before blurring (Default: matches iOS blurAmount)
|
||||
- `overlayColor` (Color) - Set a custom overlay color (Default color based on iOS blurType)
|
||||
|
||||
- `overlayColor` (Color) - Set a custom overlay color (Default color based on iOS blurType)
|
||||
|
||||
### Example React Native App
|
||||
|
||||
@ -184,10 +203,10 @@ cd ~
|
||||
git clone https://github.com/react-native-community/react-native-blur.git
|
||||
```
|
||||
|
||||
2. cd to `examples/Basic`
|
||||
2. cd to `example`
|
||||
|
||||
```
|
||||
cd react-native-blur/examples/Basic
|
||||
cd react-native-blur/example
|
||||
```
|
||||
|
||||
3. Install dependencies
|
||||
@ -207,6 +226,7 @@ react-native run-ios
|
||||
#### Run the tvOS app
|
||||
|
||||
type:
|
||||
|
||||
```
|
||||
react-native run-ios
|
||||
```
|
||||
@ -237,12 +257,12 @@ That’s all, you can use react-native-blur for your tvOS application
|
||||
react-native run-android
|
||||
```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
On older instances of react-native, BlurView package does not get added into the MainActivity/MainApplication classes where you would see `Warning: Native component for 'BlurView' does not exist` in RN YellowBox or console.
|
||||
|
||||
To rectify this, you can add the BlurViewPackage manually in MainActivity/MainApplication classes
|
||||
|
||||
```java
|
||||
...
|
||||
import com.cmcewen.blurview.BlurViewPackage;
|
||||
@ -261,7 +281,6 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Questions?
|
||||
|
||||
Feel free to contact me in [twitter](https://twitter.com/kureevalexey) or [create an issue](https://github.com/Kureev/react-native-blur/issues/new)
|
||||
|
@ -1,3 +1,7 @@
|
||||
def safeExtGet(prop, fallback) {
|
||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@ -11,12 +15,12 @@ buildscript {
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion safeExtGet('compileSdkVersion', 25)
|
||||
buildToolsVersion safeExtGet('buildToolsVersion', '25.0.3')
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
minSdkVersion safeExtGet('minSdkVersion', 16)
|
||||
targetSdkVersion safeExtGet('targetSdkVersion', 22)
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@ -33,5 +37,5 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.facebook.react:react-native:[0.32,)'
|
||||
implementation 'com.facebook.react:react-native:+'
|
||||
}
|
||||
|
69
example/.flowconfig
Normal file
@ -0,0 +1,69 @@
|
||||
[ignore]
|
||||
; We fork some components by platform
|
||||
.*/*[.]android.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
|
||||
; Ignore unexpected extra "@providesModule"
|
||||
.*/node_modules/.*/node_modules/fbjs/.*
|
||||
|
||||
; Ignore duplicate module providers
|
||||
; For RN Apps installed via npm, "Libraries" folder is inside
|
||||
; "node_modules/react-native" but in the source repo it is in the root
|
||||
.*/Libraries/react-native/React.js
|
||||
|
||||
; Ignore polyfills
|
||||
.*/Libraries/polyfills/.*
|
||||
|
||||
; Ignore metro
|
||||
.*/node_modules/metro/.*
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
node_modules/react-native/Libraries/react-native/react-native-interface.js
|
||||
node_modules/react-native/flow/
|
||||
|
||||
[options]
|
||||
emoji=true
|
||||
|
||||
esproposal.optional_chaining=enable
|
||||
esproposal.nullish_coalescing=enable
|
||||
|
||||
module.system=haste
|
||||
module.system.haste.use_name_reducers=true
|
||||
# get basename
|
||||
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
|
||||
# strip .js or .js.flow suffix
|
||||
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
|
||||
# strip .ios suffix
|
||||
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
|
||||
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
|
||||
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
|
||||
module.system.haste.paths.blacklist=.*/__tests__/.*
|
||||
module.system.haste.paths.blacklist=.*/__mocks__/.*
|
||||
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
|
||||
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
|
||||
|
||||
munge_underscores=true
|
||||
|
||||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
|
||||
|
||||
module.file_ext=.js
|
||||
module.file_ext=.jsx
|
||||
module.file_ext=.json
|
||||
module.file_ext=.native.js
|
||||
|
||||
suppress_type=$FlowIssue
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
[version]
|
||||
^0.92.0
|
11
examples/Basic/.gitignore → example/.gitignore
vendored
@ -46,8 +46,11 @@ buck-out/
|
||||
# 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
|
||||
# https://docs.fastlane.tools/best-practices/source-control/
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
*/fastlane/report.xml
|
||||
*/fastlane/Preview.html
|
||||
*/fastlane/screenshots
|
||||
|
||||
# Bundle artifact
|
||||
*.jsbundle
|
@ -2,26 +2,24 @@
|
||||
* Basic [Android] Example for react-native-blur
|
||||
* https://github.com/react-native-community/react-native-blur
|
||||
*/
|
||||
'use strict';
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
AppRegistry,
|
||||
Dimensions,
|
||||
Image,
|
||||
findNodeHandle,
|
||||
InteractionManager,
|
||||
StyleSheet,
|
||||
Switch,
|
||||
Text,
|
||||
View,
|
||||
Dimensions,
|
||||
Switch,
|
||||
InteractionManager,
|
||||
findNodeHandle,
|
||||
} from 'react-native';
|
||||
import AndroidSegmented from 'react-native-segmented-android';
|
||||
import SegmentedControlTab from 'react-native-segmented-control-tab';
|
||||
|
||||
import { BlurView } from 'react-native-blur';
|
||||
import { BlurView } from '@react-native-community/blur';
|
||||
|
||||
const BLUR_TYPES = ['xlight', 'light', 'dark'];
|
||||
|
||||
class Basic extends Component {
|
||||
export default class Basic extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
@ -50,7 +48,7 @@ class Basic extends Component {
|
||||
|
||||
renderBlurView() {
|
||||
const tintColor = ['#ffffff', '#000000'];
|
||||
if (this.state.blurType === 'xlight') tintColor.reverse();
|
||||
if (this.state.blurType === 'xlight') {tintColor.reverse();}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
@ -72,7 +70,7 @@ class Basic extends Component {
|
||||
Blur component (Android)
|
||||
</Text>
|
||||
|
||||
<AndroidSegmented
|
||||
<SegmentedControlTab
|
||||
tintColor={tintColor}
|
||||
style={{
|
||||
width: Dimensions.get('window').width,
|
||||
@ -80,13 +78,13 @@ class Basic extends Component {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
childText={BLUR_TYPES}
|
||||
orientation='horizontal'
|
||||
selectedPosition={this.state.activeSegment}
|
||||
onChange={this._onChange.bind(this)} />
|
||||
values={BLUR_TYPES}
|
||||
orientation="horizontal"
|
||||
selectedIndex={this.state.activeSegment}
|
||||
onTabPress={this._onChange.bind(this)} />
|
||||
|
||||
</View>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -148,5 +146,3 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'flex-end',
|
||||
},
|
||||
});
|
||||
|
||||
AppRegistry.registerComponent('Basic', () => Basic);
|
@ -2,22 +2,21 @@
|
||||
* Basic [iOS] Example for react-native-blur
|
||||
* https://github.com/react-native-community/react-native-blur
|
||||
*/
|
||||
import React, { Component } from 'react'
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
AppRegistry,
|
||||
StyleSheet,
|
||||
Text,
|
||||
Image,
|
||||
View,
|
||||
SegmentedControlIOS,
|
||||
StyleSheet,
|
||||
Switch,
|
||||
} from 'react-native'
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
import { BlurView, VibrancyView } from 'react-native-blur'
|
||||
import { BlurView, VibrancyView } from '@react-native-community/blur';
|
||||
|
||||
class Basic extends Component {
|
||||
export default class Basic extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
showBlurs: true,
|
||||
@ -25,23 +24,23 @@ class Basic extends Component {
|
||||
blurActiveSegment: 1,
|
||||
vibrancyBlurType: 'dark',
|
||||
vibrancyActiveSegment: 2,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_onBlurChange(event) {
|
||||
this.setState({blurActiveSegment: event.nativeEvent.selectedSegmentIndex})
|
||||
this.setState({blurActiveSegment: event.nativeEvent.selectedSegmentIndex});
|
||||
}
|
||||
|
||||
_onBlurValueChange(value) {
|
||||
this.setState({blurBlurType: value})
|
||||
this.setState({blurBlurType: value});
|
||||
}
|
||||
|
||||
_onVibrancyChange(event) {
|
||||
this.setState({vibrancyActiveSegment: event.nativeEvent.selectedSegmentIndex})
|
||||
this.setState({vibrancyActiveSegment: event.nativeEvent.selectedSegmentIndex});
|
||||
}
|
||||
|
||||
_onVibrancyValueChange(value) {
|
||||
this.setState({vibrancyBlurType: value})
|
||||
this.setState({vibrancyBlurType: value});
|
||||
}
|
||||
|
||||
renderBlurs() {
|
||||
@ -67,10 +66,10 @@ class Basic extends Component {
|
||||
</Text>
|
||||
|
||||
<SegmentedControlIOS
|
||||
values={['xlight', 'light', 'dark']}
|
||||
values={['xlight', 'light', 'dark', 'regular', 'prominent']}
|
||||
selectedIndex={this.state.blurActiveSegment}
|
||||
onChange={(event) => {this._onBlurChange(event)}}
|
||||
onValueChange={(value) => {this._onBlurValueChange(value)}}
|
||||
onChange={(event) => {this._onBlurChange(event);}}
|
||||
onValueChange={(value) => {this._onBlurValueChange(value);}}
|
||||
tintColor={tintColor}
|
||||
/>
|
||||
</View>
|
||||
@ -89,15 +88,15 @@ class Basic extends Component {
|
||||
</Text>
|
||||
|
||||
<SegmentedControlIOS
|
||||
values={['xlight', 'light', 'dark']}
|
||||
values={['xlight', 'light', 'dark', 'regular', 'prominent']}
|
||||
selectedIndex={this.state.vibrancyActiveSegment}
|
||||
onChange={(event) => {this._onVibrancyChange(event)}}
|
||||
onValueChange={(value) => {this._onVibrancyValueChange(value)}}
|
||||
onChange={(event) => {this._onVibrancyChange(event);}}
|
||||
onValueChange={(value) => {this._onVibrancyValueChange(value);}}
|
||||
tintColor="white"
|
||||
/>
|
||||
</VibrancyView>
|
||||
</View>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -106,7 +105,7 @@ class Basic extends Component {
|
||||
style={styles.container}>
|
||||
<Image
|
||||
source={require('./bgimage.jpeg')}
|
||||
resizeMode='cover'
|
||||
resizeMode="cover"
|
||||
style={styles.img}/>
|
||||
|
||||
{ this.state.showBlurs ? this.renderBlurs() : null }
|
||||
@ -163,7 +162,5 @@ const styles = StyleSheet.create({
|
||||
top: 30,
|
||||
right: 10,
|
||||
alignItems: 'flex-end',
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
AppRegistry.registerComponent('Basic', () => Basic);
|
@ -8,23 +8,13 @@
|
||||
# - `buck install -r android/app` - compile, install and run application
|
||||
#
|
||||
|
||||
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
||||
|
||||
lib_deps = []
|
||||
|
||||
for jarfile in glob(['libs/*.jar']):
|
||||
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
|
||||
lib_deps.append(':' + name)
|
||||
prebuilt_jar(
|
||||
name = name,
|
||||
binary_jar = jarfile,
|
||||
)
|
||||
create_aar_targets(glob(["libs/*.aar"]))
|
||||
|
||||
for aarfile in glob(['libs/*.aar']):
|
||||
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
|
||||
lib_deps.append(':' + name)
|
||||
android_prebuilt_aar(
|
||||
name = name,
|
||||
aar = aarfile,
|
||||
)
|
||||
create_jar_targets(glob(["libs/*.jar"]))
|
||||
|
||||
android_library(
|
||||
name = "all-libs",
|
||||
@ -45,12 +35,12 @@ android_library(
|
||||
|
||||
android_build_config(
|
||||
name = "build_config",
|
||||
package = "com.basic",
|
||||
package = "com.example",
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "res",
|
||||
package = "com.basic",
|
||||
package = "com.example",
|
||||
res = "src/main/res",
|
||||
)
|
||||
|
@ -33,6 +33,13 @@ import com.android.build.OutputFile
|
||||
* // bundleInPaidRelease: true,
|
||||
* // bundleInBeta: true,
|
||||
*
|
||||
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
||||
* // for example: to disable dev mode in the staging build type (if configured)
|
||||
* devDisabledInStaging: true,
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'devDisabledIn${productFlavor}${buildType}'
|
||||
* // 'devDisabledIn${buildType}'
|
||||
*
|
||||
* // the root of your project, i.e. where "package.json" lives
|
||||
* root: "../../",
|
||||
*
|
||||
@ -58,13 +65,17 @@ import com.android.build.OutputFile
|
||||
* inputExcludes: ["android/**", "ios/**"],
|
||||
*
|
||||
* // override which node gets called and with what additional arguments
|
||||
* nodeExecutableAndArgs: ["node"]
|
||||
* nodeExecutableAndArgs: ["node"],
|
||||
*
|
||||
* // supply additional arguments to the packager
|
||||
* extraPackagerArgs: []
|
||||
* ]
|
||||
*/
|
||||
|
||||
project.ext.react = [
|
||||
entryFile: "index.js"
|
||||
]
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
|
||||
/**
|
||||
@ -83,18 +94,19 @@ def enableSeparateBuildPerCPUArchitecture = false
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.basic"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
applicationId "com.example"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
renderscriptTargetApi 23
|
||||
renderscriptSupportModeEnabled true
|
||||
}
|
||||
@ -103,7 +115,7 @@ android {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86"
|
||||
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
@ -117,7 +129,7 @@ android {
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
|
||||
def versionCodes = ["armeabi-v7a":1, "x86":2]
|
||||
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||
output.versionCodeOverride =
|
||||
@ -128,11 +140,10 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':react-native-blur')
|
||||
compile project(':react-native-segmented-android')
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.android.support:appcompat-v7:23.0.1"
|
||||
compile "com.facebook.react:react-native:+" // From node_modules
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
implementation project(':react-native-blur')
|
||||
}
|
||||
|
||||
// Run this once to be able to run the application with BUCK
|
19
example/android/app/build_defs.bzl
Normal file
@ -0,0 +1,19 @@
|
||||
"""Helper definitions to glob .aar and .jar targets"""
|
||||
|
||||
def create_aar_targets(aarfiles):
|
||||
for aarfile in aarfiles:
|
||||
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
|
||||
lib_deps.append(":" + name)
|
||||
android_prebuilt_aar(
|
||||
name = name,
|
||||
aar = aarfile,
|
||||
)
|
||||
|
||||
def create_jar_targets(jarfiles):
|
||||
for jarfile in jarfiles:
|
||||
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
|
||||
lib_deps.append(":" + name)
|
||||
prebuilt_jar(
|
||||
name = name,
|
||||
binary_jar = jarfile,
|
||||
)
|
17
example/android/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
8
example/android/app/src/debug/AndroidManifest.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
|
||||
</manifest>
|
@ -1,20 +1,14 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.basic"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
package="com.example">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:allowBackup="false"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
@ -1,4 +1,4 @@
|
||||
package com.basic;
|
||||
package com.example;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
|
||||
*/
|
||||
@Override
|
||||
protected String getMainComponentName() {
|
||||
return "Basic";
|
||||
return "example";
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
package com.basic;
|
||||
package com.example;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.cmcewen.blurview.BlurViewPackage;
|
||||
import com.higo.zhangyp.segmented.AndroidSegmentedPackage;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
@ -25,10 +24,14 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(),
|
||||
new BlurViewPackage(),
|
||||
new AndroidSegmentedPackage()
|
||||
new BlurViewPackage()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJSMainModuleName() {
|
||||
return "index";
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
BIN
example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
BIN
example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
BIN
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.9 KiB |
BIN
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 10 KiB |
BIN
example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 15 KiB |
3
example/android/app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">example</string>
|
||||
</resources>
|
@ -1,11 +1,19 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
buildToolsVersion = "28.0.3"
|
||||
minSdkVersion = 16
|
||||
compileSdkVersion = 28
|
||||
targetSdkVersion = 28
|
||||
supportLibVersion = "28.0.0"
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
@ -15,6 +23,7 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
jcenter()
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
@ -16,5 +16,3 @@
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
android.useDeprecatedNdk=true
|
BIN
example/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@ -6,47 +6,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
@ -90,7 +89,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@ -114,6 +113,7 @@ fi
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
@ -154,11 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
@ -8,14 +8,14 @@
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
@ -46,10 +46,9 @@ echo location of your Java installation.
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@ -60,11 +59,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
5
example/android/settings.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
rootProject.name = 'example'
|
||||
include ':react-native-blur'
|
||||
project(':react-native-blur').projectDir = new File(rootProject.projectDir, '../../android')
|
||||
|
||||
include ':app'
|
4
example/app.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "example",
|
||||
"displayName": "example"
|
||||
}
|
3
example/babel.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
};
|
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 191 KiB |
9
example/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {AppRegistry} from 'react-native';
|
||||
import App from './App';
|
||||
import {name as appName} from './app.json';
|
||||
|
||||
AppRegistry.registerComponent(appName, () => App);
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0940"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
@ -29,9 +29,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOS.app"
|
||||
BlueprintName = "Basic-tvOS"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOS.app"
|
||||
BlueprintName = "example-tvOS"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
@ -43,9 +43,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOSTests.xctest"
|
||||
BlueprintName = "Basic-tvOSTests"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOSTests.xctest"
|
||||
BlueprintName = "example-tvOSTests"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@ -61,9 +61,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOSTests.xctest"
|
||||
BlueprintName = "Basic-tvOSTests"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOSTests.xctest"
|
||||
BlueprintName = "example-tvOSTests"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@ -71,9 +71,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOS.app"
|
||||
BlueprintName = "Basic-tvOS"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOS.app"
|
||||
BlueprintName = "example-tvOS"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@ -94,9 +94,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOS.app"
|
||||
BlueprintName = "Basic-tvOS"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOS.app"
|
||||
BlueprintName = "example-tvOS"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
@ -113,9 +113,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
|
||||
BuildableName = "Basic-tvOS.app"
|
||||
BlueprintName = "Basic-tvOS"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example-tvOS.app"
|
||||
BlueprintName = "example-tvOS"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0940"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
@ -29,9 +29,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
|
||||
BuildableName = "Basic.app"
|
||||
BlueprintName = "Basic"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example.app"
|
||||
BlueprintName = "example"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
@ -43,9 +43,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
|
||||
BuildableName = "BasicTests.xctest"
|
||||
BlueprintName = "BasicTests"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "exampleTests.xctest"
|
||||
BlueprintName = "exampleTests"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@ -61,9 +61,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
|
||||
BuildableName = "BasicTests.xctest"
|
||||
BlueprintName = "BasicTests"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "exampleTests.xctest"
|
||||
BlueprintName = "exampleTests"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@ -71,9 +71,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
|
||||
BuildableName = "Basic.app"
|
||||
BlueprintName = "Basic"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example.app"
|
||||
BlueprintName = "example"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@ -94,9 +94,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
|
||||
BuildableName = "Basic.app"
|
||||
BlueprintName = "Basic"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example.app"
|
||||
BlueprintName = "example"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
@ -113,9 +113,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
|
||||
BuildableName = "Basic.app"
|
||||
BlueprintName = "Basic"
|
||||
ReferencedContainer = "container:Basic.xcodeproj">
|
||||
BuildableName = "example.app"
|
||||
BlueprintName = "example"
|
||||
ReferencedContainer = "container:example.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
15
example/ios/example/AppDelegate.h
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <React/RCTBridgeDelegate.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
|
||||
@end
|
42
example/ios/example/AppDelegate.m
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
||||
moduleName:@"example"
|
||||
initialProperties:nil];
|
||||
|
||||
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [UIViewController new];
|
||||
rootViewController.view = rootView;
|
||||
self.window.rootViewController = rootViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
#if DEBUG
|
||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
||||
#else
|
||||
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
@ -18,7 +18,7 @@
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Basic" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
@ -1,5 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
@ -29,6 +39,11 @@
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
6
example/ios/example/Images.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Basic</string>
|
||||
<string>example</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@ -24,17 +24,6 @@
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
@ -51,5 +40,21 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
16
example/ios/example/main.m
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@ -16,11 +14,11 @@
|
||||
#define TIMEOUT_SECONDS 600
|
||||
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
|
||||
|
||||
@interface BasicTests : XCTestCase
|
||||
@interface exampleTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation BasicTests
|
||||
@implementation exampleTests
|
||||
|
||||
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
|
||||
{
|
||||
@ -37,7 +35,7 @@
|
||||
|
||||
- (void)testRendersWelcomeScreen
|
||||
{
|
||||
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
|
||||
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
|
||||
BOOL foundElement = NO;
|
||||
|
28
example/metro.config.js
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Metro configuration for React Native
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const blacklist = require('metro-config/src/defaults/blacklist');
|
||||
|
||||
const reactNativeBlur = path.resolve(__dirname, '..');
|
||||
|
||||
module.exports = {
|
||||
watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeBlur],
|
||||
resolver: {
|
||||
blacklistRE: blacklist([
|
||||
new RegExp(`${reactNativeBlur}/node_modules/react-native/.*`),
|
||||
]),
|
||||
},
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
inlineRequires: false,
|
||||
},
|
||||
}),
|
||||
},
|
||||
};
|
28
example/package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "example",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||
"test": "jest",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.2",
|
||||
"react-native-segmented-control-tab": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.4.0",
|
||||
"@babel/runtime": "^7.4.2",
|
||||
"@react-native-community/eslint-config": "^0.0.3",
|
||||
"babel-jest": "^24.5.0",
|
||||
"eslint": "^5.15.3",
|
||||
"jest": "^24.5.0",
|
||||
"metro-react-native-babel-preset": "^0.53.1",
|
||||
"react-test-renderer": "16.8.3"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
}
|
||||
}
|
6664
example/yarn.lock
Normal file
@ -1,3 +0,0 @@
|
||||
{
|
||||
"presets": ["react-native"]
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
[ignore]
|
||||
; We fork some components by platform
|
||||
.*/*[.]android.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
|
||||
; Ignore unexpected extra "@providesModule"
|
||||
.*/node_modules/.*/node_modules/fbjs/.*
|
||||
|
||||
; Ignore duplicate module providers
|
||||
; For RN Apps installed via npm, "Libraries" folder is inside
|
||||
; "node_modules/react-native" but in the source repo it is in the root
|
||||
.*/Libraries/react-native/React.js
|
||||
.*/Libraries/react-native/ReactNative.js
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
node_modules/react-native/Libraries/react-native/react-native-interface.js
|
||||
node_modules/react-native/flow
|
||||
flow/
|
||||
|
||||
[options]
|
||||
emoji=true
|
||||
|
||||
module.system=haste
|
||||
|
||||
experimental.strict_type_args=true
|
||||
|
||||
munge_underscores=true
|
||||
|
||||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
|
||||
|
||||
suppress_type=$FlowIssue
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FixMe
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
unsafe.enable_getters_and_setters=true
|
||||
|
||||
[version]
|
||||
^0.40.0
|
@ -1,12 +0,0 @@
|
||||
import 'react-native';
|
||||
import React from 'react';
|
||||
import Index from '../index.android.js';
|
||||
|
||||
// Note: test renderer must be required after react-native.
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
it('renders correctly', () => {
|
||||
const tree = renderer.create(
|
||||
<Index />
|
||||
);
|
||||
});
|
@ -1,12 +0,0 @@
|
||||
import 'react-native';
|
||||
import React from 'react';
|
||||
import Index from '../index.ios.js';
|
||||
|
||||
// Note: test renderer must be required after react-native.
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
it('renders correctly', () => {
|
||||
const tree = renderer.create(
|
||||
<Index />
|
||||
);
|
||||
});
|
66
examples/Basic/android/app/proguard-rules.pro
vendored
@ -1,66 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Disabling obfuscation is useful if you collect stack traces from production crashes
|
||||
# (unless you are using a system that supports de-obfuscate the stack traces).
|
||||
-dontobfuscate
|
||||
|
||||
# React Native
|
||||
|
||||
# Keep our interfaces so they can be used by other ProGuard rules.
|
||||
# See http://sourceforge.net/p/proguard/bugs/466/
|
||||
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
|
||||
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
|
||||
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
|
||||
|
||||
# Do not strip any method/class that is annotated with @DoNotStrip
|
||||
-keep @com.facebook.proguard.annotations.DoNotStrip class *
|
||||
-keep @com.facebook.common.internal.DoNotStrip class *
|
||||
-keepclassmembers class * {
|
||||
@com.facebook.proguard.annotations.DoNotStrip *;
|
||||
@com.facebook.common.internal.DoNotStrip *;
|
||||
}
|
||||
|
||||
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
|
||||
void set*(***);
|
||||
*** get*();
|
||||
}
|
||||
|
||||
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
|
||||
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
|
||||
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
|
||||
|
||||
-dontwarn com.facebook.react.**
|
||||
|
||||
# okhttp
|
||||
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep class okhttp3.** { *; }
|
||||
-keep interface okhttp3.** { *; }
|
||||
-dontwarn okhttp3.**
|
||||
|
||||
# okio
|
||||
|
||||
-keep class sun.misc.Unsafe { *; }
|
||||
-dontwarn java.nio.file.*
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
||||
-dontwarn okio.**
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">Basic</string>
|
||||
</resources>
|
@ -1,10 +0,0 @@
|
||||
rootProject.name = 'Basic'
|
||||
include ':react-native-blur'
|
||||
project(':react-native-blur').projectDir =
|
||||
new File(rootProject.projectDir, '../../../android')
|
||||
|
||||
include ':react-native-segmented-android', ':app'
|
||||
project(':react-native-segmented-android').projectDir =
|
||||
new File(rootProject.projectDir,'../node_modules/react-native-segmented-android')
|
||||
|
||||
include ':app'
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "Basic",
|
||||
"displayName": "Basic"
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
|
||||
@end
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
NSURL *jsCodeLocation;
|
||||
|
||||
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
|
||||
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
|
||||
moduleName:@"Basic"
|
||||
initialProperties:nil
|
||||
launchOptions:launchOptions];
|
||||
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [UIViewController new];
|
||||
rootViewController.view = rootView;
|
||||
self.window.rootViewController = rootViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "Basic",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "16.0.0-alpha.6",
|
||||
"react-native": "0.43.3",
|
||||
"react-native-blur": "file:../../",
|
||||
"react-native-segmented-android": "sooth-sayer/react-native-segmented-android"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-jest": "19.0.0",
|
||||
"babel-preset-react-native": "1.9.1",
|
||||
"jest": "19.0.2",
|
||||
"react-test-renderer": "16.0.0-alpha.6"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
}
|
||||
}
|
17
index.d.ts
vendored
@ -1,18 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import { ViewStyle } from 'react-native';
|
||||
import * as React from "react";
|
||||
import { StyleProp, ViewStyle } from "react-native";
|
||||
|
||||
export interface BlurViewProperties {
|
||||
blurType: 'xlight' | 'light' | 'dark'
|
||||
blurType:
|
||||
| "xlight"
|
||||
| "light"
|
||||
| "dark"
|
||||
// tvOS and iOS 10+ only
|
||||
| "regular"
|
||||
| "prominent"
|
||||
// tvOS only
|
||||
| 'extraDark' | 'regular' | 'prominent';
|
||||
| "extraDark";
|
||||
blurAmount?: number; // 0 - 100
|
||||
style?: ViewStyle;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
viewRef?: number | null;
|
||||
}
|
||||
|
||||
export class BlurView extends React.Component<BlurViewProperties, {}> {}
|
||||
|
||||
|
||||
export interface VibrancyViewProperties extends BlurViewProperties {}
|
||||
|
||||
export class VibrancyView extends React.Component<VibrancyViewProperties, {}> {}
|
||||
|
8
index.js
@ -1,7 +1,7 @@
|
||||
const BlurView = require('./src/BlurView');
|
||||
const VibrancyView = require('./src/VibrancyView');
|
||||
import BlurView from './src/BlurView';
|
||||
import VibrancyView from './src/VibrancyView';
|
||||
|
||||
module.exports = {
|
||||
BlurView: BlurView,
|
||||
VibrancyView: VibrancyView,
|
||||
BlurView: BlurView,
|
||||
VibrancyView: VibrancyView,
|
||||
};
|
||||
|
39
index.js.flow
Normal file
@ -0,0 +1,39 @@
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {View} from 'react-native';
|
||||
|
||||
type ViewProps = React.ElementProps<typeof View>;
|
||||
type ViewStyleProp = $PropertyType<ViewProps, 'style'>;
|
||||
|
||||
export type BlurType =
|
||||
| 'xlight'
|
||||
| 'light'
|
||||
| 'dark'
|
||||
// tvOS and iOS 10+ only
|
||||
| 'regular'
|
||||
| 'prominent'
|
||||
// tvOS only
|
||||
| 'extraDark';
|
||||
|
||||
export type BlurViewProps = {
|
||||
blurType: BlurType,
|
||||
blurAmount: number, // 0 - 100
|
||||
style?: ?ViewStyleProp,
|
||||
viewRef?: ?React.ElementRef<any>,
|
||||
};
|
||||
|
||||
export class BlurView extends React.Component<BlurViewProps> {
|
||||
static defaultProps = {
|
||||
blurType: 'dark',
|
||||
blurAmount: 10,
|
||||
};
|
||||
}
|
||||
|
||||
export type VibrancyViewProps = BlurViewProps;
|
||||
|
||||
export class VibrancyView extends React.Component<VibrancyViewProps> {
|
||||
static defaultProps = {
|
||||
blurAmount: 10,
|
||||
};
|
||||
}
|
@ -53,13 +53,18 @@
|
||||
if ([self.blurType isEqual: @"xlight"]) return UIBlurEffectStyleExtraLight;
|
||||
if ([self.blurType isEqual: @"light"]) return UIBlurEffectStyleLight;
|
||||
if ([self.blurType isEqual: @"dark"]) return UIBlurEffectStyleDark;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
|
||||
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 /* __IPHONE_10_0 */
|
||||
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
|
||||
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
|
||||
#endif
|
||||
|
||||
|
||||
#if TARGET_OS_TV
|
||||
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
|
||||
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
|
||||
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
|
||||
#endif
|
||||
|
||||
return UIBlurEffectStyleDark;
|
||||
}
|
||||
|
||||
|
27
package.json
@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "react-native-blur",
|
||||
"version": "3.2.2",
|
||||
"name": "@react-native-community/blur",
|
||||
"version": "3.3.1",
|
||||
"description": "React Native Blur component",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -23,5 +24,25 @@
|
||||
"homepage": "https://github.com/react-native-community/react-native-blur",
|
||||
"dependencies": {
|
||||
"prop-types": "^15.5.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/eslint-config": "^0.0.3",
|
||||
"eslint": "^5.15.3",
|
||||
"husky": "^1.3.1",
|
||||
"lint-staged": "^8.1.5",
|
||||
"prettier": "1.16.4",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.2"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json,css,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, requireNativeComponent, DeviceEventEmitter, ViewPropTypes } from 'react-native';
|
||||
import {
|
||||
View,
|
||||
requireNativeComponent,
|
||||
DeviceEventEmitter,
|
||||
ViewPropTypes,
|
||||
} from 'react-native';
|
||||
|
||||
const OVERLAY_COLORS = {
|
||||
light: 'rgba(255, 255, 255, 0.2)',
|
||||
@ -8,10 +13,9 @@ const OVERLAY_COLORS = {
|
||||
dark: 'rgba(16, 12, 12, 0.64)',
|
||||
};
|
||||
|
||||
|
||||
class BlurView extends Component {
|
||||
componentWillMount() {
|
||||
DeviceEventEmitter.addListener('ReactNativeBlurError', (message) => {
|
||||
componentDidMount() {
|
||||
DeviceEventEmitter.addListener('ReactNativeBlurError', message => {
|
||||
throw new Error(`[ReactNativeBlur]: ${message}`);
|
||||
});
|
||||
}
|
||||
@ -21,7 +25,9 @@ class BlurView extends Component {
|
||||
}
|
||||
|
||||
overlayColor() {
|
||||
if (this.props.overlayColor != null) return this.props.overlayColor;
|
||||
if (this.props.overlayColor != null) {
|
||||
return this.props.overlayColor;
|
||||
}
|
||||
return OVERLAY_COLORS[this.props.blurType] || OVERLAY_COLORS.dark;
|
||||
}
|
||||
|
||||
@ -30,7 +36,9 @@ class BlurView extends Component {
|
||||
|
||||
if (blurRadius != null) {
|
||||
if (blurRadius > 25) {
|
||||
throw new Error(`[ReactNativeBlur]: blurRadius cannot be greater than 25! (was: ${blurRadius})`);
|
||||
throw new Error(
|
||||
`[ReactNativeBlur]: blurRadius cannot be greater than 25! (was: ${blurRadius})`
|
||||
);
|
||||
}
|
||||
return blurRadius;
|
||||
}
|
||||
@ -39,13 +47,17 @@ class BlurView extends Component {
|
||||
// Android blurRadius + downsampleFactor is approximately 80% of blurAmount.
|
||||
const equivalentBlurRadius = Math.round(blurAmount * 0.8);
|
||||
|
||||
if (equivalentBlurRadius > 25) return 25;
|
||||
if (equivalentBlurRadius > 25) {
|
||||
return 25;
|
||||
}
|
||||
return equivalentBlurRadius;
|
||||
}
|
||||
|
||||
downsampleFactor() {
|
||||
const { downsampleFactor, blurRadius } = this.props;
|
||||
if (downsampleFactor != null) return downsampleFactor;
|
||||
if (downsampleFactor != null) {
|
||||
return downsampleFactor;
|
||||
}
|
||||
return blurRadius;
|
||||
}
|
||||
|
||||
@ -53,8 +65,9 @@ class BlurView extends Component {
|
||||
if (this.props.children != null) {
|
||||
throw new Error(
|
||||
'[ReactNativeBlur]: BlurView cannot contain any child views on Android. ' +
|
||||
'You should use "position: absolute" on the BlurView, ' +
|
||||
'and place other views in front of it.');
|
||||
'You should use "position: absolute" on the BlurView, ' +
|
||||
'and place other views in front of it.'
|
||||
);
|
||||
}
|
||||
|
||||
const { viewRef, style } = this.props;
|
||||
@ -65,10 +78,7 @@ class BlurView extends Component {
|
||||
blurRadius={this.blurRadius()}
|
||||
downsampleFactor={this.downsampleFactor()}
|
||||
overlayColor={this.overlayColor()}
|
||||
style={[
|
||||
{ backgroundColor: 'transparent' },
|
||||
style,
|
||||
]}
|
||||
style={[{ backgroundColor: 'transparent' }, style]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -7,17 +7,14 @@ class BlurView extends Component {
|
||||
if (this._root) {
|
||||
this._root.setNativeProps(nativeProps);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<NativeBlurView
|
||||
ref={e => this._root = e}
|
||||
ref={e => (this._root = e)}
|
||||
{...this.props}
|
||||
style={[
|
||||
{ backgroundColor: 'transparent' },
|
||||
this.props.style,
|
||||
]}
|
||||
style={[{ backgroundColor: 'transparent' }, this.props.style]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ import React from 'react';
|
||||
|
||||
class VibrancyView extends React.Component {
|
||||
render() {
|
||||
console.error("VibrancyView is not implemented on Android");
|
||||
console.error('VibrancyView is not implemented on Android');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = VibrancyView
|
||||
module.exports = VibrancyView;
|
||||
|
@ -7,15 +7,17 @@ class VibrancyView extends Component {
|
||||
if (this._root) {
|
||||
this._root.setNativeProps(nativeProps);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<NativeVibrancyView
|
||||
{...this.props}
|
||||
style={[{
|
||||
backgroundColor: 'transparent',
|
||||
}, this.props.style,
|
||||
style={[
|
||||
{
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
this.props.style,
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|