From a40fd53375b2eb402a2ad789865a8633c43e2d15 Mon Sep 17 00:00:00 2001 From: Calvin Liang Date: Fri, 8 Mar 2024 02:55:18 -0800 Subject: [PATCH] update README --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ba0053b..b5b3dee 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ AutoLinkText is a simple library that makes links, emails, and phone numbers clickable in text in Jetpack Compose and Kotlin Compose Multiplatform. +## Motivation + +[`TextView`](https://developer.android.com/reference/android/widget/TextView) has [`autoLink`](https://developer.android.com/reference/android/widget/TextView#attr_android:autoLink) and [`Linkify`](https://developer.android.com/reference/android/text/util/Linkify) but Compose doesn't have an equivalent. This library aims to fill that gap. + | Android | iOS | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | A screenshot of the demo app in Android | A screenshot of the demo app in iOS | @@ -12,7 +16,7 @@ AutoLinkText is a simple library that makes links, emails, and phone numbers cli ## Features -- Make links, emails, and phone numbers clickable in your text +- Make links, emails, and phone numbers clickable in your text out of the box - Create custom matchers for your own patterns (e.g. hashtags, mentions, etc.) - Customizable styling for links - Customizable click listeners for links @@ -62,11 +66,6 @@ dependencies { } ``` -### Caveats - -- Google might be deprecating the `ClickableText` API in the future. (See [Google IssueTracker issue 323346994](https://issuetracker.google.com/issues/323346994)) I will try my best to keep this library up to date with the latest Compose APIs. -- Accessibility is not great if your onClick function does something other than opening a link. Hopefully this gets fixed in the future. (See [Google IssueTracker issue 274486643](https://issuetracker.google.com/issues/274486643)) - ### Examples See [demo app code](demoApp/composeApp/src/commonMain/kotlin/sh/calvin/autolinktext/demo/App.kt) for more examples. @@ -241,6 +240,11 @@ AutoLinkText( ) ``` +## Caveats + +- Google seems to be working on replacing [`ClickableText`]() API with [`LinkAnnotation`](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation) but it is not functional yet. I will try my best to keep this library up to date with the latest Compose APIs. +- The default list of `TextRule`s are accessible. But at the moment accessibility is not great if you add `TextRule`s with onClick function that does something other than opening a link because of a bug with [`ClickableText`](). Hopefully this gets fixed in the future (See [Google IssueTracker issue 274486643](https://issuetracker.google.com/issues/274486643)). + ## API - [AutoLinkText](autolinktext/src/commonMain/kotlin/sh/calvin/autolinktext/AutoLinkText.kt)