react-native-readium 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,9 @@ export const useReaderRef = ({ file, onLocationChange, onTableOfContents, }) =>
10
10
  }
11
11
  if (!newLocation.locations.totalProgression) {
12
12
  const newLocationIndex = readingOrder.current.findIndex((entry) => entry.href === newLocation.href);
13
+ if (newLocationIndex < 0 || !readingOrder.current[newLocationIndex]) {
14
+ return;
15
+ }
13
16
  const readingOrderCount = readingOrder.current.length;
14
17
  const chapterTotalProgression = readingOrder.current[newLocationIndex].locations?.totalProgression ||
15
18
  0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-readium",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A react-native wrapper for https://readium.org/",
5
5
  "main": "lib/src/index",
6
6
  "types": "lib/src/index.d.ts",
@@ -24,6 +24,9 @@ export const useReaderRef = ({
24
24
  const newLocationIndex = readingOrder.current.findIndex(
25
25
  (entry) => entry.href === newLocation.href
26
26
  );
27
+ if (newLocationIndex < 0 || !readingOrder.current[newLocationIndex]) {
28
+ return;
29
+ }
27
30
  const readingOrderCount = readingOrder.current.length;
28
31
  const chapterTotalProgression =
29
32
  readingOrder.current[newLocationIndex].locations?.totalProgression ||