nativescript-community / ui-label

Alternative to the built-in NativeScript Label but with better performance and additional features such as HTML rendering and more.
Apache License 2.0
19 stars 7 forks source link

[1.3.5][Android] linkColor crashes the app #17

Closed MrSnoozles closed 11 months ago

MrSnoozles commented 1 year ago

After updating from 1.2.26 to 1.3.5 when I use the linkColor attribute the app now crashes.

<HTMLLabel :html="getDisclaimerText()"
                   @linkTap="openStorePage"
                   linkColor="#9ca3af"
                   :textWrap="true"
                   :lineHeight="18"
                   class="border-t mt-6 p-3 text-sm text-gray-400"></HTMLLabel>

grafik

farfromrefug commented 1 year ago

@MrSnoozles i cant reproduce your issue. i know what might happen but i need an example to reproduce it. If you could create a repro example that would help a lot

nikoTM commented 1 year ago

@farfromrefug https://github.com/nikoTM/ns-linkColor running that on API 25 crashes

nikoTM commented 1 year ago

https://developer.android.com/reference/android/graphics/Color#valueOf(int)

It looks like valueOf(int) was added in API 26 and this createNativeAttributedString uses that API.

Color spaces were introduced in Android O (https://stackoverflow.com/questions/60083126/create-color-object-from-rgb-values-for-api-level-android-26-oreo), not sure how to convert a hex to Color instance pre API 25

farfromrefug commented 11 months ago

@nikoTM @MrSnoozles i just released a new version which fixes this