@onekeyfe/react-native-auto-size-input 3.0.144 → 3.0.146
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.
|
@@ -19,6 +19,7 @@ import android.view.inputmethod.EditorInfo
|
|
|
19
19
|
import android.widget.EditText
|
|
20
20
|
import android.widget.TextView
|
|
21
21
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
22
|
+
import com.facebook.react.common.assets.ReactFontManager
|
|
22
23
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
23
24
|
|
|
24
25
|
@DoNotStrip
|
|
@@ -785,21 +786,18 @@ class HybridAutoSizeInput(val context: ThemedReactContext) : HybridAutoSizeInput
|
|
|
785
786
|
}
|
|
786
787
|
}
|
|
787
788
|
|
|
789
|
+
// Resolve fonts the way React Native Text does. ReactFontManager reads bundled
|
|
790
|
+
// assets/fonts/<family>.ttf and fonts registered at runtime (expo-font);
|
|
791
|
+
// Typeface.create only knows system families and silently falls back to the
|
|
792
|
+
// default font, so an app font such as "Roobert-Medium" never applied.
|
|
788
793
|
private fun makeTypeface(): Typeface {
|
|
789
794
|
val style = when (fontWeight) {
|
|
790
795
|
"bold" -> Typeface.BOLD
|
|
791
796
|
else -> Typeface.NORMAL
|
|
792
797
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
Typeface.create(fontFamily, style)
|
|
797
|
-
} catch (e: Exception) {
|
|
798
|
-
Typeface.defaultFromStyle(style)
|
|
799
|
-
}
|
|
800
|
-
} else {
|
|
801
|
-
Typeface.defaultFromStyle(style)
|
|
802
|
-
}
|
|
798
|
+
val family = fontFamily?.takeIf { it.isNotEmpty() }
|
|
799
|
+
?: return Typeface.defaultFromStyle(style)
|
|
800
|
+
return ReactFontManager.getInstance().getTypeface(family, style, context.assets)
|
|
803
801
|
}
|
|
804
802
|
|
|
805
803
|
// MARK: - Methods
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-auto-size-input",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.146",
|
|
4
4
|
"description": "Auto-sizing text input with font scaling, prefix and suffix support",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|