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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Dimension Handling and Optimize Type Definitions #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

da-war
Copy link

@da-war da-war commented Oct 14, 2024

This pull request refactors the dimension handling functions in the react-native-responsive-screen library to improve performance, readability, and type safety.

Overview: Optimized the widthPercentageToDP and heightPercentageToDP functions for better efficiency.
Consolidated the handling of orientation changes to prevent memory leaks.

Changes Made: Destructured screen dimensions for clarity.

Simplified the logic for parsing percentage inputs in the dimension calculation functions.
Enhanced TypeScript definitions for the listenOrientationChange function, specifying a more accurate type for the screenClassComponent parameter.

Reasoning: These changes aim to enhance code maintainability and usability for developers using the library. Improved type definitions help reduce potential type-related issues.

Testing:Verified that the dimension calculations work correctly in a sample React Native application across different screen sizes.
Additional Notes: Please review the changes and let me know if there are any concerns or suggestions for further improvements. I'm open to making adjustments as needed.

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.

1 participant