Last active
March 1, 2024 06:15
-
-
Save gleydson/0e778e834655d1ee177725d8b4b345d7 to your computer and use it in GitHub Desktop.
Revisions
-
gleydson revised this gist
Mar 8, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ import { Dimensions } from 'react-native'; const widthPercentageToDP = widthPercent => { const screenWidth = Dimensions.get('window').width; const elemWidth = parseFloat(widthPercent); -
gleydson revised this gist
Oct 29, 2019 . No changes.There are no files selected for viewing
-
gleydson renamed this gist
Oct 29, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
gleydson created this gist
Oct 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ const widthPercentageToDP = widthPercent => { const screenWidth = Dimensions.get('window').width; const elemWidth = parseFloat(widthPercent); return PixelRatio.roundToNearestPixel((screenWidth * elemWidth) / 100); }; const heightPercentageToDP = heightPercent => { const screenHeight = Dimensions.get('window').height; const elemHeight = parseFloat(heightPercent); return PixelRatio.roundToNearestPixel((screenHeight * elemHeight) / 100); };