react-native-walkthrough-tooltip icon indicating copy to clipboard operation
react-native-walkthrough-tooltip copied to clipboard

Fix for incorrect value of tooltipDuplicate for original children

Open SyedTayyabUlMazhar opened this issue 2 years ago • 0 comments
trafficstars

Hi! 👋

Firstly, thanks for your work on this project! 🙂

In situations where you have nested Tooltip whose isVisible is false, while the parent's is true. The nested context consumer will get tooltipDuplicate true. A fix for this problem is to also wrap the original children in Context.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-walkthrough-tooltip/src/tooltip.js b/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
index 3098692..326f949 100644
--- a/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
+++ b/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
@@ -486,7 +486,9 @@ class Tooltip extends Component {
             onLayout={this.measureChildRect}
             style={this.props.parentWrapperStyle}
           >
-            {children}
+            <TooltipChildrenContext.Provider value={{ tooltipDuplicate: false }}>
+              {children}
+            </TooltipChildrenContext.Provider>
           </View>
         ) : null}
 

SyedTayyabUlMazhar avatar Sep 06 '23 12:09 SyedTayyabUlMazhar