From b30c5d1dd148aeffc30e5307b1224207e6af29d5 Mon Sep 17 00:00:00 2001 From: artus9033 Date: Thu, 5 Feb 2026 02:15:31 +0100 Subject: [PATCH 1/5] fix: improve demo app UI on Android --- apps/expo-example/src/App.tsx | 2 +- .../RecordButton/RecordButtonUIBase.tsx | 14 +++++++--- .../adapters/mlcModelSetupAdapter.ts | 7 +---- .../src/screens/ChatScreen/ChatInputBar.tsx | 11 ++++---- .../screens/ChatScreen/ModelPickerSheet.tsx | 2 +- .../src/screens/ChatScreen/SettingsSheet.tsx | 27 +++++++++++++++++-- .../src/screens/ChatScreen/index.tsx | 17 ++++++------ apps/expo-example/src/theme/colors.android.ts | 4 +-- packages/mlc/src/ai-sdk.ts | 7 +++++ 9 files changed, 62 insertions(+), 29 deletions(-) diff --git a/apps/expo-example/src/App.tsx b/apps/expo-example/src/App.tsx index 87f35034..c789eee3 100644 --- a/apps/expo-example/src/App.tsx +++ b/apps/expo-example/src/App.tsx @@ -190,7 +190,7 @@ const styles = StyleSheet.create({ }, drawer: { width: 280, - backgroundColor: colors.systemBackground, + backgroundColor: '#fff', }, drawerScroll: { flex: 1, diff --git a/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx b/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx index 8f65f449..dbbf5fd5 100644 --- a/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx +++ b/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx @@ -186,11 +186,13 @@ export function RecordButtonUIBase({ ) } + const uiDisabled = disabled || isProcessing || !transcriptionModel + return ( {isProcessing ? ( @@ -202,9 +204,15 @@ export function RecordButtonUIBase({ } + fallback={ + + } /> )} diff --git a/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts b/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts index a6108653..3ab95adc 100644 --- a/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts +++ b/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts @@ -1,6 +1,5 @@ import type { LanguageModelV3 } from '@ai-sdk/provider' import { mlc } from '@react-native-ai/mlc' -import RNBlobUtil from 'react-native-blob-util' import type { Availability, SetupAdapter } from '../../config/providers.common' @@ -19,11 +18,7 @@ export const createMLCLanguageSetupAdapter = ( }, builtIn: false, async isAvailable(): Promise { - return (await RNBlobUtil.fs.exists( - RNBlobUtil.fs.dirs.SDCardDir + `/${modelId}/tensor-cache.json` - )) - ? 'yes' - : 'availableForDownload' + return (await model.isDownloaded()) ? 'yes' : 'availableForDownload' }, async download(onProgress) { await model.download(async (event) => { diff --git a/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx b/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx index 86242a59..512cda0d 100644 --- a/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx +++ b/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx @@ -33,7 +33,7 @@ export function ChatInputBar({ onSend, isGenerating }: ChatInputBarProps) {