Answers for "fontsize in react native"

6

react-native italics

<Text style={styles.bold}>I'm bold!</Text>
<Text style={styles.italic}>I'm italic!</Text>
<Text style={styles.underline}>I'm underlined!</Text>

const styles = StyleSheet.create({
    bold: {fontWeight: 'bold'},
    italic: {fontStyle: 'italic'},
    underline: {textDecorationLine: 'underline'}
})
Posted by: Guest on May-15-2020
0

react native scaling font

<Text
    numberOfLines={1}// add this
    adjustsFontSizeToFit// add this
    style={{textAlign:'center',fontSize:30}}
  >
Posted by: Guest on May-06-2021
2

change text size according to screen react native

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
   }
  }
Posted by: Guest on August-04-2020
-1

react native font based on viewport dimensions

<View>
  <Text
    numberOfLines={1}
    adjustsFontSizeToFit
    style={{textAlign:'center',fontSize:30}}
  >
    {this.props.email}
  </Text>
</View>
Posted by: Guest on April-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language