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
}
}<View>
<Text
numberOfLines={1}
adjustsFontSizeToFit
style={{textAlign:'center',fontSize:30}}
>
{this.props.email}
</Text>
</View>
Also in JavaScript:
- javascript write to text file stack overflow
- Setting axios base url dynamically
- install node js on raspberry pi
- price range slider bootstrap 4
- node to viewport godot
- math ceil floor
- device height react native
- javascript print numbers in the given range
- react native function
- disabling submit button until all fields have values
- Math.random javascript double
- cannot find name json angular 7
- js string
- open popup in angular
- jstree select all node
- elements under p5 canvas
- toggle class to an element javascript
- react yup password with number string and uppercase
- scrollview refresh
- get site url javascript
- owl carousel json not working
- vue js error mixed spaces and tabs no-mixed-spaces-and-tabs
- javascript get file extension from string
- check if string contains character javascript