1.0.1 • Published 3 years ago

react-native-calculated-scale v1.0.1

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

react-native-calculated-scale

This lib has the premise of calculating the size scale for fonts, widths, heights, margins and paddings.

NameDescriptionParameters
fontthis function scaled font-sizevalue, return type
verticalthis function scaled values vertical bottom and topvalue, return type
horizontalthis function scaled values horizontal left and rightvalue, return type

Parameters

NameTypeDescription
Value parameterString or NumberThis parameters define value is scaled
Return typeboolThis parameters define type return, if true return number, if false return string px

Using with Styled Components

import styled from 'styled-components/native'
import scaled from 'react-native-calculated-scale'

export const Container = styled.View`
    font-size: ${scaled.font(`15px`)};
    padding-top: ${scaled.vertical(`10px`)};
    margin-left: ${scaled.horizontal(`10px`)};
    margin-right: ${scaled.horizontal(`10px`)};
`

Using with JS

import scaled from 'react-native-calculated-scale'

function App(){

    return(
        <View style={{
            fontSize: scaled.font(15, true),
            paddingTop: scaled.vertical(10, true),
            marginLeft: scaled.horizontal(10, true),
            marginRight: scaled.horizontal(10, true),
        }}>
            <Text>Using</Text>
        </View>
    )
}