react-native-masked-view / masked-view

React Native Masked View Library
MIT License
960 stars 120 forks source link

JSX element class does not support attributes because it does not have a 'props' property. #190

Closed soemarko closed 1 year ago

soemarko commented 1 year ago
Screenshot 2023-02-24 at 6 11 42 pm

Getting that error on vscode, although everything seems to work just fine.

bufgix commented 1 year ago

Im getting same error after upgrading expo 48

magrinj commented 1 year ago

@soemarko Seems to be fixed on main branch, waiting for this fix to be released. In the meantime you can use patch-package with the following patch file:

diff --git a/node_modules/@react-native-masked-view/masked-view/types/index.d.ts b/node_modules/@react-native-masked-view/masked-view/types/index.d.ts
index acafcc2..6a66a1e 100644
--- a/node_modules/@react-native-masked-view/masked-view/types/index.d.ts
+++ b/node_modules/@react-native-masked-view/masked-view/types/index.d.ts
@@ -3,6 +3,8 @@
 import * as React from 'react';
 import * as ReactNative from 'react-native';

+type Constructor<T> = new (...args: any[]) => T;
+
 interface MaskedViewProps extends ReactNative.ViewProps {
   maskElement: React.ReactElement;
   androidRenderingMode?: 'software' | 'hardware';
@@ -11,7 +13,7 @@ interface MaskedViewProps extends ReactNative.ViewProps {
  * @see https://github.com/react-native-masked-view/masked-view
  */
 declare class MaskedViewComponent extends React.Component<MaskedViewProps> {}
-declare const MaskedViewBase: ReactNative.Constructor<
+declare const MaskedViewBase: Constructor<
   ReactNative.NativeMethods
 > &
   typeof MaskedViewComponent;
luicfrr commented 1 year ago

same issue

lexi-stein commented 1 year ago

@Naturalclar do you know when the fix will be released?

peteygao commented 1 year ago

While waiting for the release, in the mean time you can just use the latest commit in main (at the time of this writing) directly via the terminal (syntax for Yarn 2+; Yarn 1 and npm users, you're on your own to figure out the correct syntax, but ironically it's much simpler than Yarn 2+ 😂):

yarn add \@react-native-masked-view/masked-view@git+https://github.com/react-native-masked-view/masked-view.git#8b4b2f970e4f0dc3639dd93db8a87fefe286c42e

You can also replace the hash with main if you want to peg it to the main branch, but I personally would never recommend using a non-hash and following a branch; that'll introduce weird breakages in your build down the line when.

Naturalclar commented 1 year ago

@alexi-stein thanks for the ping! Just released version v0.2.9 with the fix :rocket: