react-native-tip icon indicating copy to clipboard operation
react-native-tip copied to clipboard

The tip image is duplicated only on Android devices

Open MichaelAmadheo opened this issue 3 years ago • 2 comments

This is only happening on android devices when i click on the button that is wrapped in <Tip>. It showing the duplicated button right below the wrapped button

This is the code:

<Tip
 id={tooltipId}
 body={FAVORITE.PRICE_MAY_CHANGE}
 bodyStyle={styles.tooltipCaption}
 active={false}
 onDismiss={() => this.dismissPriceTooltip(tooltipId)}
 tipContainerStyle={styles.tooltipStyle}
 overlayOpacity={-1}
>
 <TouchableOpacity onPress={() => this.showHidePriceTooltip(tooltipId)}>
  <Image
   source={toolTipIcon}
   style={styles.tooltipIcon}
  />
 </TouchableOpacity>
</Tip>

And this is the duplicated button on android:

Screenshot 2022-12-23 at 11 08 22

I think It's happening because of the {this.renderItem()} on tipProvider.js

Could you check on this? Thanks!

MichaelAmadheo avatar Dec 23 '22 04:12 MichaelAmadheo

I was able to address this by removing the additional StatusBar.currentHeight offset.

Here is a patch of the changes.

diff --git a/node_modules/react-native-tip/src/utils.js b/node_modules/react-native-tip/src/utils.js
index 81438a8..5b10b1d 100644
--- a/node_modules/react-native-tip/src/utils.js
+++ b/node_modules/react-native-tip/src/utils.js
@@ -29,7 +29,7 @@ export function clearItemStyles(styles) {
 export async function getItemCoordinates(target) {
     const itemCoordinates = new Promise((resolve, reject) => {
         UIManager.measure(target, (x, y, width, height, px, py) => {
-            py = py + StatusBar.currentHeight
+            py = py
 
             const coords = {
                 width,

sin2 avatar Feb 01 '23 17:02 sin2

Is this fixed in the latest 0.0.19?

MichaelAmadheo avatar Feb 21 '23 09:02 MichaelAmadheo