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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird top padding while scaling #220

Open
mariovillamizar opened this issue Mar 23, 2022 · 0 comments
Open

Weird top padding while scaling #220

mariovillamizar opened this issue Mar 23, 2022 · 0 comments

Comments

@mariovillamizar
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-native-credit-card-input@0.4.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-credit-card-input/src/CardView.js b/node_modules/react-native-credit-card-input/src/CardView.js
index 96510cd..5b2a2ee 100644
--- a/node_modules/react-native-credit-card-input/src/CardView.js
+++ b/node_modules/react-native-credit-card-input/src/CardView.js
@@ -121,7 +121,7 @@ export default class CardView extends Component {
     const containerSize = { ...BASE_SIZE, height: BASE_SIZE.height * scale };
     const transform = { transform: [
       { scale },
-      { translateY: ((BASE_SIZE.height * (scale - 1) / 2)) },
+      { translateY: (-BASE_SIZE.height / scale / 2) + (BASE_SIZE.height / 2) }
     ] };
 
     return (

This issue body was partially generated by patch-package.

Consider this case: I'm wrapping the cards with a view.
When scaling the cards, there is a weird top padding in the parent view.
Screen Shot 2022-03-23 at 3 02 20 PM

By fixing the translateY value I was able to fix it:
Screen Shot 2022-03-23 at 3 03 39 PM

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

1 participant