Repository navigation
feat(ai-components): move AIConversation to its own entry point - #3960
Open
isekovanic wants to merge 1 commit into
Open
isekovanic wants to merge 1 commit into
isekovanic wants to merge 1 commit into
Conversation
AIConversation's list uses @legendapp/list/keyboard, which requires react-native-keyboard-controller with no guard. Since ai-components is a single entry and Metro bundles everything it reaches, every app importing from it would need keyboard-controller, even ones only using markdown or the composer. AIConversation now lives in ai-components/conversation, which needs keyboard-controller. The rest of ai-components loads it through one guarded require: with it, ComposerView rides the keyboard; without it, the composer stays put and the "+" button closes the keyboard with RN's Keyboard. The controller and its state stay in ai-components. The entry isolation check keeps ai-components and a2ui away from the conversation and @legendapp/list/keyboard, and only lets internal/keyboard.tsx load keyboard-controller.
Contributor
SDK Size
|
This branch has not been deployed
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.
Ticket: https://linear.app/stream/issue/RN-485
AIConversation's list uses@legendapp/list/keyboard, which requiresreact-native-keyboard-controllerwithout a guard.ai-componentsis one entry and Metro bundles everything it reaches, so any app importing from it would need keyboard-controller after upgrading, including apps on 9.12 that only use markdown,StreamingMessageVieworComposerView.AIConversationhas its own entry point:stream-chat-react-native/ai-components/conversation(stream-chat-expo/ai-components/conversation). It needs keyboard-controller with aKeyboardProviderabove it. Only the view and its props types moved;AIConversationController,useAIConversationState,AIMessageandfromStreamMessagestay inai-components.ai-componentsloads it through one guardedrequire. With it,ComposerViewrides the keyboard and "+" waits for the keyboard to close before opening the sheet. Without it, the composer doesn't move and "+" closes the keyboard with RN'sKeyboard.ai-componentsanda2uifrom reaching the conversation or@legendapp/list/keyboard, and fails if any file other thaninternal/keyboard.tsximports keyboard-controller.AIConversationisn't released yet, so nothing breaks. The sample, the ai-components README and AGENTS.md use the new import.Tests cover the composer and sheet without keyboard-controller. Lint, typecheck, unit tests and build pass. Checked in ExpoChatGPTSample on an Android emulator: asking pins the question, the composer rides the keyboard, and the "+" sheet opens after the keyboard closes.