Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-native-community/blur

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/blur

React Native Blur component

  • 4.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135K
increased by9%
Maintainers
1
Weekly downloads
 
Created

What is @react-native-community/blur?

@react-native-community/blur is a React Native package that provides a BlurView component to create blur effects on views. It is useful for creating visually appealing UI elements by applying a blur effect to background images or views.

What are @react-native-community/blur's main functionalities?

Basic Blur Effect

This code demonstrates how to apply a basic blur effect to an image using the BlurView component. The blurType prop specifies the type of blur (e.g., light, dark), and the blurAmount prop specifies the intensity of the blur.

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

const App = () => {
  return (
    <View style={styles.container}>
      <Image source={{ uri: 'https://example.com/image.jpg' }} style={styles.image} />
      <BlurView style={styles.absolute} blurType="light" blurAmount={10} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  image: {
    width: 300,
    height: 300,
  },
  absolute: {
    position: 'absolute',
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
  },
});

export default App;

Dynamic Blur Effect

This code demonstrates how to create a dynamic blur effect where the blur intensity can be adjusted using a slider. The blurAmount state is updated based on the slider's value, and the BlurView component's blurAmount prop is set accordingly.

import React, { useState } from 'react';
import { View, Image, Slider, StyleSheet } from 'react-native';
import { BlurView } from '@react-native-community/blur';

const App = () => {
  const [blurAmount, setBlurAmount] = useState(10);

  return (
    <View style={styles.container}>
      <Image source={{ uri: 'https://example.com/image.jpg' }} style={styles.image} />
      <BlurView style={styles.absolute} blurType="light" blurAmount={blurAmount} />
      <Slider
        style={styles.slider}
        minimumValue={0}
        maximumValue={20}
        value={blurAmount}
        onValueChange={setBlurAmount}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  image: {
    width: 300,
    height: 300,
  },
  absolute: {
    position: 'absolute',
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
  },
  slider: {
    position: 'absolute',
    bottom: 50,
    width: 300,
  },
});

export default App;

Other packages similar to @react-native-community/blur

Keywords

FAQs

Package last updated on 29 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc