fix: use .native for masked view instead of .web

This commit is contained in:
Satyajit Sahoo
2020-02-03 05:47:25 +01:00
parent ba85db28d4
commit abdf9d12b5
3 changed files with 22 additions and 21 deletions

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import { UIManager } from 'react-native';
import RNCMaskedView from '@react-native-community/masked-view';
type Props = React.ComponentProps<typeof RNCMaskedView> & {
children: React.ReactElement;
};
const isMaskedViewAvailable =
// @ts-ignore
UIManager.getViewManagerConfig('RNCMaskedView') != null;
export default function MaskedView({ children, ...rest }: Props) {
if (isMaskedViewAvailable) {
return <RNCMaskedView {...rest}>{children}</RNCMaskedView>;
}
return children;
}

View File

@@ -1,19 +1,10 @@
import * as React from 'react';
import { UIManager } from 'react-native';
import RNCMaskedView from '@react-native-community/masked-view';
type Props = React.ComponentProps<typeof RNCMaskedView> & {
type Props = {
maskElement: React.ReactElement;
children: React.ReactElement;
};
const isMaskedViewAvailable =
// @ts-ignore
UIManager.getViewManagerConfig('RNCMaskedView') != null;
export default function MaskedView({ children, ...rest }: Props) {
if (isMaskedViewAvailable) {
return <RNCMaskedView {...rest}>{children}</RNCMaskedView>;
}
export default function MaskedView({ children }: Props) {
return children;
}

View File

@@ -1,9 +0,0 @@
import * as React from 'react';
type Props = {
children: React.ReactElement;
};
export default function MaskedView({ children }: Props) {
return children;
}