You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When developing with react-native, you need to manually adjust your app to look great on a variety of different screen sizes. That's a tedious job.
22
-
react-native-size-matters provides some simple tooling to make your scaling a whole lot easier.
23
-
The idea is to develop once on a standard ~5" screen mobile device and then simply apply the provided utils.
21
+
When developing with react-native, you need to manually adjust your app to look great on a variety of different screen sizes. That's a tedious job.
22
+
react-native-size-matters provides some simple tooling to make your scaling a whole lot easier.
23
+
The idea is to develop once on a standard ~5" screen mobile device and then simply apply the provided utils.
24
24
📖 You can read more about what led to this library on my blog post, which can be found in [this repo](./examples/BlogPost) or at [Medium](https://medium.com/soluto-engineering/size-matters-5aeeb462900a).
25
25
26
26
## Api
@@ -37,19 +37,19 @@ const Component = props =>
37
37
```
38
38
39
39
40
-
*`scale(size: number)`
40
+
*`scale(size: number)`
41
41
Will return a linear scaled result of the provided size, based on your device's screen width.
42
-
*`verticalScale(size: number)`
42
+
*`verticalScale(size: number)`
43
43
Will return a linear scaled result of the provided size, based on your device's screen height.
44
44
45
-
*`moderateScale(size: number, factor?: number)`
46
-
Sometimes you don't want to scale everything in a linear manner, that's where moderateScale comes in.
47
-
The cool thing about it is that you can control the resize factor (default is 0.5).
48
-
If normal scale will increase your size by +2X, moderateScale will only increase it by +X, for example:
Same as moderateScale, but using verticalScale instead of scale.
54
54
55
55
All scale functions can be imported using their shorthand alias as well:
@@ -65,15 +65,15 @@ import { ScaledSheet } from 'react-native-size-matters';
65
65
conststyles=ScaledSheet.create(stylesObject)
66
66
```
67
67
68
-
ScaleSheet will take the same stylesObject a regular StyleSheet will take, plus a special (optional) annotation that will automatically apply the scale functions for you:
68
+
ScaledSheet will take the same stylesObject a regular StyleSheet will take, plus a special (optional) annotation that will automatically apply the scale functions for you:
69
69
*`<size>@s` - will apply `scale` function on `size`.
70
70
*`<size>@vs` - will apply `verticalScale` function on `size`.
71
71
*`<size>@ms` - will apply `moderateScale` function with resize factor of 0.5 on `size`.
72
72
*`<size>@mvs` - will apply `moderateVerticalScale` function with resize factor of 0.5 on `size`.
73
73
*`<size>@ms<factor>` - will apply `moderateScale` function with resize factor of `factor` on size.
74
74
*`<size>@mvs<factor>` - will apply `moderateVerticalScale` function with resize factor of `factor` on size.
75
75
76
-
ScaledSheet also supports rounding the result, simply add `r` at the end of the annotation.
76
+
ScaledSheet also supports rounding the result, simply add `r` at the end of the annotation.
0 commit comments