aMarCruz / react-native-text-size

Measure text accurately before laying it out and get font information from your App.
BSD 2-Clause "Simplified" License
405 stars 95 forks source link

Build error on react-native 0.69.5 #40

Open yepMad opened 2 years ago

yepMad commented 2 years ago

When "./gradlew assembleRelease" I get this error:

> Task :react-native-text-size:compileReleaseJavaWithJavac
Note: C:\Users\MyUser\Documents\Git\my-app\node_modules\react-native-text-size\android\src\main\java\com\github\amarcruz\rntextsize\RNTextSizeModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
yepMad commented 2 years ago

After doing the manual installation the error was solved. This leads me to believe that autolinking is not working.

yepMad commented 2 years ago

But... When trying to open the app build:

image

When skip step 1 of manual, just doing 2 and 3 everything is fine. So just don't follow Android step one and everything should be fine.

natioskar commented 1 year ago

Hey @yepMad did the library ended up working for you? the steps for the manual linking are not working for me unfortunately

yepMad commented 1 year ago

When skip step 1 of manual, just doing 2 and 3 everything is fine.

It worked on Android, but I chose not to use it, it has major linking problems on iOS. As for it working on Android, I recommend that you follow what I quickly commented in the previous comment: "When skip step 1 of manual, just doing 2 and 3."

If that doesn't work, let me know and I'll be happy to provide a sample demo.

natioskar commented 1 year ago

I managed to make it work properly on iOS by applying a patch as shown in this PR

diff --git a/node_modules/react-native-text-size/ios/RNTextSize.podspec b/node_modules/react-native-text-size/RNTextSize.podspec
similarity index 89%
rename from node_modules/react-native-text-size/ios/RNTextSize.podspec
rename to node_modules/react-native-text-size/RNTextSize.podspec
index 281e201..da929db 100644
--- a/node_modules/react-native-text-size/ios/RNTextSize.podspec
+++ b/node_modules/react-native-text-size/RNTextSize.podspec
@@ -1,5 +1,5 @@
 require 'json'
-package = JSON.parse(File.read('../package.json'))
+package = JSON.parse(File.read('./package.json'))

 Pod::Spec.new do |s|
   s.name         = 'RNTextSize'
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
   s.author       = package['author']
   s.platform     = :ios, '9.0'
   s.source       = { :git => package['repository'], :tag => "v#{s.version}" }
-  s.source_files = '*.{h,m}'
+  s.source_files = 'ios/*.{h,m}'
   s.requires_arc = true

   s.dependency 'React'

or like this - https://github.com/aMarCruz/react-native-text-size/issues/38#issuecomment-1233313905