import { useAppSettings } from "stream-chat-react-native";
const appSettings = useAppSettings(
client,
isOnline,
enableOfflineSupport,
initialisedDatabase,
);
if (appSettings?.app?.file_upload_config) {
// Use file upload configuration
}useAppSettings
Fetches the application settings from Stream and keeps them in state. When offline support is enabled, it falls back to cached settings from the local database.
Best Practices
- Avoid calling this hook directly; the
Chatcomponent manages it internally. - Rely on the
appSettingsvalue fromChatContextinstead of using this hook in isolation. - Handle the
nullreturn value during the initial fetch or when the client is not yet connected. - Ensure
enableOfflineSupportandinitialisedDatabaseare consistent with your offline support configuration.
Usage
useAppSettings.ts
This hook is used internally by the Chat component. The returned appSettings object is available through the ChatContext via the appSettings property.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| client | StreamChat | Yes | The Stream Chat client instance. |
| isOnline | boolean | null | Yes | Whether the client currently has an active connection. |
| enableOfflineSupport | boolean | Yes | Whether offline support is enabled for the application. |
| initialisedDatabase | boolean | Yes | Whether the offline database has been initialised and is ready to use. |
Returns
| Type | Description |
|---|---|
AppSettingsAPIResponse | null | The application settings object, or null if not yet fetched. |