Skip to content

Fix transform origin #821

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

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Fix transform origin #821

merged 2 commits into from
Dec 10, 2024

Conversation

Freddy03h
Copy link
Member

The typescript type on transformOrigin is very weak

  transformOrigin?: Array<string | number> | string | undefined;

https://github.com/facebook/react-native/blob/4165884b700341ba549ed8385480fd98128e7bb1/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts#L296

Compare to the processTransformOrigin function that analyse the transformOrigin value on DEV mode
https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/StyleSheet/processTransformOrigin.js

@Freddy03h Freddy03h requested a review from cknitt December 9, 2024 11:38
@cknitt
Copy link
Member

cknitt commented Dec 9, 2024

Ok, I get the split in x and y 👍, but can't we keep | @as("left") Left instead of | @as("0%") Left?

@Freddy03h
Copy link
Member Author

Freddy03h commented Dec 9, 2024

No because I found that those keywords aren't handled in the array syntax :(
(that's why I split the change in 2 different commits)

I'll open an issue on the react-native repo, but, since the processTransformOrigin function transform those keywords to 0%, 50% and 100% for the string syntax. I think it's ok to be handled this way, instead of removing the keywords.

@Freddy03h Freddy03h merged commit fd631f4 into main Dec 10, 2024
2 checks passed
@Freddy03h Freddy03h deleted the fix-transform-origin branch December 10, 2024 08:38
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

Successfully merging this pull request may close these issues.

2 participants