All Projects → hoaphantn7604 → react-native-utils-scale

hoaphantn7604 / react-native-utils-scale

Licence: MIT license
Provide solutions to make your app flexible for different screen sizes, different devices.

Programming Languages

java
68154 projects - #9 most used programming language
typescript
32286 projects
objective c
16641 projects - #2 most used programming language
javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to react-native-utils-scale

Cetus
Cetus is a high performance middleware that provides transparent routing between your application and any backend MySQL Servers.
Stars: ✭ 1,199 (+3055.26%)
Mutual labels:  scaling
Replicator
Automated Cluster and Job Scaling For HashiCorp Nomad
Stars: ✭ 166 (+336.84%)
Mutual labels:  scaling
gnome-control-center-x11-scaling
gnome-control-center build with Ubuntu patches for Xorg fractional scaling on Manjaro / Arch Linux
Stars: ✭ 19 (-50%)
Mutual labels:  scaling
React Native Size Matters
A lightweight, zero-dependencies, React-Native utility belt for scaling the size of your apps UI across different sized devices.
Stars: ✭ 1,706 (+4389.47%)
Mutual labels:  scaling
Custom Pod Autoscaler
Custom Pod Autoscaler base, allows creation of Custom Pod Autoscalers
Stars: ✭ 148 (+289.47%)
Mutual labels:  scaling
react-native-scaling-utils
Simple scaling utilities for React Native
Stars: ✭ 12 (-68.42%)
Mutual labels:  scaling
Aeternity
æternity: solving scalability problems by making sense of state-channels
Stars: ✭ 923 (+2328.95%)
Mutual labels:  scaling
x11-fractional-display-scaling
Script and instructions to get fractional display scaling working nicely on Linux distros that use X11
Stars: ✭ 52 (+36.84%)
Mutual labels:  scaling
Github Actions Runner Operator
K8S operator for scheduling github actions runner pods
Stars: ✭ 159 (+318.42%)
Mutual labels:  scaling
corebench
corebench - run your benchmarks against high performance computing servers with many CPU cores
Stars: ✭ 29 (-23.68%)
Mutual labels:  scaling
Superview
A small program that takes a 4:3 aspect ratio video file, and transforms it to a 16:9 video using the GoPro SuperView method
Stars: ✭ 137 (+260.53%)
Mutual labels:  scaling
Wsstat
Websocket stress testing made beautiful
Stars: ✭ 143 (+276.32%)
Mutual labels:  scaling
mutter-x11-scaling
Mutter build with Ubuntu patch for Xorg fractional scaling on Manjaro / Arch Linux
Stars: ✭ 77 (+102.63%)
Mutual labels:  scaling
Engineering Blog
📝 We write about our technologies and the problems we handle at scale.
Stars: ✭ 99 (+160.53%)
Mutual labels:  scaling
android-material-design-in-practice
A project to demonstrate the latest material design principles with simple examples. It has additional examples on how to easily scale texts on different screen sizes without extra effort.
Stars: ✭ 67 (+76.32%)
Mutual labels:  font-scaling
Redux Definitions
🥒 Define and share reusable slices of Redux.
Stars: ✭ 27 (-28.95%)
Mutual labels:  scaling
Elixir Node
Elixir full node implementation of the aeternity specification
Stars: ✭ 208 (+447.37%)
Mutual labels:  scaling
docs
PlanetScale documentation
Stars: ✭ 56 (+47.37%)
Mutual labels:  scaling
laniakea
Laniakea is a utility for managing instances at various cloud providers and aids in setting up a fuzzing cluster.
Stars: ✭ 28 (-26.32%)
Mutual labels:  scaling
plazar-js
Modular framework built with enterprise in mind - http://www.plazarjs.com
Stars: ✭ 25 (-34.21%)
Mutual labels:  scaling

react-native-utils-scale

Provide solutions to make your app flexible for different screen sizes, different devices. When developing with react-native, you need to manually adjust your app to look great on a variety of different screen sizes. This package provides some simple tooling to make your scaling a whole lot easier.

Getting started

  yarn add react-native-utils-scale

or

  npm i react-native-utils-scale

RN Version < 0.60

    react-native link react-native-utils-scale

Run IOS

    cd ios && pod install
    react-native run-ios

Run Android

    react-native run-android

Jest setup

    jest.mock('react-native-utils-scale', () => {
        const UtilsScale = require('react-native-utils-scale/mock');
        return UtilsScale;
    });

Documents

API Type Description
scale Function Will return a linear scaled result of the provided size
fontScale Function Will return a linear scaled result of the font size provided
deviceInch Number Inch of device
hasNotch Boolean Tells if the device has a notch
isAndroid Boolean Tells if the device is Android operating system
isIOS Boolean Tells if the device is IOS operating system
isSmallDevice Boolean Tells the device has a screen size smaller than 4.8 inches
isTablet Boolean Tells if the device is a tablet
width Number Screen width
height Number Screen height

Source code demo

react-native-template-components A beautiful template for React Native.

Demo

Usage

import React from 'react';
import {SafeAreaView, ScrollView, StyleSheet, Text, View} from 'react-native';
import {
  fontScale,
  scale,
  deviceInch,
  hasNotch,
  isAndroid,
  isIOS,
  isSmallDevice,
  isTablet,
  width,
  height,
} from 'react-native-utils-scale';

const App = () => {
  return (
    <ScrollView>
      <SafeAreaView style={styles.container}>
        <Text style={styles.fontScale}>Device width: {width}</Text>
        <Text style={styles.fontScale}>Device height: {height}</Text>
        <Text style={styles.fontScale}>Device inch: {deviceInch}</Text>
        <Text style={styles.fontScale}>
          isAndroid: {isAndroid.toString()}
        </Text>
        <Text style={styles.fontScale}>isIOS: {isIOS.toString()}</Text>
        <Text style={styles.fontScale}>isTablet: {isTablet.toString()}</Text>
        <Text style={styles.fontScale}>hasNotch: {hasNotch.toString()}</Text>
        <Text style={styles.fontScale}>
          isSmallDevice: {isSmallDevice.toString()}
        </Text>

        <View style={[styles.box, styles.scale]}>
          <Text style={[styles.color, {fontSize: fontScale(14)}]}>150x150</Text>
          <Text style={[styles.color, {fontSize: fontScale(14)}]}>
            Scale: {scale(150)}x{scale(150)}
          </Text>
        </View>
      </SafeAreaView>
    </ScrollView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  fontScale: {
    fontSize: fontScale(16),
  },
  box: {
    width: 150,
    height: 150,
    backgroundColor: 'black',
    alignItems: 'center',
    justifyContent: 'center',
    margin: 16,
  },
  scale: {
    width: scale(150),
    height: scale(150),
  },
  color: {
    color: 'white',
  },
});

export default App;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].