Skip to content

feat(ai-components): move AIConversation to its own entry point - #3960

Open
isekovanic wants to merge 1 commit into
v9-releasefrom
feat/ai-optional-keyboard-controller
Open

isekovanic wants to merge 1 commit into
v9-releasefrom
feat/ai-optional-keyboard-controller

Conversation

@isekovanic

Copy link
Copy Markdown
Contributor

Ticket: https://linear.app/stream/issue/RN-485

AIConversation's list uses @legendapp/list/keyboard, which requires react-native-keyboard-controller without a guard. ai-components is 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, StreamingMessageView or ComposerView.

  • AIConversation has its own entry point: stream-chat-react-native/ai-components/conversation (stream-chat-expo/ai-components/conversation). It needs keyboard-controller with a KeyboardProvider above it. Only the view and its props types moved; AIConversationController, useAIConversationState, AIMessage and fromStreamMessage stay in ai-components.
  • keyboard-controller is optional everywhere else. ai-components loads it through one guarded require. With it, ComposerView rides 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's Keyboard.
  • The entry isolation check keeps ai-components and a2ui from reaching the conversation or @legendapp/list/keyboard, and fails if any file other than internal/keyboard.tsx imports keyboard-controller.

AIConversation isn'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.

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.
@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2027 KB 2047 KB +20819 B 🔴
ai_components_size 163 KB 335 KB +176375 B 🔴
a2ui_size n/a 100 KB n/a 🆕

@isekovanic
isekovanic requested a review from oliverlaz November 9, 2026 16:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants