본문 바로가기
프로그래밍/React Native

[React Native] Blur 효과 만들기

by CaffeLatte 2022. 8. 5.

1. https://github.com/Kureev/react-native-blur

 

GitHub - Kureev/react-native-blur: React Native Blur component

React Native Blur component. Contribute to Kureev/react-native-blur development by creating an account on GitHub.

github.com

라이브러리를 이용한 blur 방법이다

해당 사이트의 문서를 참고하자

 

 

2. https://reactnative.dev/docs/0.65/image#blurradius

 

Image · React Native

A React component for displaying different types of images, including network images, static resources, temporary local images, and images from local disk, such as the camera roll.

reactnative.dev

Image component의 blurRadius를 사용하는 방법이다

<Image
  source={require('blur.png')}
  style={{
    position: 'absolute',
    width: '100%',
    height: '100%',
  }}
  resizeMode="cover"
  blurRadius={0}
/>

Image component라 source가 필요하다

그리고 blurRadius를 조절해보자(직접 해보면 이해됨)

 

 

3. https://reactnative.dev/docs/0.65/view

 

View · React Native

The most fundamental component for building a UI, View is a container that supports layout with flexbox, style, some touch handling, and accessibility controls. View maps directly to the native view equivalent on whatever platform React Native is running o

reactnative.dev

View component의 style을 사용하는 방법이다

<View
  style={{
    position: 'absolute',
    width: '100%',
    height: '100%',
    backgroundColor: '#ffffff80', // white의 alpha값 50%
  }}
/>

alpha값을 조절하여 비슷한 효과를 준다

'#ffffff80'은 '#rrggbbaa'이며 aa는 alpha값이다

alpha값 참고(https://success206.tistory.com/166)

 

 

 

끝.

댓글