@domir/react-native-measure-text 0.1.1 → 0.1.2

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.
Files changed (130) hide show
  1. package/build/ReactNativeMeasureText.d.ts +6 -0
  2. package/build/ReactNativeMeasureText.d.ts.map +1 -0
  3. package/build/ReactNativeMeasureText.js.map +1 -0
  4. package/build/ReactNativeMeasureText.types.d.ts +4 -0
  5. package/build/ReactNativeMeasureText.types.d.ts.map +1 -0
  6. package/build/ReactNativeMeasureText.types.js +2 -0
  7. package/build/ReactNativeMeasureText.types.js.map +1 -0
  8. package/build/ReactNativeMeasureTextModule.d.ts +3 -0
  9. package/build/ReactNativeMeasureTextModule.d.ts.map +1 -0
  10. package/build/ReactNativeMeasureTextModule.js +5 -0
  11. package/build/ReactNativeMeasureTextModule.js.map +1 -0
  12. package/build/ReactNativeMeasureTextModule.web.d.ts +5 -0
  13. package/build/ReactNativeMeasureTextModule.web.d.ts.map +1 -0
  14. package/build/ReactNativeMeasureTextModule.web.js +6 -0
  15. package/build/ReactNativeMeasureTextModule.web.js.map +1 -0
  16. package/package.json +9 -1
  17. package/.eslintrc.js +0 -5
  18. package/example/.expo-shared/assets.json +0 -4
  19. package/example/App.tsx +0 -45
  20. package/example/android/app/BUCK +0 -55
  21. package/example/android/app/build.gradle +0 -376
  22. package/example/android/app/build_defs.bzl +0 -19
  23. package/example/android/app/debug.keystore +0 -0
  24. package/example/android/app/proguard-rules.pro +0 -14
  25. package/example/android/app/src/debug/AndroidManifest.xml +0 -7
  26. package/example/android/app/src/debug/java/expo/modules/measuretext/example/ReactNativeFlipper.java +0 -69
  27. package/example/android/app/src/main/AndroidManifest.xml +0 -34
  28. package/example/android/app/src/main/java/expo/modules/measuretext/example/MainActivity.java +0 -83
  29. package/example/android/app/src/main/java/expo/modules/measuretext/example/MainApplication.java +0 -106
  30. package/example/android/app/src/main/java/expo/modules/measuretext/example/newarchitecture/MainApplicationReactNativeHost.java +0 -117
  31. package/example/android/app/src/main/java/expo/modules/measuretext/example/newarchitecture/components/MainComponentsRegistry.java +0 -36
  32. package/example/android/app/src/main/java/expo/modules/measuretext/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +0 -48
  33. package/example/android/app/src/main/jni/Android.mk +0 -48
  34. package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +0 -24
  35. package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +0 -16
  36. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +0 -45
  37. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +0 -38
  38. package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +0 -61
  39. package/example/android/app/src/main/jni/MainComponentsRegistry.h +0 -32
  40. package/example/android/app/src/main/jni/OnLoad.cpp +0 -11
  41. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
  42. package/example/android/app/src/main/res/drawable/splashscreen.xml +0 -3
  43. package/example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png +0 -0
  44. package/example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png +0 -0
  45. package/example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png +0 -0
  46. package/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png +0 -0
  47. package/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png +0 -0
  48. package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  49. package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  50. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  51. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  52. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  53. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  54. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  55. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  56. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  57. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  58. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  59. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  60. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  61. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  62. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  63. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  64. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  65. package/example/android/app/src/main/res/values/colors.xml +0 -6
  66. package/example/android/app/src/main/res/values/strings.xml +0 -5
  67. package/example/android/app/src/main/res/values/styles.xml +0 -17
  68. package/example/android/app/src/main/res/values-night/colors.xml +0 -1
  69. package/example/android/build.gradle +0 -59
  70. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  71. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  72. package/example/android/gradle.properties +0 -53
  73. package/example/android/gradlew +0 -234
  74. package/example/android/gradlew.bat +0 -89
  75. package/example/android/settings.gradle +0 -17
  76. package/example/app.json +0 -35
  77. package/example/assets/adaptive-icon.png +0 -0
  78. package/example/assets/favicon.png +0 -0
  79. package/example/assets/icon.png +0 -0
  80. package/example/assets/splash.png +0 -0
  81. package/example/babel.config.js +0 -19
  82. package/example/index.js +0 -8
  83. package/example/ios/.xcode.env +0 -11
  84. package/example/ios/Podfile +0 -59
  85. package/example/ios/Podfile.lock +0 -482
  86. package/example/ios/Podfile.properties.json +0 -3
  87. package/example/ios/reactnativemeasuretextexample/AppDelegate.h +0 -9
  88. package/example/ios/reactnativemeasuretextexample/AppDelegate.mm +0 -166
  89. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@1x.png +0 -0
  90. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@2x.png +0 -0
  91. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@3x.png +0 -0
  92. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@1x.png +0 -0
  93. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@2x.png +0 -0
  94. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@3x.png +0 -0
  95. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@1x.png +0 -0
  96. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@2x.png +0 -0
  97. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@3x.png +0 -0
  98. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@2x.png +0 -0
  99. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@3x.png +0 -0
  100. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@1x.png +0 -0
  101. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@2x.png +0 -0
  102. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/App-Icon-83.5x83.5@2x.png +0 -0
  103. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -122
  104. package/example/ios/reactnativemeasuretextexample/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png +0 -0
  105. package/example/ios/reactnativemeasuretextexample/Images.xcassets/Contents.json +0 -6
  106. package/example/ios/reactnativemeasuretextexample/Images.xcassets/SplashScreen.imageset/Contents.json +0 -21
  107. package/example/ios/reactnativemeasuretextexample/Images.xcassets/SplashScreen.imageset/image.png +0 -0
  108. package/example/ios/reactnativemeasuretextexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
  109. package/example/ios/reactnativemeasuretextexample/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  110. package/example/ios/reactnativemeasuretextexample/Info.plist +0 -76
  111. package/example/ios/reactnativemeasuretextexample/SplashScreen.storyboard +0 -51
  112. package/example/ios/reactnativemeasuretextexample/Supporting/Expo.plist +0 -16
  113. package/example/ios/reactnativemeasuretextexample/main.m +0 -10
  114. package/example/ios/reactnativemeasuretextexample/noop-file.swift +0 -4
  115. package/example/ios/reactnativemeasuretextexample/reactnativemeasuretextexample.entitlements +0 -8
  116. package/example/ios/reactnativemeasuretextexample.xcodeproj/project.pbxproj +0 -497
  117. package/example/ios/reactnativemeasuretextexample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  118. package/example/ios/reactnativemeasuretextexample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  119. package/example/ios/reactnativemeasuretextexample.xcodeproj/project.xcworkspace/xcuserdata/brentvatne.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  120. package/example/ios/reactnativemeasuretextexample.xcodeproj/xcshareddata/xcschemes/reactnativemeasuretextexample.xcscheme +0 -88
  121. package/example/ios/reactnativemeasuretextexample.xcworkspace/contents.xcworkspacedata +0 -10
  122. package/example/ios/reactnativemeasuretextexample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  123. package/example/ios/reactnativemeasuretextexample.xcworkspace/xcuserdata/domiget.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  124. package/example/metro.config.js +0 -14
  125. package/example/package-lock.json +0 -21620
  126. package/example/package.json +0 -29
  127. package/example/tsconfig.json +0 -10
  128. package/example/webpack.config.js +0 -20
  129. package/package-lock.json +0 -33812
  130. package/tsconfig.json +0 -9
