-
Notifications
You must be signed in to change notification settings - Fork 60
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
pixel gap on ios #28
Comments
Can you put it on [Snack](https://snack.expo.dev/) and see if it happens in
the iOS emulator, please? If so, send here its link!
Thanks!
|
https://snack.expo.dev/@joe06102/6c4fc6 I can not reproduce the problem on the expo. Do you have any idea how it happens? |
I will take a look into it this weekend. It would be very helpful for me if you find a way to reproduce it on iOS emulator in Expo (as I don't own an iOS), maybe trying a bigger resolution somehow (the gaps may be vanishing due to the zoom out / scale, the many pixels of the ios screen become fewer pixels to fit our pc screens), maybe trying fractional sizes, like 101.93 etc. As you are entering the size prop, I think the problem may be in the dp to pixel conversion. If I can't find how to fix it, I will use the native iOS shadow, that very certainly will have the exact same look as this lib for Android. |
Just to be sure, what version of this lib are you using in your project? Please, ensure you are using the latest one and clean your RN/Expo cache and try it again, if you at some point had a previous version. |
Thx for the reply! I'm using the latest version 5.1.0. I tried starting the program with the resetCache: true, which did not work either. Besides, I've run the program on different apple devices and the behaviors varies among them. on iPhone 6s, the gap is less obvious on the iPhone 6s than that on the iphoneX. |
I tried the native shadow on ios before but it did behave the same as the shadow-2 with the same params. Maybe I should take more tries to align the behaviors. |
By native shadow, I mean the https://reactnative.dev/docs/shadow-props :) I am going to ask a few things -- this is the only way I may help your case and other iOS users (besides the fallback to the native shadow):
Copy it and the utils.ts to a folder in your project, and import the Shadow component from it.
Edit: if you don't use typescript, you will need to change the lib .js file in the node_modules/react-native-shadow-2/lib. You may need to rename the variable values if they have different names there, changed in the TS compilation process. The line number may also be different, but just add it before the return inside the shadow useMemo(). |
Thx, SrBrahma. The output with size={[100,100]}(render only triggered once): {
"scale": 2,
"width": 100,
"height": 100,
"distance": 15,
"radii": {
"topLeft": 10,
"topRight": 10,
"bottomLeft": 10,
"bottomRight": 10
},
"cornerShadowRadius": {
"topLeftShadow": 25,
"topRightShadow": 25,
"bottomLeftShadow": 25,
"bottomRightShadow": 25
}
} And the output without size props(render triggered twice): //the first
{
"scale": 2,
"width": "100%",
"height": "100%",
"distance": 15,
"radii": {
"topLeft": 10,
"topRight": 10,
"bottomLeft": 10,
"bottomRight": 10
},
"cornerShadowRadius": {
"topLeftShadow": 25,
"topRightShadow": 25,
"bottomLeftShadow": 25,
"bottomRightShadow": 25
}
}
// the second
{
"scale": 2,
"width": 100,
"height": 100,
"distance": 15,
"radii": {
"topLeft": 10,
"topRight": 10,
"bottomLeft": 10,
"bottomRight": 10
},
"cornerShadowRadius": {
"topLeftShadow": 25,
"topRightShadow": 25,
"bottomLeftShadow": 25,
"bottomRightShadow": 25
}
} Unfortunately, the problems still happen in both case. |
I appreciate. Is there any gap when using radius={0}? |
Seems that we are having overlaps before the gaps. Apparently the problem is how iOS is handling the parts positioning. Can you send here an image with <Shadow
distance={15}
startColor={'#00f9'}
finalColor={'#f009'}
radius={0}
size={[100, 100]}
paintInside
/> then <Shadow
distance={15}
startColor={'#00f9'}
finalColor={'#f009'}
radius={0}
size={[100, 100]}
sides={[]}
paintInside
/> then <Shadow
distance={15}
startColor={'#00f9'}
finalColor={'#f009'}
radius={0}
size={[100, 100]}
corners={[]}
paintInside
/> All without the child. This will allow us to see what parts are invading the other part space. Also, in line 43 there is |
You are being very helpful! Thanks a lot, really. Three questions before trying the fixes: a) Are you using the copied .tsx file or changing the .js in node_modules? I ask this because sometimes when changing the node_modules files they won't take effect right away. b) Just to be sure, are you using [email protected], right? c) Are you using RTL? If you don't know what this is, you are not using and that's ok (would also be ok to use it) Using the previous component: <Shadow
distance={15}
startColor={'#00f9'}
finalColor={'#f009'}
radius={0}
size={[100, 100]}
paintInside
/> No need to send images for the requests below as I don't want to give you too much work, but be very attentive with the answers. For each item, watch out for any changes and report them or say that there are visible no changes. For right gap:
Undo everything above. For top overlap:
If we don't achieve success and I don't have any more ideas, I will open an Issue at the react-native-svg repo requesting for help. Once again, thank you very much for your service! :) |
It seemed like that there were some incorrect screen-scale settings in our ios app that led to the problem. By accident, I found all the gaps are disappeared after they fixed the screen-scale errors. And the lib works like a charm now on both platforms. |
:) Please let me know later where was the problem! |
Thanks, @walterholohan . Just on the bottom side? I have an iOS now and when I have the time I will investigate this. |
Nope its on the right side too if I add a x offset |
When used on my own project on ios(plain react native project), there are obvious gaps between corners & borders. But in expo demo, it works fine.
And the shadow works fine on android. I found some docs on the documentation about the gap but can not really understand it.
Appreciated if any one can help!
reproducable code:
The text was updated successfully, but these errors were encountered: