mirror of
https://github.com/zoriya/yoshiki.git
synced 2025-12-06 07:06:13 +00:00
Use native em and rem on web
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yoshiki",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"author": "Zoe Roux <zoe.roux@sdg.moe> (https://github.com/AnonymusRaccoon)",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for details.
|
||||
//
|
||||
|
||||
import { PixelRatio } from "react-native";
|
||||
import { PixelRatio, Platform } from "react-native";
|
||||
|
||||
export const px = (value: number) => value;
|
||||
export const percent = (value: number) => `${value}%`;
|
||||
export const em = (value: number) => PixelRatio.getFontScale() * 16 * value;
|
||||
export const rem = em;
|
||||
export const em = (value: number) =>
|
||||
Platform.OS === "web" ? `${value}em` : PixelRatio.getFontScale() * 16 * value;
|
||||
export const rem = Platform.OS === "web" ? (value: number) => `${value}rem` : em;
|
||||
|
||||
Reference in New Issue
Block a user