feat: extend android properties (#481)
This commit is contained in:
parent
af4974a394
commit
c99d90511a
|
@ -65,4 +65,15 @@ class BlurViewManager extends ViewGroupManager<BlurView> {
|
|||
|
||||
@ReactProp(name = "downsampleFactor", defaultInt = defaultSampling)
|
||||
public void setDownsampleFactor(BlurView view, int factor) {}
|
||||
|
||||
@ReactProp(name = "autoUpdate", defaultBoolean = true)
|
||||
public void setAutoUpdate(BlurView view, boolean autoUpdate) {
|
||||
view.setBlurAutoUpdate(autoUpdate);
|
||||
view.invalidate();
|
||||
}
|
||||
|
||||
@ReactProp(name = "enabled", defaultBoolean = true)
|
||||
public void setBlurEnabled(BlurView view, boolean enabled) {
|
||||
view.setBlurEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,19 +20,26 @@ export type BlurViewProps = ViewProps & {
|
|||
blurRadius?: number;
|
||||
downsampleFactor?: number;
|
||||
overlayColor?: string;
|
||||
enabled?: boolean;
|
||||
autoUpdate?: boolean;
|
||||
};
|
||||
|
||||
const BlurView = forwardRef<View, BlurViewProps>(
|
||||
({
|
||||
downsampleFactor,
|
||||
blurRadius,
|
||||
blurAmount = 10,
|
||||
blurType = 'dark',
|
||||
overlayColor,
|
||||
children,
|
||||
style,
|
||||
...rest
|
||||
}, ref) => {
|
||||
(
|
||||
{
|
||||
downsampleFactor,
|
||||
blurRadius,
|
||||
blurAmount = 10,
|
||||
blurType = 'dark',
|
||||
overlayColor,
|
||||
enabled,
|
||||
autoUpdate,
|
||||
children,
|
||||
style,
|
||||
...rest
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
useEffect(() => {
|
||||
DeviceEventEmitter.addListener('ReactNativeBlurError', (message) => {
|
||||
throw new Error(`[ReactNativeBlur]: ${message}`);
|
||||
|
@ -88,6 +95,8 @@ const BlurView = forwardRef<View, BlurViewProps>(
|
|||
overlayColor={getOverlayColor()}
|
||||
blurAmount={blurAmount}
|
||||
blurType={blurType}
|
||||
enabled={enabled}
|
||||
autoUpdate={autoUpdate}
|
||||
pointerEvents="none"
|
||||
style={StyleSheet.compose(styles.transparent, style)}
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue