jasongaare / react-native-walkthrough-tooltip

An inline wrapper for calling out React Native components via tooltip
MIT License
622 stars 184 forks source link

Patch for ChildrenWithProps #166

Open Qwin opened 2 years ago

Qwin commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-walkthrough-tooltip@1.4.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-walkthrough-tooltip/src/tooltip.d.ts b/node_modules/react-native-walkthrough-tooltip/src/tooltip.d.ts
index 5a7ef59..bd497f9 100644
--- a/node_modules/react-native-walkthrough-tooltip/src/tooltip.d.ts
+++ b/node_modules/react-native-walkthrough-tooltip/src/tooltip.d.ts
@@ -2,7 +2,7 @@
 // Original definitions by: Siraj Alam https://github.com/sirajalam049

 declare module 'react-native-walkthrough-tooltip' {
-  import React from 'react';
+  import React, { PropsWithChildren } from 'react';
   import { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native';

   type Orientation =
@@ -166,7 +166,7 @@ declare module 'react-native-walkthrough-tooltip' {
         </Tooltip>
  */

This issue body was partially generated by patch-package.

wonecode commented 2 years ago

Hi, it looks not working to me using patch-package, i got the following error from running patch-package command, have you an idea to solve it ?

❯ yarn patch-package --use-yarn react-native-walkthrough-tooltip
yarn run v1.22.19
$ /Users/*****/Documents/Dev/Marelis/marelis-quality-form/node_modules/.bin/patch-package --use-yarn react-native-walkthrough-tooltip
patch-package 6.5.0
• Creating temporary folder
• Installing react-native-walkthrough-tooltip@1.4.0 with yarn
• Diffing your files with clean files
⁉️  Not creating patch file for package 'react-native-walkthrough-tooltip'
⁉️  There don't appear to be any changes.
MustagheesButt commented 1 year ago

I get this warning while using with typescript:

No overload matches this call.
  Overload 1 of 2, '(props: TooltipProps | Readonly<TooltipProps>): Tooltip', gave the following error.
    Type '{ children: Element; isVisible: boolean; content: Element; onClose: () => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Tooltip> & Readonly<TooltipProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Tooltip> & Readonly<TooltipProps>'.
  Overload 2 of 2, '(props: TooltipProps, context: any): Tooltip', gave the following error.
    Type '{ children: Element; isVisible: boolean; content: Element; onClose: () => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Tooltip> & Readonly<TooltipProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Tooltip> & Readonly<TooltipProps>'

Maybe it's related to this issue.