Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 25.2k
Refactor TextFragmentList into AttributedString#42701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| package com.facebook.react.views.text.attributedstring | ||
| /** Interface for an attributed string */ | ||
| internal interface AttributedString { | ||
| fun getFragment(index: Int): AttributedStringFragment | ||
| val fragmentCount: Int | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| package com.facebook.react.views.text.attributedstring | ||
| import com.facebook.react.bridge.ReadableArray | ||
| import com.facebook.react.bridge.ReadableMap | ||
| /** An [AttributedString] backed by a [ReadableMap] */ | ||
| internal class BridgeAttributedString(private val attributedString: ReadableMap) : AttributedString { | ||
| override fun getFragment(index: Int): AttributedStringFragment = BridgeAttributedStringFragment(fragments.getMap(index)) | ||
| override val fragmentCount: Int | ||
| get() = fragments.size() | ||
| private val fragments: ReadableArray | ||
| get() = attributedString.getArray("fragments")!! | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| package com.facebook.react.views.text.attributedstring | ||
| import com.facebook.react.common.mapbuffer.MapBuffer | ||
| import com.facebook.react.views.text.TextLayoutManagerMapBuffer.AS_KEY_FRAGMENTS | ||
| /** An [AttributedString] backed by a [MapBuffer] */ | ||
| internal class MapBufferAttributedString(private val attributedString: MapBuffer) : AttributedString { | ||
| override fun getFragment(index: Int): AttributedStringFragment = | ||
| MapBufferAttributedStringFragment(fragments.getMapBuffer(index)) | ||
| override val fragmentCount: Int | ||
| get() = fragments.count | ||
| private val fragments: MapBuffer | ||
| get() = attributedString.getMapBuffer(AS_KEY_FRAGMENTS.toInt()) | ||
| } |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment, and same for
AttributedStringFragmentare not meaningful to someone who wants to learn what this interface represents and is used for.