Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add children type to SkeletonPlaceholderItemProps to prevent warnings when nesting SkeletonPlaceholder.Item #99

Open
shaunp-street opened this issue Oct 21, 2022 · 4 comments

Comments

@shaunp-street
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

When nesting SkeletonPlaceholder.Item typescript errors occur as there is not children prop.

image

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
index 58cfac7..7c8fc8d 100644
--- a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
+++ b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
@@ -33,6 +33,7 @@ declare type SkeletonPlaceholderProps = {
 };
 declare type SkeletonPlaceholderItemProps = ViewStyle & {
     style?: StyleProp<ViewStyle>;
+    children?: JSX.Element[] | JSX.Element;
 };
 declare const SkeletonPlaceholder: React.FC<SkeletonPlaceholderProps> & {
     Item: React.FC<SkeletonPlaceholderItemProps>;

This issue body was partially generated by patch-package.

@sterlingwes
Copy link

This was required for me (parent placeholder element can take multiple children)

diff --git a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
index 58cfac7..0fb7755 100644
--- a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
+++ b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
@@ -4,7 +4,7 @@ declare type SkeletonPlaceholderProps = {
     /**
      * Determines component's children.
      */
-    children: JSX.Element;
+    children: JSX.Element[] | JSX.Element;
     /**
      * Determines the color of placeholder.
      */
@@ -33,6 +33,7 @@ declare type SkeletonPlaceholderProps = {
 };
 declare type SkeletonPlaceholderItemProps = ViewStyle & {
     style?: StyleProp<ViewStyle>;
+    children?: JSX.Element[] | JSX.Element;
 };
 declare const SkeletonPlaceholder: React.FC<SkeletonPlaceholderProps> & {
     Item: React.FC<SkeletonPlaceholderItemProps>;

@Splicer97
Copy link

Same for me. Can somebody create PR for this bug?

@chramos
Copy link
Owner

chramos commented Dec 15, 2022

I appreciate if somebody create a PR

@Splicer97
Copy link

I appreciate if somebody create a PR

#109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants