How to use the react-native-size-matters.scale function in react-native-size-matters

To help you get started, we’ve selected a few react-native-size-matters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sovrin-foundation / connector-app / app / home / home.js View on Github external
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)
  }
}
github sovrin-foundation / connector-app / app / home / home.js View on Github external
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)
  }
}
github sovrin-foundation / connector-app / app / components / claim-proof-header / claim-proof-header.js View on Github external
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)
  }
}
github sovrin-foundation / connector-app / app / components / claim-proof-header / claim-proof-header.js View on Github external
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)
  }
}
github sovrin-foundation / connector-app / app / components / claim-proof-header / claim-proof-header.js View on Github external
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)
  }
}
github sovrin-foundation / connector-app / app / wallet / wallet.js View on Github external
* 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)
  }
}
github sovrin-foundation / connector-app / app / wallet / wallet.js View on Github external
/**
   * 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)
  }
}
github sovrin-foundation / connector-app / app / wallet / wallet-tab-send-details.js View on Github external
render() {
    const testID = 'wallet-tab-send-details'
    const fontSize = scale(FONT_SIZE_MAPPING(this.props.tokenAmount.length))

    return (
github sovrin-foundation / connector-app / app / wallet / wallet.js View on Github external
* 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)
  }
}
github sovrin-foundation / connector-app / app / wallet / wallet.js View on Github external
* 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)
  }
}

react-native-size-matters

A React-Native utility belt for scaling the size your apps UI across different sized devices

MIT
Latest version published 7 months ago

Package Health Score

69 / 100
Full package analysis