{"id":13668272,"url":"https://github.com/5-stones/react-native-readium","last_synced_at":"2025-05-11T06:57:25.779Z","repository":{"id":42520100,"uuid":"468831170","full_name":"5-stones/react-native-readium","owner":"5-stones","description":"📚 📖   React Native ebook reader for iOS, Android, \u0026 Web via Readium","archived":false,"fork":false,"pushed_at":"2025-03-05T15:28:11.000Z","size":14967,"stargazers_count":116,"open_issues_count":16,"forks_count":35,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-11T06:57:19.728Z","etag":null,"topics":["ebook","ebook-reader","ebooks","epub","epub-reader","epub3","react-native","readium","readium-2"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5-stones.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-11T16:53:04.000Z","updated_at":"2025-05-10T02:01:12.000Z","dependencies_parsed_at":"2023-01-30T19:30:39.724Z","dependency_job_id":"4dee7843-404c-4bb3-a506-23b575b64244","html_url":"https://github.com/5-stones/react-native-readium","commit_stats":{"total_commits":74,"total_committers":1,"mean_commits":74.0,"dds":0.0,"last_synced_commit":"5671a7035895fad130669a087e664817311df534"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5-stones%2Freact-native-readium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5-stones%2Freact-native-readium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5-stones%2Freact-native-readium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5-stones%2Freact-native-readium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5-stones","download_url":"https://codeload.github.com/5-stones/react-native-readium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253528935,"owners_count":21922629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebook","ebook-reader","ebooks","epub","epub-reader","epub3","react-native","readium","readium-2"],"created_at":"2024-08-02T08:00:28.651Z","updated_at":"2025-05-11T06:57:25.772Z","avatar_url":"https://github.com/5-stones.png","language":"Kotlin","funding_links":[],"categories":["Other toolkits related to Readium"],"sub_categories":["Other apps"],"readme":"# react-native-readium\n\n[![NPM version](https://img.shields.io/npm/v/react-native-readium.svg?color=success\u0026label=npm%20package\u0026logo=npm)](https://www.npmjs.com/package/react-native-readium)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n![PRs welcome!](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)\n![This project is released under the MIT license](https://img.shields.io/badge/license-MIT-blue.svg)\n\n----\n\n## Have A Bug/Feature You Care About?\n\nWe :heart: open source. We work on the things that are important to us when\nwe're able to work on them. Have an issue you care about?\n\n- [Dive Into The Code!](CONTRIBUTING.md)\n- [Sponsor Your Issue](#sponsor-the-library)\n\n----\n\n## Overview\n\nA react-native wrapper for https://readium.org/. At a high level this package\nallows you to do things like:\n\n- Render an ebook view.\n- Register for location changes (as the user pages through the book).\n- Register for the Table of Contents (so that you can display things like chapters in your app)\n- Control settings of the Reader. Things like:\n  - Dark Mode, Light Mode, Sepia Mode\n  - Font Size\n  - Page Margins\n  - More (see the `Settings` documentation in the [API section](#api))\n- Etc. (read on for more details. :book:)\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Supported Formats \u0026 DRM](#supported-formats--drm)\n- [API](#api)\n- [Contributing](#contributing)\n- [Release](#release)\n- [License](#license)\n\n| Dark Mode| Light Mode |\n|----------|------------|\n| ![Dark Mode](https://github.com/5-stones/react-native-readium/blob/main/docs/demo-dark-mode.gif) | ![Light Mode](https://github.com/5-stones/react-native-readium/blob/main/docs/demo-light-mode.gif) |\n\n## Installation\n\n#### Prerequisites\n\n1. **iOS**: Requires an iOS target \u003e= `13.0` (see the iOS section for more details).\n2. **Android**: Requires `compileSdkVersion` \u003e= `31` (see the Android section for more details).\n\n:warning: This library does not current support `newArch`. Please disable `newArch` if you intend to use it. PR's welcome.\n\n#### Install Module\n\n**NPM**\n\n```sh\nnpm install react-native-readium\n```\n\n**Yarn**\n\n```sh\nyarn add react-native-readium\n```\n\n#### iOS\n\nDue to the current state of the `Readium` swift libraries you need to manually\nupdate your `Podfile` ([see more on that here](https://github.com/readium/swift-toolkit/issues/38)).\n\n```rb\n# ./ios/Podfile\n...\nplatform :ios, '13.0'\n\n...\n\ntarget 'ExampleApp' do\n  config = use_native_modules!\n  ...\n  pod 'GCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/3.7.5/GCDWebServer.podspec', modular_headers: true\n  pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumNavigator.podspec'\n  pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumShared.podspec'\n  pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumStreamer.podspec'\n  pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumInternal.podspec'\n  pod 'Minizip', modular_headers: true\n  ...\nend\n```\n\nFinally, install the pods:\n\n`pod install`\n\n#### Android\n\nIf you're not using `compileSdkVersion` \u003e= 31 you'll need to update that:\n\n```groovy\n// android/build.gradle\n...\nbuildscript {\n    ...\n    ext {\n        ...\n        compileSdkVersion = 31\n...\n```\n\n## Usage\n\n```tsx\nimport React, { useState } from 'react';\nimport { ReadiumView } from 'react-native-readium';\nimport type { File } from 'react-native-readium';\n\nconst MyComponent: React.FC = () =\u003e {\n  const [file] = useState\u003cFile\u003e({\n    url: SOME_LOCAL_FILE_URL,\n  });\n\n  return (\n    \u003cReadiumView\n      file={file}\n    /\u003e\n  );\n}\n```\n\n[Take a look at the Example App](https://github.com/5-stones/react-native-readium/blob/main/example/src/App.tsx) for a more complex usage example.\n\n## Supported Formats \u0026 DRM\n\n#### Format Support\n\n| Format | Support | Notes |\n|--------|---------|-------|\n| Epub 2 | :white_check_mark: | |\n| Epub 3 | :white_check_mark: | |\n| PDF | :x: | On the roadmap, feel free to submit a PR or ask for direction. |\n| CBZ | :x: | On the roadmap, feel free to submit a PR or ask for direction. |\n\n**Missing a format you need?** Reach out and see if it can be added to the roadmap.\n\n#### DRM Support\n\nDRM is not supported at this time. However, there is a clear path to [support it via LCP](https://www.edrlab.org/readium-lcp/) and the intention is to eventually implement it.\n\n## API\n\n#### View Props\n\n| Name | Type | Optional | Description |\n|------|------|----------|-------------|\n| `file`     | [`File`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/File.ts)               | :x:                | A file object containing the path to the eBook file on disk. |\n| `location` | [`Locator`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Locator.ts) \\| [`Link`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Link.ts)           | :white_check_mark: | A locator prop that allows you to externally control the location of the reader (e.g. Chapters or Bookmarks). \u003cbr/\u003e\u003cbr/\u003e:warning: If you want to set the `location` of an ebook on initial load, you should use the `File.initialLocation` property (look at the `file` prop). See more [here](https://github.com/5-stones/react-native-readium/issues/16#issuecomment-1344128937) |\n| `settings` | [`Partial\u003cSettings\u003e`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Settings.ts)  | :white_check_mark: | An object that allows you to control various aspects of the reader's UI (epub only) |\n| `style`    | `ViewStyle`          | :white_check_mark: | A traditional style object. |\n| `onLocationChange` | `(locator: Locator) =\u003e void` | :white_check_mark: | A callback that fires whenever the location is changed (e.g. the user transitions to a new page)|\n| `onTableOfContents` | `(toc: Link[] \\| null) =\u003e void` | :white_check_mark: | A callback that fires once the file is parsed and emits the table of contents embedded in the file. Returns `null` or an empty `[]` if no TOC exists. See the [`Link`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Link.ts) interface for more info. |\n\n#### :warning: Web vs Native File URLs\n\nPlease note that on `web` the `File.url` should be a web accessible URL path to\nthe `manifest.json` of the unpacked epub. In native contexts it needs to be a\nlocal filepath to the epub file itself on disk. If you're not sure how to\nserve epub books [take a look at this example](https://github.com/d-i-t-a/R2D2BC/blob/production/examples/server.ts)\nwhich is based on the `dita-streamer-js` project (which is built on all the\nreadium [r2-*-js](https://github.com/readium?q=js) libraries)\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the\nrepository and the development workflow.\n\n## Release\n\nThe standard release command for this project is:\n\n```\nyarn version\n```\n\nThis command will:\n\n1. Generate/update the Changelog\n1. Bump the package version\n1. Tag \u0026 pushing the commit\n\n\ne.g.\n\n```\nyarn version --new-version 1.2.17\nyarn version --patch // 1.2.17 -\u003e 1.2.18\n```\n\n## Sponsor The Library\n\nIf you'd like to sponsor a specific feature, fix, or the library in general, please reach out on an issue and we'll have a conversation!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5-stones%2Freact-native-readium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5-stones%2Freact-native-readium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5-stones%2Freact-native-readium/lists"}