Repository navigation
Conversation
The "Complete example" on the "Building a chat app" page did not compile when copied into an app: it referenced `INITIAL_MESSAGES`, `Message` and `styles` without defining them, rendered `<Text>` without importing it, and left `StyleSheet`/`View` imported but unused. Replace the snippet with the version posted in the issue, which defines the `Message` component and the `styles` sheet, seeds `messages` inline, imports `Text`, inserts new messages at the head of the history for the inverted list, and exports the screen as default. Applied to the current docs and to the 1.22.0 versioned copy, which are byte-identical.
2 tasks done
kirillzyusko
added a commit
that referenced
this pull request
Oct 13, 2026
## 📜 Description Make chat example to be copy/pastable. ## 💡 Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> Made the code copy-pastable so developers can copy it into their app and check how it works. Additionally updated snack, because we don't have `ChatKit.ScrollView` component and instead we have `KeyboardChatScrollView`. Closes #1590 #1603 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### Docs - updated snack code (code + dependency version) - updated chat app code in documentation; ## 🤔 How Has This Been Tested? Tested locally and via preview. ## 📸 Screenshots (if appropriate): <img width="978" height="862" alt="image" src="https://github.com/user-attachments/assets/a41dd59f-3f6b-4750-916e-d48401835f26" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
Owner
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.
📜 Description
Replaces the "Complete example" snippet on the Building a chat app guide with the corrected version you posted in #1590, so the code compiles as-is when copied into an app.
The snippet on
mainfails to compile for exactly the reasons listed in the issue — it referencesINITIAL_MESSAGES,Messageandstyleswhich are never defined, renders<Text>which is never imported, and leavesStyleSheetandViewimported but unused.Applied to both
docs/docs/guides/building-chat-app.mdxanddocs/versioned_docs/version-1.22.0/guides/building-chat-app.mdx— those two files are byte-identical, and I kept them that way.Two notes on scope:
<ExpoSnack id="@kirylziusko/c0b7f0" />lives on your account, so I can't update it from the outside and left the id as-is. Happy to do that part too if you share access or paste an updated id — otherwise the embedded Snack still shows the old code.version-1.21.0left frozen.docs/versioned_docs/version-1.21.0/guides/building-chat-app.mdxcarries the same broken snippet, but against the 1.21 API (React.ElementRef<typeof KeyboardChatScrollView>rather than the exportedKeyboardChatScrollViewRef), so the fix isn't a straight copy. I followed the precedent of 608a696 (docs: remove duplicated words), which only touched the current docs plus the then-latest versioned copy. Say the word and I'll port it back.💡 Motivation and Context
Fixes #1590
📢 Changelog
JS
iOS
Android
🤔 How Has This Been Tested?
The docs build passes on
maintoo, since MDX doesn't type-check fenced code blocks — so I compiled the snippet directly rather than relying on the docs build to catch this.1. Type-checked the snippet. Extracted the fenced
tsxblock straight out of the.mdxinto a scratch.tsxfile, checked with the repo's roottsconfig.jsoncompiler options (strict,noUnusedLocals,noUnusedParameters),react-native-keyboard-controllermapped to./src/index.Before, from the snippet on
main:After, re-extracted from the edited
.mdxin this PR: clean, exit code 0, no diagnostics. Your snippet compiled as-is — I made no corrections to it.2.
cd docs && yarn install --frozen-lockfile && yarn build—Server: Compiled successfully,Client: Compiled successfully,Generated static files in "build".3.
yarn markdownlint-cli2 "**/*.md" "#node_modules"(fromdocs/) —Linting: 316 file(s),Summary: 0 error(s).4.
prettier --checkon both changed files —All matched files use Prettier code style!5.
npx jest src—27 passed, 27 totalsuites,214 passed, 214 totaltests. Unchanged, as expected for a docs-only change.The snippet also produces strictly fewer ESLint findings than the one it replaces (the remaining ones are
react-perf/jsx-no-bindadvisories that were already present, and.mdxcode blocks aren't linted in CI anyway), so I left your code untouched rather than restyling it.📸 Screenshots (if appropriate):
Not applicable — no rendered-output change beyond the code block contents.
📝 Checklist