react-native-readium 1.2.1 → 2.0.0-rc.0

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.
package/README.md CHANGED
@@ -84,10 +84,11 @@ platform :ios, '13.0'
84
84
  target 'ExampleApp' do
85
85
  config = use_native_modules!
86
86
  ...
87
- pod 'GCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/3ec154d358f26858071feaa6429e0f1c16bb11bd/GCDWebServer.podspec', modular_headers: true
88
- pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumShared.podspec'
89
- pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumStreamer.podspec'
90
- pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumNavigator.podspec'
87
+ pod 'GCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/3.7.5/GCDWebServer.podspec', modular_headers: true
88
+ pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumNavigator.podspec'
89
+ pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumShared.podspec'
90
+ pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumStreamer.podspec'
91
+ pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.6.0/Support/CocoaPods/ReadiumInternal.podspec'
91
92
  pod 'Minizip', modular_headers: true
92
93
  ...
93
94
  end
@@ -99,23 +100,6 @@ Finally, install the pods:
99
100
 
100
101
  #### Android
101
102
 
102
- You might need to [add `jcenter` if you're getting a build failure on android](https://github.com/readium/kotlin-toolkit/issues/31):
103
-
104
- ```groovy
105
- // android/build.gradle
106
- ...
107
-
108
- allprojects {
109
- repositories {
110
- ...
111
- // required by react-native-readium https://github.com/readium/kotlin-toolkit/issues/31
112
- jcenter()
113
- }
114
- ...
115
- }
116
- ...
117
- ```
118
-
119
103
  If you're not using `compileSdkVersion` >= 31 you'll need to update that:
120
104
 
121
105
  ```groovy
@@ -1,12 +1,11 @@
1
1
  buildscript {
2
2
  // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
3
  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['Readium_kotlinVersion']
4
- ext.readium_version = '2.2.1'
4
+ ext.readium_version = '2.4.1'
5
5
 
6
6
  repositories {
7
7
  google()
8
8
  mavenCentral()
9
- jcenter()
10
9
  }
11
10
 
12
11
  dependencies {
@@ -49,21 +48,13 @@ android {
49
48
  targetCompatibility JavaVersion.VERSION_1_8
50
49
  }
51
50
 
52
- kotlinOptions {
53
- jvmTarget = "1.8"
54
- }
55
-
56
51
  buildFeatures {
57
52
  viewBinding true
58
53
  }
59
54
  }
60
55
 
61
56
  repositories {
62
-
63
- maven { url 'https://jitpack.io' }
64
-
65
57
  mavenCentral()
66
- jcenter()
67
58
  google()
68
59
 
69
60
  def found = false
@@ -140,51 +131,51 @@ dependencies {
140
131
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
141
132
 
142
133
  // readium deps
143
- implementation "com.github.readium.kotlin-toolkit:readium-shared:$readium_version"
144
- implementation "com.github.readium.kotlin-toolkit:readium-streamer:$readium_version"
145
- implementation ("com.github.readium.kotlin-toolkit:readium-navigator:$readium_version") {
134
+ implementation "org.readium.kotlin-toolkit:readium-shared:$readium_version"
135
+ implementation "org.readium.kotlin-toolkit:readium-streamer:$readium_version"
136
+ implementation ("org.readium.kotlin-toolkit:readium-navigator:$readium_version") {
146
137
  // this package doesn't provide audio playback, so remove exoplayer
147
138
  // transitive deps to avoid potential collisions with other projects.
148
139
  exclude group: "com.google.android.exoplayer"
149
140
  }
150
141
 
151
142
  // other deps
152
- implementation "androidx.core:core-ktx:1.6.0"
153
- implementation "androidx.activity:activity-ktx:1.3.1"
154
- implementation "androidx.appcompat:appcompat:1.3.1"
155
- implementation "androidx.browser:browser:1.3.0"
143
+ implementation "androidx.core:core-ktx:1.7.0"
144
+ implementation "androidx.activity:activity-ktx:1.4.0"
145
+ implementation "androidx.appcompat:appcompat:1.4.1"
146
+ implementation "androidx.browser:browser:1.4.0"
156
147
  implementation "androidx.cardview:cardview:1.0.0"
157
- implementation "androidx.constraintlayout:constraintlayout:2.1.1"
158
- implementation "androidx.fragment:fragment-ktx:1.3.6"
159
- implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
160
- implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
161
- implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
148
+ implementation "androidx.constraintlayout:constraintlayout:2.1.3"
149
+ implementation "androidx.fragment:fragment-ktx:1.4.0"
150
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
151
+ implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
152
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
162
153
  implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
163
154
  implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
164
- implementation "androidx.paging:paging-runtime-ktx:3.0.1"
155
+ implementation "androidx.paging:paging-runtime-ktx:3.1.0"
165
156
  implementation "androidx.recyclerview:recyclerview:1.2.1"
166
157
  implementation "androidx.viewpager2:viewpager2:1.0.0"
167
158
  implementation "androidx.webkit:webkit:1.4.0"
168
- implementation "com.google.android.material:material:1.4.0"
169
- implementation "com.jakewharton.timber:timber:4.7.1"
159
+ implementation "com.google.android.material:material:1.5.0"
160
+ implementation "com.jakewharton.timber:timber:5.0.1"
170
161
  // AM NOTE: needs to stay this version for now (June 24,2020)
171
162
  //noinspection GradleDependency
172
- implementation "com.squareup.picasso:picasso:2.5.2"
173
- implementation "joda-time:joda-time:2.10.10"
174
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
163
+ implementation "com.squareup.picasso:picasso:2.71828"
164
+ implementation "joda-time:joda-time:2.10.13"
165
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
175
166
  // AM NOTE: needs to stay this version for now (June 24,2020)
176
167
  //noinspection GradleDependency
177
- implementation "org.jsoup:jsoup:1.13.1"
168
+ implementation "org.jsoup:jsoup:1.14.3"
178
169
 
179
170
  // Room database
180
- final room_version = "2.4.0-beta01"
181
- implementation "androidx.room:room-runtime:$room_version"
182
- implementation "androidx.room:room-ktx:$room_version"
183
- annotationProcessor "androidx.room:room-compiler:$room_version"
171
+ final roomVersion = "2.4.1"
172
+ implementation "androidx.room:room-runtime:$roomVersion"
173
+ implementation "androidx.room:room-ktx:$roomVersion"
174
+ annotationProcessor "androidx.room:room-compiler:$roomVersion"
184
175
 
185
176
  implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
186
177
  //noinspection LifecycleAnnotationProcessorWithJava8
187
- annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.3.1"
178
+ annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.4.0"
188
179
 
189
180
  testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
190
181
  testImplementation "junit:junit:4.13.2"
@@ -78,6 +78,9 @@ class ReadiumView(
78
78
  payload
79
79
  )
80
80
  }
81
+ else -> {
82
+ // do nothing
83
+ }
81
84
  }
82
85
  }
83
86
  }
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!--
2
+ FIXME: this was imported from `kotlin-toolkit/readium/navigator/src/main/res/layout@v2.2.1`.
3
+ Not sure why it's not being imported from readium-navigator, but if its not here
4
+ the android build throws an error due to UserSettings.kt#updateViewCSS
5
+
6
+ ~ Module: r2-navigator-kotlin
7
+ ~ Developers: Aferdita Muriqi
8
+ ~
9
+ ~ Copyright (c) 2018. Readium Foundation. All rights reserved.
10
+ ~ Use of this source code is governed by a BSD-style license which is detailed in the
11
+ ~ LICENSE file present in the project repository where this source code is maintained.
12
+ -->
13
+
14
+ <org.readium.r2.navigator.epub.fxl.R2FXLLayout xmlns:android="http://schemas.android.com/apk/res/android"
15
+ xmlns:tools="http://schemas.android.com/tools"
16
+ android:id="@+id/r2FXLLayout"
17
+ android:layout_width="match_parent"
18
+ android:layout_height="match_parent">
19
+
20
+ <ScrollView
21
+ android:layout_width="match_parent"
22
+ android:layout_height="match_parent"
23
+ android:fillViewport="true"
24
+ android:scrollbars="none">
25
+
26
+ <RelativeLayout
27
+ android:layout_width="match_parent"
28
+ android:layout_height="match_parent"
29
+ android:layout_gravity="center">
30
+
31
+ <LinearLayout
32
+ android:layout_width="wrap_content"
33
+ android:layout_height="wrap_content"
34
+ android:layout_centerInParent="true"
35
+ android:gravity="center_horizontal"
36
+ android:orientation="horizontal"
37
+ tools:ignore="UselessParent">
38
+
39
+ <org.readium.r2.navigator.R2BasicWebView
40
+ android:id="@+id/firstWebView"
41
+ android:layout_width="0dp"
42
+ android:layout_height="wrap_content"
43
+ android:layout_gravity="end"
44
+ android:layout_weight="1"
45
+ android:layerType="hardware" />
46
+
47
+ <org.readium.r2.navigator.R2BasicWebView
48
+ android:id="@+id/secondWebView"
49
+ android:layout_width="0dp"
50
+ android:layout_height="wrap_content"
51
+ android:layout_gravity="start"
52
+ android:layout_weight="1"
53
+ android:layerType="hardware" />
54
+
55
+ </LinearLayout>
56
+ </RelativeLayout>
57
+ </ScrollView>
58
+ </org.readium.r2.navigator.epub.fxl.R2FXLLayout>
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!--
2
+ FIXME: this was imported from `kotlin-toolkit/readium/navigator/src/main/res/layout@v2.2.1`.
3
+ Not sure why it's not being imported from readium-navigator, but if its not here
4
+ the android build throws an error due to UserSettings.kt#updateViewCSS
5
+
6
+
7
+ ~ Module: r2-navigator-kotlin
8
+ ~ Developers: Aferdita Muriqi
9
+ ~
10
+ ~ Copyright (c) 2018. Readium Foundation. All rights reserved.
11
+ ~ Use of this source code is governed by a BSD-style license which is detailed in the
12
+ ~ LICENSE file present in the project repository where this source code is maintained.
13
+ -->
14
+
15
+ <org.readium.r2.navigator.epub.fxl.R2FXLLayout xmlns:android="http://schemas.android.com/apk/res/android"
16
+ xmlns:tools="http://schemas.android.com/tools"
17
+ android:id="@+id/r2FXLLayout"
18
+ android:layout_width="match_parent"
19
+ android:layout_height="match_parent">
20
+
21
+ <ScrollView
22
+ android:layout_width="match_parent"
23
+ android:layout_height="match_parent"
24
+ android:fillViewport="true"
25
+ android:scrollbars="none">
26
+
27
+ <RelativeLayout
28
+ android:layout_width="match_parent"
29
+ android:layout_height="wrap_content"
30
+ android:layout_gravity="center">
31
+
32
+ <LinearLayout
33
+ android:layout_width="wrap_content"
34
+ android:layout_height="wrap_content"
35
+ android:layout_centerInParent="true"
36
+ android:gravity="center_horizontal"
37
+ android:orientation="horizontal"
38
+ tools:ignore="UselessParent">
39
+
40
+ <org.readium.r2.navigator.R2BasicWebView
41
+ android:id="@+id/webViewSingle"
42
+ android:layout_width="0dp"
43
+ android:layout_height="wrap_content"
44
+ android:layout_weight="1"
45
+ android:layerType="hardware" />
46
+
47
+ </LinearLayout>
48
+
49
+ </RelativeLayout>
50
+ </ScrollView>
51
+
52
+ </org.readium.r2.navigator.epub.fxl.R2FXLLayout>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ FIXME: this was imported from `kotlin-toolkit/readium/navigator/src/main/res/layout@v2.2.1`.
4
+ Not sure why it's not being imported from readium-navigator, but if its not here
5
+ the android build throws an error due to UserSettings.kt#updateViewCSS
6
+
7
+ ~ Module: r2-navigator-kotlin
8
+ ~ Developers: Aferdita Muriqi, Clément Baumann
9
+ ~
10
+ ~ Copyright (c) 2018. Readium Foundation. All rights reserved.
11
+ ~ Use of this source code is governed by a BSD-style license which is detailed in the
12
+ ~ LICENSE file present in the project repository where this source code is maintained.
13
+ -->
14
+
15
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
16
+ xmlns:android="http://schemas.android.com/apk/res/android"
17
+ xmlns:app="http://schemas.android.com/apk/res-auto"
18
+ android:layout_width="match_parent"
19
+ android:layout_height="match_parent"
20
+ android:orientation="vertical">
21
+
22
+ <org.readium.r2.navigator.R2WebView
23
+ android:id="@+id/webView"
24
+ android:layout_width="match_parent"
25
+ android:layout_height="match_parent"/>
26
+
27
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -1,3 +1,4 @@
1
1
  <resources>
2
2
  <string name="no_result">No result</string>
3
+ <string name="epub_navigator_tag">epub_navigator</string>
3
4
  </resources>
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { BaseReadiumViewProps } from '../interfaces';
3
- export declare type ReadiumProps = BaseReadiumViewProps;
3
+ export type ReadiumProps = BaseReadiumViewProps;
4
4
  export declare const ReadiumView: React.FC<ReadiumProps>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare const ReadiumView: React.ForwardRefExoticComponent<Pick<import("..").BaseReadiumViewProps, "onLocationChange" | "onTableOfContents" | "settings" | "file" | "location" | "style" | "height" | "width"> & React.RefAttributes<{
2
+ export declare const ReadiumView: React.ForwardRefExoticComponent<Omit<import("..").BaseReadiumViewProps, "ref"> & React.RefAttributes<{
3
3
  nextPage: () => void;
4
4
  prevPage: () => void;
5
5
  }>>;
@@ -27,15 +27,22 @@ export const ReadiumView = React.forwardRef(({ file, settings, location, onLocat
27
27
  if (width)
28
28
  mainStyle.width = width;
29
29
  return (<View style={styles.container}>
30
- {!reader && <div style={styles.loader}>Loading reader...</div>}
30
+ {!reader && <div style={loaderStyle}>Loading reader...</div>}
31
31
  <div id="D2Reader-Container" style={styles.d2Container}>
32
32
  <main style={mainStyle} tabIndex={-1} id="iframe-wrapper">
33
- <div id="reader-loading" className="loading" style={styles.loader}></div>
33
+ <div id="reader-loading" className="loading" style={loaderStyle}></div>
34
34
  <div id="reader-error" className="error"></div>
35
35
  </main>
36
36
  </div>
37
37
  </View>);
38
38
  });
39
+ const loaderStyle = {
40
+ width: '100%',
41
+ height: '100%',
42
+ textAlign: 'center',
43
+ position: 'relative',
44
+ top: 'calc(50% - 10px)',
45
+ };
39
46
  const styles = StyleSheet.create({
40
47
  container: {
41
48
  width: '100%',
@@ -51,17 +58,4 @@ const styles = StyleSheet.create({
51
58
  height: '100%',
52
59
  display: 'flex',
53
60
  },
54
- button: {
55
- width: 50,
56
- fontSize: 100,
57
- backgroundColor: 'transparent',
58
- border: 'none',
59
- },
60
- loader: {
61
- width: '100%',
62
- height: '100%',
63
- textAlign: 'center',
64
- position: 'relative',
65
- top: 'calc(50% - 10px)',
66
- },
67
61
  });
@@ -3,7 +3,7 @@ import type { Settings } from './Settings';
3
3
  import type { Link } from './Link';
4
4
  import type { Locator } from './Locator';
5
5
  import type { File } from './File';
6
- export declare type BaseReadiumViewProps = {
6
+ export type BaseReadiumViewProps = {
7
7
  file: File;
8
8
  location?: Locator | Link;
9
9
  settings?: Partial<Settings>;
@@ -1,2 +1,2 @@
1
1
  import type { Link, Locator } from '../../src/interfaces';
2
- export declare const useLocationObserver: (reader?: import("@d-i-t-a/reader").default | null | undefined, location?: Link | Locator | null | undefined) => void;
2
+ export declare const useLocationObserver: (reader?: D2Reader | null, location?: Link | Locator | null) => void;
@@ -1,2 +1,2 @@
1
1
  import type { Settings } from '../../src/interfaces';
2
- export declare const useSettingsObserver: (reader?: import("@d-i-t-a/reader").default | null | undefined, settings?: Partial<Settings> | null | undefined) => void;
2
+ export declare const useSettingsObserver: (reader?: D2Reader | null, settings?: Partial<Settings> | null) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-readium",
3
- "version": "1.2.1",
3
+ "version": "2.0.0-rc.0",
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",
@@ -58,25 +58,29 @@
58
58
  "registry": "https://registry.npmjs.org/"
59
59
  },
60
60
  "devDependencies": {
61
- "@commitlint/config-conventional": "^11.0.0",
62
- "@react-native-community/eslint-config": "^3.2.0",
63
- "@release-it/conventional-changelog": "^2.0.0",
64
- "@types/jest": "^26.0.0",
65
- "@types/react": "^17.0.52",
66
- "@types/react-native": "^0.68",
67
- "commitlint": "^11.0.0",
61
+ "@commitlint/config-conventional": "^17.0.2",
62
+ "@evilmartians/lefthook": "^1.5.0",
63
+ "@react-native/eslint-config": "^0.73.1",
64
+ "@release-it/conventional-changelog": "^5.0.0",
65
+ "@types/jest": "^29.5.5",
66
+ "@types/react": "^18.2.44",
67
+ "commitlint": "^17.0.2",
68
68
  "conventional-changelog-cli": "^2.2.2",
69
- "eslint": "^7.2.0",
70
- "eslint-config-prettier": "^7.0.0",
71
- "eslint-plugin-prettier": "^3.1.3",
69
+ "del-cli": "^5.1.0",
70
+ "eslint": "^8.51.0",
71
+ "eslint-config-prettier": "^9.0.0",
72
+ "eslint-plugin-prettier": "^5.0.1",
72
73
  "husky": "^6.0.0",
73
- "jest": "^26.0.1",
74
+ "jest": "^29.7.0",
74
75
  "pod-install": "^0.1.0",
75
- "prettier": "^2.0.5",
76
- "react": "^18.2.0",
77
- "react-native": "^0.70.6",
78
- "release-it": "^14.2.2",
79
- "typescript": "^4.1.3"
76
+ "prettier": "^3.0.3",
77
+ "react": "18.2.0",
78
+ "react-native": "0.74.1",
79
+ "react-native-builder-bob": "^0.23.2",
80
+ "release-it": "^15.0.0",
81
+ "rimraf": "^5.0.7",
82
+ "turbo": "^1.10.7",
83
+ "typescript": "^5.2.2"
80
84
  },
81
85
  "peerDependencies": {
82
86
  "react": "*",
@@ -114,7 +118,7 @@
114
118
  "eslintConfig": {
115
119
  "root": true,
116
120
  "extends": [
117
- "@react-native-community",
121
+ "@react-native",
118
122
  "prettier"
119
123
  ],
120
124
  "rules": {
@@ -144,5 +148,10 @@
144
148
  "dependencies": {
145
149
  "@d-i-t-a/reader": "^2.1.4",
146
150
  "use-deep-compare": "^1.1.0"
147
- }
151
+ },
152
+ "engines": {
153
+ "node": ">=18"
154
+ },
155
+ "packageManager": "yarn@3.6.4",
156
+ "stableVersion": "1.2.1"
148
157
  }
@@ -51,14 +51,14 @@ export const ReadiumView = React.forwardRef<{
51
51
 
52
52
  return (
53
53
  <View style={styles.container}>
54
- {!reader && <div style={styles.loader}>Loading reader...</div>}
54
+ {!reader && <div style={loaderStyle}>Loading reader...</div>}
55
55
  <div id="D2Reader-Container" style={styles.d2Container}>
56
56
  <main
57
57
  style={mainStyle}
58
58
  tabIndex={-1}
59
59
  id="iframe-wrapper"
60
60
  >
61
- <div id="reader-loading" className="loading" style={styles.loader}></div>
61
+ <div id="reader-loading" className="loading" style={loaderStyle}></div>
62
62
  <div id="reader-error" className="error"></div>
63
63
  </main>
64
64
  </div>
@@ -66,6 +66,14 @@ export const ReadiumView = React.forwardRef<{
66
66
  );
67
67
  });
68
68
 
69
+ const loaderStyle: React.CSSProperties = {
70
+ width: '100%',
71
+ height: '100%',
72
+ textAlign: 'center',
73
+ position: 'relative',
74
+ top: 'calc(50% - 10px)',
75
+ };
76
+
69
77
  const styles = StyleSheet.create({
70
78
  container: {
71
79
  width: '100%',
@@ -81,17 +89,4 @@ const styles = StyleSheet.create({
81
89
  height: '100%',
82
90
  display: 'flex',
83
91
  },
84
- button: {
85
- width: 50,
86
- fontSize: 100,
87
- backgroundColor: 'transparent',
88
- border: 'none',
89
- },
90
- loader: {
91
- width: '100%',
92
- height: '100%',
93
- textAlign: 'center',
94
- position: 'relative',
95
- top: 'calc(50% - 10px)',
96
- },
97
92
  });