@danielsaraldi/react-native-blur-view
Version:
A simple blur view in react native
45 lines (44 loc) • 1.41 kB
JavaScript
;
import { forwardRef } from 'react';
import { Platform, View } from 'react-native';
import Target from './TargetViewNativeComponent';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* @description The `BlurTarget` component is used in conjunction with
* `BlurView` to specify the area that should be blurred. It acts as a target
* for the blur effect. It's **required** for Android.
*
* @see https://github.com/DanielAraldi/react-native-blur-view?tab=readme-ov-file#blurtarget
*
* @since 1.0.0
*
* @example
* ```tsx
* import React, { useRef } from 'react';
* import { View, Text } from 'react-native';
* import { BlurView, BlurTarget } from '@danielsaraldi/react-native-blur-view';
* import { styles } from './styles';
*
* const MyComponent = () => {
* const blurTargetRef = useRef<View | null>(null);
*
* return (
* <View style={styles.container}>
* <BlurTarget ref={blurTargetRef} style={styles.blurTarget} />
*
* <BlurView blurTarget={blurTargetRef} style={styles.blurView}>
* <Text style={styles.blurText}>Blurred Content</Text>
* </BlurView>
* </View>
* );
* };
* ```
*/
export const BlurTarget = /*#__PURE__*/forwardRef((props, ref) => Platform.OS !== 'android' ? /*#__PURE__*/_jsx(View, {
ref: ref,
...props
}) : /*#__PURE__*/_jsx(Target, {
ref: ref,
...props
}));
//# sourceMappingURL=BlurTarget.js.map