Common constants
Content
This is a set of constants which are useful throughout the development process, rather than creating them every time, they are being created once and stored and exported from commonConstants.ts
Platform dependant
Rather than always importing Device or Platform and checking whether it's iOS or Android or some versions,
it's easier to have this checks
isIosisIphoneXisIpadisTabletisAndroidisAndroidLollipopisAndroid11AndHigherhasNotchhasDynamicIsland
Dimensions dependant
Most of the time the apps are made for smartphones and orientation is almost always locked to portrait, so instead of checking dimensions all the time it's easier to use next constants:
windowWidthwindowHeight- on Android it also subtractsStatusBar.currentHeightfrom height
In cases when it comes to tablets where all the orientations are unlocked or in other cases where orientation is not locked, there are next two constants:
maxWindowDimensionminWindowDimension
They basically compare (max/min) windowHeight and windowWidth on start so that you could use them rather than always calling Dimensions.
Hit slops
Some basic predefined hit slops, you can change them for your needs:
hitSlophitSlopBig
Time dependant
minimalLegalAge- subtracts 16 years from current timemaximalAge- subtracts 100 years from current time
Other
hairlineWidth- contains the result ofStyleSheet.hairlineWidthpixelRatio- contains the result ofPixelRatio.get()perfectSize- pixel perfect size calculation across devices (e.g. perfectSize(10))