Migrating from v4 to v5
v5 moves the library to Nitro Modules and to newer Readium toolkits. Most apps need build changes and a few small code changes.
Dependencies
Add react-native-nitro-modules, which the library now depends on:
yarn add react-native-nitro-modules
iOS
Update your Podfile: add Readium's spec repo as a source, and call the readium_pods and
readium_post_install helpers. See Installation for the full snippet.
Android
The Android implementation moves to a newer Readium Kotlin toolkit, which needs:
- JDK 17.
- Kotlin 2.3.20 or later.
compileSdkVersion31 or later.
If the build then fails on missing java.time APIs, enable
core library desugaring.
Code changes
- Navigation is imperative. Move the reader with
ref.current.goTo(locator), alongsidegoForward()andgoBackward(); see Navigation. The initial position is still set withfile.initialLocation. On web, theuseLocationObserverhook is gone. Linkis smaller.templated,height,width,bitrate,durationandalternateswere removed, andrelsis now astring[]instead of aSet<string>.typeis only set by the web reader.Fileis nowReadiumFile.Filestill works as a deprecated alias.