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 Chat component manages it internally.
  • Rely on the appSettings value from ChatContext instead of using this hook in isolation.
  • Handle the null return value during the initial fetch or when the client is not yet connected.
  • Ensure enableOfflineSupport and initialisedDatabase are consistent with your offline support configuration.

Usage

useAppSettings.ts
import { useAppSettings } from "stream-chat-react-native";

const appSettings = useAppSettings(
  client,
  isOnline,
  enableOfflineSupport,
  initialisedDatabase,
);

if (appSettings?.app?.file_upload_config) {
  // Use file upload configuration
}

This hook is used internally by the Chat component. The returned appSettings object is available through the ChatContext via the appSettings property.

Parameters

NameTypeRequiredDescription
clientStreamChatYesThe Stream Chat client instance.
isOnlineboolean | nullYesWhether the client currently has an active connection.
enableOfflineSupportbooleanYesWhether offline support is enabled for the application.
initialisedDatabasebooleanYesWhether the offline database has been initialised and is ready to use.

Returns

TypeDescription
AppSettingsAPIResponse | nullThe application settings object, or null if not yet fetched.