YouVersionProvider
The core provider that configures the SDK and must wrap your entire application.Props
Your YouVersion Platform API key
The API host URL (rarely needs to be changed)
Theme preference for the SDK. When set to
'system', automatically follows the user’s system color scheme preference.Enable authentication functionality. When
true, must also provide authRedirectUrl.OAuth callback URL (required when
includeAuth is true)Your application components
Features
- Automatically generates and manages installation ID
- Syncs configuration with
YouVersionPlatformConfigurationfrom core package - Lazy-loads authentication provider when
includeAuthis enabled - Automatically resolves system theme preference
- Listens for system theme changes when
theme="system"
Usage
Context Value
The provider exposes the following context value:The API key provided to the provider
The API host URL
Auto-generated installation identifier
Resolved theme (never returns
'system', always resolved to actual theme)Whether authentication is enabled
ReaderProvider
Manages Bible reading session state, including current version, book, chapter, and verse.Props
Initial Bible version
Initial Bible book
Initial chapter
Initial verse (or
null if no specific verse)Child components
Usage
Context Value
Current Bible version
Current Bible book
Current chapter
Current verse or null
Update current version
Update current book
Update current chapter
Update current verse
Accessing Context
Use theuseReaderContext hook to access the reader state:
VerseSelectionProvider
Manages multi-verse selection state for highlighting or copying multiple verses.Props
Child components
Usage
Context Value
Set of selected verse USFM identifiers
Toggle verse selection state
Check if a verse is selected
Clear all selected verses
Number of currently selected verses
Accessing Context
Use theuseVerseSelection hook:
YouVersionAuthProvider
Manages authentication state including user info, tokens, and OAuth callback processing. Lazy-loaded only when authentication is enabled.Features
- Automatically handles OAuth callback processing
- Manages token refresh
- Caches user information
- Syncs with
YouVersionPlatformConfiguration
How It Works
- When
YouVersionProviderhasincludeAuth={true}, it lazy-loadsYouVersionAuthProvider - The auth provider checks for existing refresh tokens on mount
- If on OAuth callback page, processes the callback and caches user info
- Provides auth state and user info to
useYVAuthhook
Props (Internal)
Configuration object with
appKey, apiHost, and redirectUriChild components
Provider Nesting
Providers can be nested to combine functionality:Best Practices
Place YouVersionProvider at the root
Place YouVersionProvider at the root
YouVersionProvider should wrap your entire application at the root level:Use ReaderProvider per reader instance
Use ReaderProvider per reader instance
If you have multiple readers on the same page, use separate
ReaderProvider instances:Scope VerseSelectionProvider appropriately
Scope VerseSelectionProvider appropriately
Place
VerseSelectionProvider around the components that need selection state: