Skip to content

Commit d60129d

Browse files
committed
Support for includeFontPadding
1 parent a929340 commit d60129d

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
### v1.0.0-alpha.8
4+
- Suppport for `includeFontPadding`
5+
- Using gradle 2.2.3
6+
37
### v1.0.0-alpha.7
48
- Uses scaled fontSize (Android, automatic).
59

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.1'
8+
classpath 'com.android.tools.build:gradle:2.2.3'
99
}
1010
}
1111

android/src/main/java/io/github/amarcruz/RNMeasureTextModule.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ public void measure(ReadableMap options, Promise promise) {
7979
textPaint.setTypeface(Typeface.defaultFromStyle(style));
8080
}
8181

82+
boolean includeFontPadding = true;
83+
if (options.hasKey("includeFontPadding")) {
84+
includeFontPadding = options.getBoolean("includeFontPadding");
85+
}
86+
8287
// technically, width should never be negative, but there is currently a bug in
8388
final boolean unconstrainedWidth = width <= 0;
84-
final boolean includeFontPadding = true;
8589
final float spacingMultiplier = 1;
8690
final float spacingAddition = 0;
8791
final int textBreakStrategy =

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ declare module "react-native-text-size" {
55
fontSize: number;
66
fontFamily?: string;
77
width?: number;
8+
includeFontPadding?: boolean;
89
}
910

1011
export type TextSizeResult = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-text-size",
3-
"version": "1.0.0-alpha.7",
3+
"version": "1.0.0-alpha.8",
44
"description": "Measure text height and width without laying it out.",
55
"main": "index.js",
66
"types": "./index.d.ts",

0 commit comments

Comments
 (0)