feat: enhanced mentions#3631
Open
isekovanic wants to merge 23 commits into
Open
Conversation
Contributor
SDK Size
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
This PR implements the enhanced mentions featureinto the SDK so RN apps can mention not just users but also
@channel,@here, custom roles and user groups - with per type colors in the rendered message and full offline draft round tripping. Bundles the architectural fixes that surfaced while wiring this up (Androida11ybounds, cross screen portal teleport leak, composer/list animation sync, iOS multiline regression).🛠 Implementation details
Enhanced mentions
Consumes the LLC's five variant
MentionSuggestion/MentionEntityunion (user | channel | here | role | user_group).Composer suggestion rows -
package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx'sMentionSuggestionItemis now a dispatcher that switches onitem.mentionTypeand routes to a per type row. Still overridable viauseComponentsContext().MentionSuggestionItemso integrators can replace just the mention branch.EnhancedMentionContent, EnhancedMentionIcon, TokenizedSuggestionParts — all exported for custom dispatcher composition.
Rendered message text -
Message/MessageItemView/utils/renderText.tsxMentionEntity[]frommentioned_users+mentioned_channel+mentioned_here+mentioned_roles+mentioned_groups(mentioned_group_idsfallback).@heremustn't shadow@here-team).chatTextMentionso existing themes look identical.onPressnow carriesadditionalInfo: { mentionedEntity, user? }.userstays populated for user mentions (for back compatibility reasons).Memo comparator — MessageItemView/MessageTextContainer.tsx
in non-user mentions would skip re-render.
Offline draft persistence has also been modified to reflect enhanced mentions.
Suggestion list architecture
The mount location of
<AutoCompleteSuggestionList />is now moved toMessageList.tsxandMessageFlashList.tsx- notMessageComposer.tsx, inside its own<PortalWhileClosingView portalHostName='overlay-suggestion-list' portalName='autocomplete-suggestion-list'>wrapper.Why: Android's
getBoundsInScreen()clampsa11ybounds to the parent's measured rect. The composer's wrapping View (~228px with safe area padding) was clipping the absolutely positioned suggestion list to inverted/empty bounds -TalkBacksaw nothing, taps didn't activate. Hoisting into theflex: 1MessageListcontainer restores valida11ybounds. Verified withuiautomatordump.PortalWhileClosingViewcross screen leak fixRemoved the early return guard in
syncPortalLayout:The guard kept unmeasured (0×0) wrappers off the closing portal stack, but as a side effect, wrappers with no children (e.g. autocomplete list before the user types @) never registered. Navigating
Channel->Thread(both mount such wrappers, as an example) left the previous screen's stale entry as the only thing on the host stack and the closing overlay teleport then stampedChannelautocomplete content into theThreadscreen. Removing the guard lets empty wrappers register; teleport for an empty wrapper rendersnullchildren so nothing visible.Accessibility
useAnnounceOnShow(visible, message, { delayMs?, priority? })- announces on each visible: false -> true transition and resets on hide. UnlikeuseAnnounceOnStateChange, it doesn't dedupe consecutive identical strings, so reshows reannounce.BottomSheetModal(replaces adhocref+useEffect) andAutoCompleteSuggestionListai-docs/accessibility.mdand the teama11yskill updated to documentuseAnnounceOnShow, the menu/menuitem iOS only caveat and a new "floating overlays need a tall parent for Android a11y" rule.ClippingFadeBottom
New
UIComponents/ClippingFadeBottom.tsxreusable fade primitive used at the bottom edge of the suggestion list so long lists fade out instead of hard clipping at the composer edge.Bundled bug fixes
TextInputregression after RN upgrade - caret jumping on newlineAutoCompleteSuggestionListanimation desync when swithcing between attachment picker and keyboard🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
developbranch