All Projects → Kureev → React Native Blur

Kureev / React Native Blur

Licence: mit
React Native Blur component

Programming Languages

objective c
16641 projects - #2 most used programming language
javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
Starlark
911 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to React Native Blur

react-native-card-list
A React Native component which displays a list of image cards that zoom to fullscreen
Stars: ✭ 19 (-99.4%)
Mutual labels:  react-native-component
react-native-android-bottom-navigation
Native UI Component of Android's BottomNavigation for react-native
Stars: ✭ 18 (-99.43%)
Mutual labels:  react-native-component
monalisa-ui
MonalisaUI ✨ React Native UI Library
Stars: ✭ 37 (-98.84%)
Mutual labels:  react-native-component
react-native-masonry-brick-list
Staggered Or Masonary List View For React Native Written in pure js
Stars: ✭ 24 (-99.25%)
Mutual labels:  react-native-component
react-native-user-inactivity
Simple component that alerts when the user is inactive (i.e. when the App surface hasn't been touched for X ms)
Stars: ✭ 148 (-95.34%)
Mutual labels:  react-native-component
react-native-category
react-native-category
Stars: ✭ 23 (-99.28%)
Mutual labels:  react-native-component
react-native-radio-buttons-group
Simple, best and easy to use radio buttons for react native apps.
Stars: ✭ 145 (-95.44%)
Mutual labels:  react-native-component
React Native Mentions
Mentions textbox for React Native. Works on both ios and android. 🐳
Stars: ✭ 277 (-91.29%)
Mutual labels:  react-native-component
react-native-value-picker
Cross-Platform iOS(ish) style picker for react native.
Stars: ✭ 18 (-99.43%)
Mutual labels:  react-native-component
react-native-bouncing-ball
react native component bouncing ball for iOS and Android
Stars: ✭ 36 (-98.87%)
Mutual labels:  react-native-component
react-native-bubble-tabbar
🧼 Bubble Tab Bar Component for React Native which supports React Navigation V5 and TypeScript
Stars: ✭ 43 (-98.65%)
Mutual labels:  react-native-component
iconic-input
Beautiful Input components for React Native... <IconicTextbox/> and much more!
Stars: ✭ 22 (-99.31%)
Mutual labels:  react-native-component
react-native-responsive-image-view
React Native component for scaling an Image within the parent View
Stars: ✭ 152 (-95.22%)
Mutual labels:  react-native-component
react-native-swipe-action-list
A list view that supports swipe actions for React Native (Android & iOS).
Stars: ✭ 18 (-99.43%)
Mutual labels:  react-native-component
ExploreRN
新版本RN项目,Base on 0.66.4,包含众多RN组件,先实践后使用,累积方案应对各种场景,后端地址:https://github.com/supervons/ExploreKoa
Stars: ✭ 112 (-96.48%)
Mutual labels:  react-native-component
react-native-window-guard
SafeAreaView alternative for React Native which provides relevant window insets for both iOS and Android.
Stars: ✭ 30 (-99.06%)
Mutual labels:  react-native-component
react-native-boilerplate
React Native Boilerplate - React Native Starter Kits : react-navigation and its dependencies, redux, redux persist and redux thunk, redux toolkit, react native vector icons, react-native async storage
Stars: ✭ 68 (-97.86%)
Mutual labels:  react-native-component
React Native Maps Super Cluster
A Clustering-enabled map for React Native
Stars: ✭ 284 (-91.07%)
Mutual labels:  react-native-component
react-native-gesture-detector
Create and detect custom, complex gestures in React Native. 🍭
Stars: ✭ 75 (-97.64%)
Mutual labels:  react-native-component
react-native-background-shapes
Beautiful backgrounds shapes to React Native based in flex (Android + IOS)
Stars: ✭ 65 (-97.96%)
Mutual labels:  react-native-component

@react-native-community/blur

npm version

A component for UIVisualEffectView's blur and vibrancy effect on iOS, and BlurView on Android.

Content

Installation

  1. Install the library using either Yarn:
yarn add @react-native-community/blur

or npm:

npm install --save @react-native-community/blur
  1. React-Native 0.59 and below only: Link your native dependencies:
react-native link @react-native-community/blur
  1. (iOS only) Install to Xcode:
npx pod-install

Or, if you already have installed Cocoapods on your system:

cd ios && pod install
  1. (Android only, optional) If you've defined project-wide properties (recommended) in your root build.gradle, this library will detect the presence of the following properties:
buildscript {...}
allprojects {...}

/**
  + Project-wide Gradle configuration properties
  */
ext {
    compileSdkVersion   = 27
    targetSdkVersion    = 27
    buildToolsVersion   = "27.0.3"
}
  1. Include the library in your code:
import { BlurView, VibrancyView } from "@react-native-community/blur";
  1. Compile and have fun!

BlurView

Properties:

  • blurType (String)
    • xlight - extra light blur type
    • light - light blur type
    • dark - dark blur type
    • extraDark - extra dark blur type (tvOS only)
    • regular - regular blur type (iOS 10+ and tvOS only)
    • prominent - prominent blur type (iOS 10+ and tvOS only)
    • iOS 13 only Blur types:
      • chromeMaterial - An adaptable blur effect that creates the appearance of the system chrome.
      • material - An adaptable blur effect that creates the appearance of a material with normal thickness.
      • thickMaterial - An adaptable blur effect that creates the appearance of a material that is thicker than normal.
      • thinMaterial - An adaptable blur effect that creates the appearance of an ultra-thin material.
      • ultraThinMaterial - An adaptable blur effect that creates the appearance of an ultra-thin material.
      • chromeMaterialDark - A blur effect that creates the appearance of an ultra-thin material and is always dark.
      • materialDark - A blur effect that creates the appearance of a thin material and is always dark.
      • thickMaterialDark - A blur effect that creates the appearance of a material with normal thickness and is always dark.
      • thinMaterialDark - A blur effect that creates the appearance of a material that is thicker than normal and is always dark.
      • ultraThinMaterialDark - A blur effect that creates the appearance of the system chrome and is always dark.
      • chromeMaterialLight - An adaptable blur effect that creates the appearance of the system chrome.
      • materialLight - An adaptable blur effect that creates the appearance of a material with normal thickness.
      • thickMaterialLight - An adaptable blur effect that creates the appearance of a material that is thicker than normal.
      • thinMaterialLight - An adaptable blur effect that creates the appearance of a thin material.
      • ultraThinMaterialLight - An adaptable blur effect that creates the appearance of an ultra-thin material.
  • blurAmount (Default: 10, Number)
    • 0-100 - Adjusts blur intensity
  • reducedTransparencyFallbackColor (Color) (iOS only)
    • black, white, #rrggbb, etc - background color to use if accessibility setting ReduceTransparency is enabled

Note: The maximum blurAmount on Android is 32, so higher values will be clamped to 32.

Complete usage example that works on iOS and Android:

import React, { Component } from "react";
import { View, Image, Text, StyleSheet } from "react-native";
import { BlurView } from "@react-native-community/blur";

export default class Menu extends Component {

  render() {
    return (
      <View style={styles.container}>
        <Image
          key={'blurryImage'}
          source={{ uri }}
          style={styles.absolute}
        />
        <Text style={styles.absolute}>Hi, I am some blurred text</Text>
{/* in terms of positioning and zIndex-ing everything before the BlurView will be blurred */}
        <BlurView
          style={styles.absolute}
          blurType="light"
          blurAmount={10}
          reducedTransparencyFallbackColor="white"
        />
        <Text>I'm the non blurred text because I got rendered on top of the BlurView</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    justifyContent: "center",
    alignItems: "center"
  },
  absolute: {
    position: "absolute",
    top: 0,
    left: 0,
    bottom: 0,
    right: 0
  }
});

In this example, the Image component will be blurred, because the BlurView in positioned on top. But the Text will stay unblurred.

If the accessibility setting Reduce Transparency is enabled the BlurView will use reducedTransparencyFallbackColor as it's background color rather than blurring. If no reducedTransparencyFallbackColor is provided, theBlurViewwill use the default fallback color (white, black, or grey depending on blurType)

VibrancyView

Uses the same properties as BlurView (blurType, blurAmount, and reducedTransparencyFallbackColor).

The vibrancy effect lets the content underneath a blurred view show through more vibrantly

(Note: VibrancyView is only supported on iOS. Also note that the VibrancyView must contain nested views.)

import { VibrancyView } from "@react-native-community/blur";

export default class Menu extends Component {
  render() {
    return (
      <Image source={{ uri }} style={styles.absolute}>
        <VibrancyView blurType="light" style={styles.flex}>
          <Text>Hi, I am some vibrant text.</Text>
        </VibrancyView>
      </Image>
    );
  }
}

Android

Android uses the BlurView.

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)
  • 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)

Example React Native App

This project includes an example React Native app, which was used to make the GIF in this README. You can run the apps by following these steps:

  1. Clone the repository
cd ~
git clone https://github.com/react-native-community/react-native-blur.git
  1. cd to example
cd react-native-blur/example
  1. Install dependencies
npm install
  1. Run the apps:

Run the iOS app

react-native run-ios

Run the tvOS app

type:

react-native run-ios

react-native link don’t works properly with the tvOS target so we need to add the library manually.

First select your project in Xcode.

After that, select the tvOS target of your application and select « General » tab

Scroll to « Linked Frameworks and Libraries » and tap on the + button

Select RNBlur-tvOS

That’s all, you can use react-native-blur for your tvOS application

Run the Android app

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

...
import com.cmcewen.blurview.BlurViewPackage;
...

public class MainApplication extends Application implements ReactApplication {
...
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new BlurViewPackage()
      );
    }
...
}

Questions?

Feel free to contact me on twitter or create an issue

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].