Skip to content

Commit

Permalink
fix: disable filters on platforms other than iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jakex7 committed May 22, 2024
1 parent 9dc9065 commit 9586393
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/elements/filters/FeGaussianBlur.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { NativeMethods } from 'react-native';
import { NativeMethods, Platform } from 'react-native';
import RNSVGFeGaussianBlur from '../../fabric/FeGaussianBlurNativeComponent';
import {
extractFeGaussianBlur,
Expand Down Expand Up @@ -27,6 +27,7 @@ export default class FeGaussianBlur extends FilterPrimitive<FeGaussianBlurProps>
};

render() {
if (Platform.OS !== 'ios') return;
return (
<RNSVGFeGaussianBlur
ref={(ref) =>
Expand Down
3 changes: 2 additions & 1 deletion src/elements/filters/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import RNSVGFilter from '../../fabric/FilterNativeComponent';
import Shape from '../Shape';
import { NativeMethods } from 'react-native';
import { NativeMethods, Platform } from 'react-native';
import { NumberProp, Units } from '../../lib/extract/types';

export interface FilterProps {
Expand Down Expand Up @@ -42,6 +42,7 @@ export default class Filter extends Shape<FilterProps> {
height,
filterUnits: filterUnits || 'objectBoundingBox',
};
if (Platform.OS !== 'ios') return;
return (
<RNSVGFilter
ref={(ref) => this.refMethod(ref as (Filter & NativeMethods) | null)}
Expand Down
4 changes: 3 additions & 1 deletion src/fabric/FeGaussianBlurNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ export interface NativeProps
edgeMode?: WithDefault<FilterEdgeMode, 'none'>;
}

export default codegenNativeComponent<NativeProps>('RNSVGFeGaussianBlur');
export default codegenNativeComponent<NativeProps>('RNSVGFeGaussianBlur', {
excludedPlatforms: ['android'],
});
4 changes: 3 additions & 1 deletion src/fabric/FilterNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ interface NativeProps extends ViewProps {
primitiveUnits?: WithDefault<Units, 'userSpaceOnUse'>;
}

export default codegenNativeComponent<NativeProps>('RNSVGFilter');
export default codegenNativeComponent<NativeProps>('RNSVGFilter', {
excludedPlatforms: ['android'],
});

0 comments on commit 9586393

Please sign in to comment.