“Responsivo Tamanho da fonte React nativo” Respostas de código

Reaja a fonte de escala nativa

<Text
    numberOfLines={1}// add this
    adjustsFontSizeToFit// add this
    style={{textAlign:'center',fontSize:30}}
  >
Alexandre Dao

Reaja a fonte responsiva nativa

import { Dimensions } from 'react-native';

const { width, **fontScale** } = Dimensions.get("window");

const styles = StyleSheet.create({
    fontSize: idleFontSize / **fontScale**,
});
Crazy Capybara

Alterar o tamanho do texto de acordo com a tela reagir nativo

import { Dimensions, Platform, PixelRatio } from 'react-native';

const {
       width: SCREEN_WIDTH,
       height: SCREEN_HEIGHT,
     } = Dimensions.get('window');

     // based on iphone 5s's scale
     const scale = SCREEN_WIDTH / 320   ;

  export function actuatedNormalize(size) {
  const newSize = size * scale 
   if (Platform.OS === 'ios') {
    return Math.round(PixelRatio.roundToNearestPixel(newSize))
   } else {
     return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
   }
  }
Xenophobic Xenomorph

Responsivo Tamanho da fonte React nativo

import { Dimensions, Platform, PixelRatio } from 'react-native';

const {
  width,
  height,
} = Dimensions.get('window');

export function normalize(size, multiplier = 2) {
  const scale = (width / height) * multiplier;

  const newSize = size * scale;

  return Math.round(PixelRatio.roundToNearestPixel(newSize));
}
Helpful Hamster

Respostas semelhantes a “Responsivo Tamanho da fonte React nativo”

Perguntas semelhantes a “Responsivo Tamanho da fonte React nativo”

Mais respostas relacionadas para “Responsivo Tamanho da fonte React nativo” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código