Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tokenAmountSize = (tokenAmountLength: number): number => {
// this resizing logic is different than wallet tabs header
switch (true) {
case tokenAmountLength < 16:
return scale(26)
case tokenAmountLength < 20:
return scale(20)
default:
return scale(19)
}
}
const tokenAmountSize = (tokenAmountLength: number): number => {
// this resizing logic is different than wallet tabs header
switch (true) {
case tokenAmountLength < 16:
return scale(26)
case tokenAmountLength < 20:
return scale(20)
default:
return scale(19)
}
}
const tokenAmountSize = (tokenAmountLength: number): number => {
// this resizing logic is different than wallet tabs header
switch (true) {
case tokenAmountLength < 13:
return scale(40)
case tokenAmountLength < 16:
return scale(35)
case tokenAmountLength < 20:
return scale(28)
default:
return scale(20)
}
}
const tokenAmountSize = (tokenAmountLength: number): number => {
// this resizing logic is different than wallet tabs header
switch (true) {
case tokenAmountLength < 13:
return scale(40)
case tokenAmountLength < 16:
return scale(35)
case tokenAmountLength < 20:
return scale(28)
default:
return scale(20)
}
}
const tokenAmountSize = (tokenAmountLength: number): number => {
// this resizing logic is different than wallet tabs header
switch (true) {
case tokenAmountLength < 13:
return scale(40)
case tokenAmountLength < 16:
return scale(35)
case tokenAmountLength < 20:
return scale(28)
default:
return scale(20)
}
}
* because there are other elements besides this which are taking up space
* also, other elements width are not defined, so we can't calculate width as well
* Even if we would have used adjustsFontSizeToFit, we can't control the scale
* with which font size is reduced on Android, a scale factor is provided for ios
* So, for now as a hack we are providing font by ourselves.
* Normally, we would have preferred to just wrap the text, but we can't wrap it
* because it is a number. Also, header is hard coded with a height
*/
const digits = balance ? balance.length : 0
switch (true) {
case digits < 13:
return scale(30)
case digits < 16:
return scale(25)
case digits < 20:
return scale(19)
default:
return scale(16)
}
}
/**
* TODO:KS below logic to select size as per length is an ugly logic
* adjustsFontSizeToFit is not working due to center alignment and no width
* on parent container, we can't set width as well from Dimensions module
* because there are other elements besides this which are taking up space
* also, other elements width are not defined, so we can't calculate width as well
* Even if we would have used adjustsFontSizeToFit, we can't control the scale
* with which font size is reduced on Android, a scale factor is provided for ios
* So, for now as a hack we are providing font by ourselves.
* Normally, we would have preferred to just wrap the text, but we can't wrap it
* because it is a number. Also, header is hard coded with a height
*/
const digits = balance ? balance.length : 0
switch (true) {
case digits < 13:
return scale(30)
case digits < 16:
return scale(25)
case digits < 20:
return scale(19)
default:
return scale(16)
}
}
render() {
const testID = 'wallet-tab-send-details'
const fontSize = scale(FONT_SIZE_MAPPING(this.props.tokenAmount.length))
return (
* adjustsFontSizeToFit is not working due to center alignment and no width
* on parent container, we can't set width as well from Dimensions module
* because there are other elements besides this which are taking up space
* also, other elements width are not defined, so we can't calculate width as well
* Even if we would have used adjustsFontSizeToFit, we can't control the scale
* with which font size is reduced on Android, a scale factor is provided for ios
* So, for now as a hack we are providing font by ourselves.
* Normally, we would have preferred to just wrap the text, but we can't wrap it
* because it is a number. Also, header is hard coded with a height
*/
const digits = balance ? balance.length : 0
switch (true) {
case digits < 13:
return scale(30)
case digits < 16:
return scale(25)
case digits < 20:
return scale(19)
default:
return scale(16)
}
}
* Even if we would have used adjustsFontSizeToFit, we can't control the scale
* with which font size is reduced on Android, a scale factor is provided for ios
* So, for now as a hack we are providing font by ourselves.
* Normally, we would have preferred to just wrap the text, but we can't wrap it
* because it is a number. Also, header is hard coded with a height
*/
const digits = balance ? balance.length : 0
switch (true) {
case digits < 13:
return scale(30)
case digits < 16:
return scale(25)
case digits < 20:
return scale(19)
default:
return scale(16)
}
}