@@ -0,0 +1,6 @@
1
+ export declare function measureWidth(text: string, style?: {
2
+ fontSize?: number;
3
+ fontFamily?: string;
4
+ fontWeight?: string;
5
+ }): number;
6
+ //# 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,CAAA;CAAO,GAC1E,MAAM,CAER"}
@@ -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,QAAyE,EAAE;IAE3E,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 } = {}\n): number {\n return ReactNativeMeasureText.measureWidth(text, style);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare 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,oBAAY,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.1",
3
+ "version": "0.1.2",
4
4
  "description": "Measure text width synchronously using JSI",
5
5
  "main": "build/ReactNativeMeasureText.js",
6
6
  "types": "build/ReactNativeMeasureText.d.ts",
@@ -26,6 +26,14 @@
26
26
  "license": "MIT",
27
27
  "homepage": "https://github.com/DomiR/react-native-measure-text#readme",
28
28
  "dependencies": {},
29
+ "files": [
30
+ "build",
31
+ "src",
32
+ "ios",
33
+ "android/src",
34
+ "android/build.gradle",
35
+ "expo-module.config.json"
36
+ ],
29
37
  "devDependencies": {
30
38
  "expo-module-scripts": "^2.1.1",
31
39
  "expo-modules-core": "^0.11.4"
package/.eslintrc.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['universe/native', 'universe/web'],
4
- ignorePatterns: ['build'],
5
- };
@@ -1,4 +0,0 @@
1
- {
2
- "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
3
- "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
4
- }
package/example/App.tsx DELETED
@@ -1,45 +0,0 @@
1
- import { useState } from "react";
2
- import { Button, StyleSheet, Text, View } from "react-native";
3
- import * as ReactNativeMeasureText from "react-native-measure-text";
4
-
5
- export default function App() {
6
- const [widthResult, setWidthResult] = useState<number>(0);
7
- const toMeasure = "Hello world!";
8
- return (
9
- <View style={styles.container}>
10
- <Text>Result: {JSON.stringify(widthResult)}</Text>
11
- <View
12
- style={{ borderColor: "black", borderWidth: 1, width: widthResult + 1 }}
13
- >
14
- <Text style={{ fontSize: 20 }} numberOfLines={1} ellipsizeMode="clip">
15
- {toMeasure}
16
- </Text>
17
- </View>
18
- <Button
19
- onPress={() => {
20
- setWidthResult(
21
- Math.ceil(
22
- ReactNativeMeasureText.measureWidth({
23
- text: toMeasure,
24
- // fontSize: 20,
25
- // fontFamily: 'Helvetica',
26
- // fontWeight: 'normal',
27
- // maxHeight: 100,
28
- })
29
- )
30
- );
31
- }}
32
- title="Calc width"
33
- />
34
- </View>
35
- );
36
- }
37
-
38
- const styles = StyleSheet.create({
39
- container: {
40
- flex: 1,
41
- backgroundColor: "red",
42
- alignItems: "center",
43
- justifyContent: "center",
44
- },
45
- });
@@ -1,55 +0,0 @@
1
- # To learn about Buck see [Docs](https://buckbuild.com/).
2
- # To run your application with Buck:
3
- # - install Buck
4
- # - `npm start` - to start the packager
5
- # - `cd android`
6
- # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
- # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
- # - `buck install -r android/app` - compile, install and run application
9
- #
10
-
11
- load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
-
13
- lib_deps = []
14
-
15
- create_aar_targets(glob(["libs/*.aar"]))
16
-
17
- create_jar_targets(glob(["libs/*.jar"]))
18
-
19
- android_library(
20
- name = "all-libs",
21
- exported_deps = lib_deps,
22
- )
23
-
24
- android_library(
25
- name = "app-code",
26
- srcs = glob([
27
- "src/main/java/**/*.java",
28
- ]),
29
- deps = [
30
- ":all-libs",
31
- ":build_config",
32
- ":res",
33
- ],
34
- )
35
-
36
- android_build_config(
37
- name = "build_config",
38
- package = "expo.modules.measuretext.example",
39
- )
40
-
41
- android_resource(
42
- name = "res",
43
- package = "expo.modules.measuretext.example",
44
- res = "src/main/res",
45
- )
46
-
47
- android_binary(
48
- name = "app",
49
- keystore = "//android/keystores:debug",
50
- manifest = "src/main/AndroidManifest.xml",
51
- package_type = "debug",
52
- deps = [
53
- ":app-code",
54
- ],
55
- )
@@ -1,376 +0,0 @@
1
- apply plugin: "com.android.application"
2
-
3
- import com.android.build.OutputFile
4
- import org.apache.tools.ant.taskdefs.condition.Os
5
-
6
- /**
7
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
8
- * and bundleReleaseJsAndAssets).
9
- * These basically call `react-native bundle` with the correct arguments during the Android build
10
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
11
- * bundle directly from the development server. Below you can see all the possible configurations
12
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
13
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
14
- *
15
- * project.ext.react = [
16
- * // the name of the generated asset file containing your JS bundle
17
- * bundleAssetName: "index.android.bundle",
18
- *
19
- * // the entry file for bundle generation. If none specified and
20
- * // "index.android.js" exists, it will be used. Otherwise "index.js" is
21
- * // default. Can be overridden with ENTRY_FILE environment variable.
22
- * entryFile: "index.android.js",
23
- *
24
- * // https://reactnative.dev/docs/performance#enable-the-ram-format
25
- * bundleCommand: "ram-bundle",
26
- *
27
- * // whether to bundle JS and assets in debug mode
28
- * bundleInDebug: false,
29
- *
30
- * // whether to bundle JS and assets in release mode
31
- * bundleInRelease: true,
32
- *
33
- * // whether to bundle JS and assets in another build variant (if configured).
34
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
35
- * // The configuration property can be in the following formats
36
- * // 'bundleIn${productFlavor}${buildType}'
37
- * // 'bundleIn${buildType}'
38
- * // bundleInFreeDebug: true,
39
- * // bundleInPaidRelease: true,
40
- * // bundleInBeta: true,
41
- *
42
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
43
- * // for example: to disable dev mode in the staging build type (if configured)
44
- * devDisabledInStaging: true,
45
- * // The configuration property can be in the following formats
46
- * // 'devDisabledIn${productFlavor}${buildType}'
47
- * // 'devDisabledIn${buildType}'
48
- *
49
- * // the root of your project, i.e. where "package.json" lives
50
- * root: "../../",
51
- *
52
- * // where to put the JS bundle asset in debug mode
53
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
54
- *
55
- * // where to put the JS bundle asset in release mode
56
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
57
- *
58
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
59
- * // require('./image.png')), in debug mode
60
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
61
- *
62
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
63
- * // require('./image.png')), in release mode
64
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
65
- *
66
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
67
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
68
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
69
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
70
- * // for example, you might want to remove it from here.
71
- * inputExcludes: ["android/**", "ios/**"],
72
- *
73
- * // override which node gets called and with what additional arguments
74
- * nodeExecutableAndArgs: ["node"],
75
- *
76
- * // supply additional arguments to the packager
77
- * extraPackagerArgs: []
78
- * ]
79
- */
80
-
81
- def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
82
-
83
- def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath()
84
-
85
- project.ext.react = [
86
- entryFile: ["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android"].execute(null, rootDir).text.trim(),
87
- enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
88
- hermesCommand: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc",
89
- cliPath: "${reactNativeRoot}/cli.js",
90
- composeSourceMapsPath: "${reactNativeRoot}/scripts/compose-source-maps.js",
91
- ]
92
-
93
- apply from: new File(reactNativeRoot, "react.gradle")
94
-
95
- /**
96
- * Set this to true to create two separate APKs instead of one:
97
- * - An APK that only works on ARM devices
98
- * - An APK that only works on x86 devices
99
- * The advantage is the size of the APK is reduced by about 4MB.
100
- * Upload all the APKs to the Play Store and people will download
101
- * the correct one based on the CPU architecture of their device.
102
- */
103
- def enableSeparateBuildPerCPUArchitecture = false
104
-
105
- /**
106
- * Run Proguard to shrink the Java bytecode in release builds.
107
- */
108
- def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
109
-
110
- /**
111
- * The preferred build flavor of JavaScriptCore.
112
- *
113
- * For example, to use the international variant, you can use:
114
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
115
- *
116
- * The international variant includes ICU i18n library and necessary data
117
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
118
- * give correct results when using with locales other than en-US. Note that
119
- * this variant is about 6MiB larger per architecture than default.
120
- */
121
- def jscFlavor = 'org.webkit:android-jsc:+'
122
-
123
- /**
124
- * Whether to enable the Hermes VM.
125
- *
126
- * This should be set on project.ext.react and that value will be read here. If it is not set
127
- * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
128
- * and the benefits of using Hermes will therefore be sharply reduced.
129
- */
130
- def enableHermes = project.ext.react.get("enableHermes", false);
131
-
132
- /**
133
- * Architectures to build native code for.
134
- */
135
- def reactNativeArchitectures() {
136
- def value = project.getProperties().get("reactNativeArchitectures")
137
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
138
- }
139
-
140
- android {
141
- ndkVersion rootProject.ext.ndkVersion
142
-
143
- compileSdkVersion rootProject.ext.compileSdkVersion
144
-
145
- defaultConfig {
146
- applicationId 'expo.modules.measuretext.example'
147
- minSdkVersion rootProject.ext.minSdkVersion
148
- targetSdkVersion rootProject.ext.targetSdkVersion
149
- versionCode 1
150
- versionName "1.0.0"
151
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
152
-
153
- if (isNewArchitectureEnabled()) {
154
- // We configure the NDK build only if you decide to opt-in for the New Architecture.
155
- externalNativeBuild {
156
- ndkBuild {
157
- arguments "APP_PLATFORM=android-21",
158
- "APP_STL=c++_shared",
159
- "NDK_TOOLCHAIN_VERSION=clang",
160
- "GENERATED_SRC_DIR=$buildDir/generated/source",
161
- "PROJECT_BUILD_DIR=$buildDir",
162
- "REACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid",
163
- "REACT_ANDROID_BUILD_DIR=${reactNativeRoot}/ReactAndroid/build",
164
- "NODE_MODULES_DIR=$rootDir/../node_modules"
165
- cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
166
- cppFlags "-std=c++17"
167
- // Make sure this target name is the same you specify inside the
168
- // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
169
- targets "reactnativemeasuretextexample_appmodules"
170
-
171
- // Fix for windows limit on number of character in file paths and in command lines
172
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
173
- arguments "NDK_APP_SHORT_COMMANDS=true"
174
- }
175
- }
176
- }
177
- if (!enableSeparateBuildPerCPUArchitecture) {
178
- ndk {
179
- abiFilters (*reactNativeArchitectures())
180
- }
181
- }
182
- }
183
- }
184
-
185
- if (isNewArchitectureEnabled()) {
186
- // We configure the NDK build only if you decide to opt-in for the New Architecture.
187
- externalNativeBuild {
188
- ndkBuild {
189
- path "$projectDir/src/main/jni/Android.mk"
190
- }
191
- }
192
- def reactAndroidProjectDir = project(':ReactAndroid').projectDir
193
- def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
194
- dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
195
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
196
- into("$buildDir/react-ndk/exported")
197
- }
198
- def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
199
- dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
200
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
201
- into("$buildDir/react-ndk/exported")
202
- }
203
- afterEvaluate {
204
- // If you wish to add a custom TurboModule or component locally,
205
- // you should uncomment this line.
206
- // preBuild.dependsOn("generateCodegenArtifactsFromSchema")
207
- preDebugBuild.dependsOn(packageReactNdkDebugLibs)
208
- preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
209
-
210
- // Due to a bug inside AGP, we have to explicitly set a dependency
211
- // between configureNdkBuild* tasks and the preBuild tasks.
212
- // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
213
- configureNdkBuildRelease.dependsOn(preReleaseBuild)
214
- configureNdkBuildDebug.dependsOn(preDebugBuild)
215
- reactNativeArchitectures().each { architecture ->
216
- tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
217
- dependsOn("preDebugBuild")
218
- }
219
- tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
220
- dependsOn("preReleaseBuild")
221
- }
222
- }
223
- }
224
- }
225
-
226
- splits {
227
- abi {
228
- reset()
229
- enable enableSeparateBuildPerCPUArchitecture
230
- universalApk false // If true, also generate a universal APK
231
- include (*reactNativeArchitectures())
232
- }
233
- }
234
- signingConfigs {
235
- debug {
236
- storeFile file('debug.keystore')
237
- storePassword 'android'
238
- keyAlias 'androiddebugkey'
239
- keyPassword 'android'
240
- }
241
- }
242
- buildTypes {
243
- debug {
244
- signingConfig signingConfigs.debug
245
- }
246
- release {
247
- // Caution! In production, you need to generate your own keystore file.
248
- // see https://reactnative.dev/docs/signed-apk-android.
249
- signingConfig signingConfigs.debug
250
- minifyEnabled enableProguardInReleaseBuilds
251
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
252
- }
253
- }
254
-
255
- // applicationVariants are e.g. debug, release
256
- applicationVariants.all { variant ->
257
- variant.outputs.each { output ->
258
- // For each separate APK per architecture, set a unique version code as described here:
259
- // https://developer.android.com/studio/build/configure-apk-splits.html
260
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
261
- def abi = output.getFilter(OutputFile.ABI)
262
- if (abi != null) { // null for the universal-debug, universal-release variants
263
- output.versionCodeOverride =
264
- versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
265
- }
266
-
267
- }
268
- }
269
- }
270
-
271
- // Apply static values from `gradle.properties` to the `android.packagingOptions`
272
- // Accepts values in comma delimited lists, example:
273
- // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
274
- ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
275
- // Split option: 'foo,bar' -> ['foo', 'bar']
276
- def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
277
- // Trim all elements in place.
278
- for (i in 0..<options.size()) options[i] = options[i].trim();
279
- // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
280
- options -= ""
281
-
282
- if (options.length > 0) {
283
- println "android.packagingOptions.$prop += $options ($options.length)"
284
- // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
285
- options.each {
286
- android.packagingOptions[prop] += it
287
- }
288
- }
289
- }
290
-
291
- dependencies {
292
- implementation fileTree(dir: "libs", include: ["*.jar"])
293
-
294
- //noinspection GradleDynamicVersion
295
- implementation "com.facebook.react:react-native:+" // From node_modules
296
-
297
- def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
298
- def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
299
- def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
300
- def frescoVersion = rootProject.ext.frescoVersion
301
-
302
- // If your app supports Android versions before Ice Cream Sandwich (API level 14)
303
- if (isGifEnabled || isWebpEnabled) {
304
- implementation "com.facebook.fresco:fresco:${frescoVersion}"
305
- implementation "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}"
306
- }
307
-
308
- if (isGifEnabled) {
309
- // For animated gif support
310
- implementation "com.facebook.fresco:animated-gif:${frescoVersion}"
311
- }
312
-
313
- if (isWebpEnabled) {
314
- // For webp support
315
- implementation "com.facebook.fresco:webpsupport:${frescoVersion}"
316
- if (isWebpAnimatedEnabled) {
317
- // Animated webp support
318
- implementation "com.facebook.fresco:animated-webp:${frescoVersion}"
319
- }
320
- }
321
-
322
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
323
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
324
- exclude group:'com.facebook.fbjni'
325
- }
326
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
327
- exclude group:'com.facebook.flipper'
328
- exclude group:'com.squareup.okhttp3', module:'okhttp'
329
- }
330
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
331
- exclude group:'com.facebook.flipper'
332
- }
333
-
334
- if (enableHermes) {
335
- //noinspection GradleDynamicVersion
336
- implementation("com.facebook.react:hermes-engine:+") { // From node_modules
337
- exclude group:'com.facebook.fbjni'
338
- }
339
- } else {
340
- implementation jscFlavor
341
- }
342
- }
343
-
344
- if (isNewArchitectureEnabled()) {
345
- // If new architecture is enabled, we let you build RN from source
346
- // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
347
- // This will be applied to all the imported transtitive dependency.
348
- configurations.all {
349
- resolutionStrategy.dependencySubstitution {
350
- substitute(module("com.facebook.react:react-native"))
351
- .using(project(":ReactAndroid"))
352
- .because("On New Architecture we're building React Native from source")
353
- substitute(module("com.facebook.react:hermes-engine"))
354
- .using(project(":ReactAndroid:hermes-engine"))
355
- .because("On New Architecture we're building Hermes from source")
356
- }
357
- }
358
- }
359
-
360
- // Run this once to be able to run the application with BUCK
361
- // puts all compile dependencies into folder libs for BUCK to use
362
- task copyDownloadableDepsToLibs(type: Copy) {
363
- from configurations.implementation
364
- into 'libs'
365
- }
366
-
367
- apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
368
- applyNativeModulesAppBuildGradle(project)
369
-
370
- def isNewArchitectureEnabled() {
371
- // To opt-in for the New Architecture, you can either:
372
- // - Set `newArchEnabled` to true inside the `gradle.properties` file
373
- // - Invoke gradle with `-newArchEnabled=true`
374
- // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
375
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
376
- }
@@ -1,19 +0,0 @@
1
- """Helper definitions to glob .aar and .jar targets"""
2
-
3
- def create_aar_targets(aarfiles):
4
- for aarfile in aarfiles:
5
- name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
- lib_deps.append(":" + name)
7
- android_prebuilt_aar(
8
- name = name,
9
- aar = aarfile,
10
- )
11
-
12
- def create_jar_targets(jarfiles):
13
- for jarfile in jarfiles:
14
- name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
- lib_deps.append(":" + name)
16
- prebuilt_jar(
17
- name = name,
18
- binary_jar = jarfile,
19
- )
Binary file
@@ -1,14 +0,0 @@
1
- # Add project specific ProGuard rules here.
2
- # By default, the flags in this file are appended to flags specified
3
- # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
- # You can edit the include path and order by changing the proguardFiles
5
- # directive in build.gradle.
6
- #
7
- # For more details, see
8
- # http://developer.android.com/guide/developing/tools/proguard.html
9
-
10
- # react-native-reanimated
11
- -keep class com.swmansion.reanimated.** { *; }
12
- -keep class com.facebook.react.turbomodule.** { *; }
13
-
14
- # Add any project specific keep options here:
@@ -1,7 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools">
3
-
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
-
6
- <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7
- </manifest>