5 changed files with 134 additions and 112 deletions
@ -1,49 +1,55 @@ |
|||||
import {PixelRatio} from 'react-native'; |
import {PixelRatio} from 'react-native'; |
||||
|
|
||||
const scalar = PixelRatio.getFontScale(); |
class AppFonts { |
||||
|
constructor() { |
||||
|
this.scalar = PixelRatio.getFontScale(); |
||||
|
|
||||
function normalizeFont(size) { |
this.headerTitle = { |
||||
return size * scalar |
|
||||
}; |
|
||||
|
|
||||
export const fonts = { |
|
||||
headerTitle: { |
|
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(30), |
size: this.normalizeFont(30), |
||||
}, |
} |
||||
|
|
||||
sectionHeader: { |
this.sectionHeader = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(26), |
size: this.normalizeFont(26), |
||||
}, |
} |
||||
|
|
||||
large: { |
this.large = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(22), |
size: this.normalizeFont(22), |
||||
}, |
} |
||||
|
|
||||
medium: { |
this.medium = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(20), |
size: this.normalizeFont(20), |
||||
}, |
} |
||||
|
|
||||
small: { |
this.small = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(16), |
size: this.normalizeFont(16), |
||||
}, |
} |
||||
|
|
||||
tiny: { |
this.tiny = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(14), |
size: this.normalizeFont(14), |
||||
}, |
} |
||||
|
|
||||
mini: { |
this.mini = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(10), |
size: this.normalizeFont(10), |
||||
}, |
} |
||||
|
|
||||
subFont: { |
this.subFont = { |
||||
fam: 'arial', |
fam: 'arial', |
||||
size: normalizeFont(8), |
size: this.normalizeFont(8), |
||||
}, |
} |
||||
|
} |
||||
|
|
||||
|
normalizeFont(size) { |
||||
|
let newSize = size * this.scalar; |
||||
|
return newSize; |
||||
|
}; |
||||
} |
} |
||||
|
|
||||
|
const Fonts = new AppFonts(); |
||||
|
export default Fonts; |
@ -1,5 +1,10 @@ |
|||||
export const squareIcons = { |
class AppIcons { |
||||
|
squareIcons = { |
||||
settings: 'cog-outline', |
settings: 'cog-outline', |
||||
toggleOn: 'toggle-switch-on', |
toggleOn: 'toggle-switch-on', |
||||
toggleOfff: 'toggle-switch-off' |
toggleOfff: 'toggle-switch-off' |
||||
}; |
}; |
||||
|
} |
||||
|
|
||||
|
const Icons = new AppIcons(); |
||||
|
export default Icons; |
@ -1,25 +1,35 @@ |
|||||
import { PixelRatio, Dimensions } from "react-native"; |
import { PixelRatio, Dimensions } from "react-native"; |
||||
|
|
||||
let scalar = PixelRatio.get(); |
class AppMetrics { |
||||
|
constructor(dimensions = Dimensions.get('window')) { |
||||
|
this.scalar = PixelRatio.get(); |
||||
|
|
||||
function normalize(size){ |
let height = dimensions.height; |
||||
return (size * scalar); |
let width = dimensions.width; |
||||
} |
|
||||
|
|
||||
let dimensions = Dimensions.get('window'); |
|
||||
|
|
||||
let height = dimensions.height; |
if (width > height) { |
||||
let width = dimensions.width; |
this.screenHeight = width; |
||||
|
this.screenWidth = height; |
||||
|
} else { |
||||
|
this.screenWidth = width; |
||||
|
this.screenHeight = height; |
||||
|
} |
||||
|
} |
||||
|
|
||||
let screenWidth = width; |
normalize(size){ |
||||
let screenHeight = height; |
return (size * this.scalar); |
||||
|
} |
||||
|
|
||||
if (width > height) { |
screenSections = { |
||||
screenHeight = width; |
headerHeight: this.normalize(20), |
||||
screenWidth = height; |
sectionWidth: this.screenWidth |
||||
|
} |
||||
} |
} |
||||
|
|
||||
export const screenSections = { |
const Metrics = new AppMetrics(); |
||||
headerHeight: normalize(20), |
export default Metrics; |
||||
sectionWidth: screenWidth |
|
||||
|
export function buildTestMetrics(dimensions){ |
||||
|
const Metrics = new AppMetrics(dimensions); |
||||
|
return Metrics; |
||||
} |
} |
Loading…
Reference in new issue