@domir/react-native-measure-text 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,44 @@
1
1
  apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
2
+
3
+ // Expo's Gradle helpers. This has to run after `com.android.library` and outside the
4
+ // `buildscript {}` block (which Gradle evaluates before line 1): since Expo SDK 50 the
5
+ // helper tries to apply `kotlin-android` itself, and applying the Kotlin plugin before
6
+ // AGP breaks AGP 9's built-in Kotlin support.
7
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
8
+ if (expoModulesCorePlugin.exists()) {
9
+ apply from: expoModulesCorePlugin
10
+ applyKotlinExpoModulesCorePlugin()
11
+ }
12
+
13
+ // AGP 9 ships built-in Kotlin support and registers the `kotlin` extension
14
+ // itself. Applying the Kotlin plugin on top of it fails configuration with
15
+ // "Cannot add extension with name 'kotlin'". Only apply it when nothing has
16
+ // registered that extension yet.
17
+ if (project.extensions.findByName('kotlin') == null) {
18
+ apply plugin: 'kotlin-android'
19
+ }
20
+
3
21
  apply plugin: 'maven-publish'
4
22
 
5
23
  group = 'expo.modules.measuretext'
6
24
  version = '0.1.0'
7
25
 
8
26
  buildscript {
9
- def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
- if (expoModulesCorePlugin.exists()) {
11
- apply from: expoModulesCorePlugin
12
- applyKotlinExpoModulesCorePlugin()
13
- }
14
-
15
27
  // Simple helper that allows the root project to override versions declared by this library.
16
28
  ext.safeExtGet = { prop, fallback ->
17
29
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18
30
  }
19
31
 
20
- // Ensures backward compatibility
32
+ // Kotlin version. Expo's helper (applied above, but only after this block has already
33
+ // run) defines `ext.kotlinVersion` as a closure; a `kotlinVersion` Gradle property
34
+ // (-P or gradle.properties) shows up here as a plain string. Accept both and fall
35
+ // back to the root project's `ext.kotlinVersion`.
21
36
  ext.getKotlinVersion = {
22
- if (ext.has("kotlinVersion")) {
23
- ext.kotlinVersion()
24
- } else {
25
- ext.safeExtGet("kotlinVersion", "1.6.10")
37
+ def kotlinVersion = ext.has("kotlinVersion") ? ext.get("kotlinVersion") : null
38
+ if (kotlinVersion instanceof Closure) {
39
+ kotlinVersion = kotlinVersion()
26
40
  }
41
+ kotlinVersion ?: ext.safeExtGet("kotlinVersion", "1.6.10")
27
42
  }
28
43
 
29
44
  repositories {
@@ -0,0 +1,8 @@
1
+ export declare function measureWidth(text: string, style?: {
2
+ fontSize?: number;
3
+ fontFamily?: string;
4
+ fontWeight?: string;
5
+ letterSpacing?: number;
6
+ allowFontScaling?: boolean;
7
+ }): number;
8
+ //# sourceMappingURL=ReactNativeMeasureText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureText.d.ts","sourceRoot":"","sources":["../src/ReactNativeMeasureText.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9H,MAAM,CAER"}
@@ -0,0 +1,5 @@
1
+ import ReactNativeMeasureText from "./ReactNativeMeasureTextModule";
2
+ export function measureWidth(text, style = {}) {
3
+ return ReactNativeMeasureText.measureWidth(text, style);
4
+ }
5
+ //# sourceMappingURL=ReactNativeMeasureText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureText.js","sourceRoot":"","sources":["../src/ReactNativeMeasureText.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AAEpE,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,QAA6H,EAAE;IAE/H,OAAO,sBAAsB,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import ReactNativeMeasureText from \"./ReactNativeMeasureTextModule\";\n\nexport function measureWidth(\n text: string,\n style: { fontSize?: number; fontFamily?: string; fontWeight?: string, letterSpacing?: number, allowFontScaling?: boolean } = {}\n): number {\n return ReactNativeMeasureText.measureWidth(text, style);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export type ChangeEventPayload = {
2
+ value: string;
3
+ };
4
+ //# sourceMappingURL=ReactNativeMeasureText.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureText.types.d.ts","sourceRoot":"","sources":["../src/ReactNativeMeasureText.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ReactNativeMeasureText.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureText.types.js","sourceRoot":"","sources":["../src/ReactNativeMeasureText.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ChangeEventPayload = {\n value: string;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=ReactNativeMeasureTextModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureTextModule.d.ts","sourceRoot":"","sources":["../src/ReactNativeMeasureTextModule.ts"],"names":[],"mappings":";AAIA,wBAA6D"}
@@ -0,0 +1,5 @@
1
+ import { requireNativeModule } from "expo-modules-core";
2
+ // It loads the native module object from the JSI or falls back to
3
+ // the bridge module (from NativeModulesProxy) if the remote debugger is on.
4
+ export default requireNativeModule("ReactNativeMeasureText");
5
+ //# sourceMappingURL=ReactNativeMeasureTextModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureTextModule.js","sourceRoot":"","sources":["../src/ReactNativeMeasureTextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,kEAAkE;AAClE,4EAA4E;AAC5E,eAAe,mBAAmB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from \"expo-modules-core\";\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nexport default requireNativeModule(\"ReactNativeMeasureText\");\n"]}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ measureWidth(): number;
3
+ };
4
+ export default _default;
5
+ //# sourceMappingURL=ReactNativeMeasureTextModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureTextModule.web.d.ts","sourceRoot":"","sources":["../src/ReactNativeMeasureTextModule.web.ts"],"names":[],"mappings":";;;AAAA,wBAIE"}
@@ -0,0 +1,6 @@
1
+ export default {
2
+ measureWidth() {
3
+ return 0;
4
+ },
5
+ };
6
+ //# sourceMappingURL=ReactNativeMeasureTextModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeMeasureTextModule.web.js","sourceRoot":"","sources":["../src/ReactNativeMeasureTextModule.web.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,YAAY;QACV,OAAO,CAAC,CAAC;IACX,CAAC;CACF,CAAC","sourcesContent":["export default {\n measureWidth() {\n return 0;\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domir/react-native-measure-text",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Measure text width synchronously using JSI",
5
5
  "main": "build/ReactNativeMeasureText.js",
6
6
  "types": "build/ReactNativeMeasureText.d.ts",
@@ -47,4 +47,4 @@
47
47
  "react": "*",
48
48
  "react-native": "*"
49
49
  }
50
- }
50
+ }