@june24/expo-pdf-reader 0.1.24 → 0.1.25
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 +50 -50
- package/android/build.gradle +24 -24
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/expo/modules/pdfreader/ExpoPdfReaderModule.kt +53 -53
- package/android/src/main/java/expo/modules/pdfreader/ExpoPdfReaderView.kt +1555 -1289
- package/build/ExpoPdfReader.types.js.map +1 -1
- package/build/ExpoPdfReaderView.js.map +1 -1
- package/build/index.js.map +1 -1
- package/expo-module.config.json +16 -16
- package/ios/ExpoPdfReader.podspec +27 -27
- package/ios/ExpoPdfReaderModule.swift +68 -68
- package/ios/ExpoPdfReaderView.swift +1072 -1057
- package/package.json +39 -39
- package/src/ExpoPdfReader.types.ts +49 -49
- package/src/ExpoPdfReaderView.tsx +17 -17
- package/src/index.ts +11 -11
- package/tsconfig.json +9 -9
package/README.md
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# expo-pdf-reader
|
|
2
|
-
|
|
3
|
-
A PDF reader for Expo.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install expo-pdf-reader
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
import { StyleSheet, View } from 'react-native';
|
|
15
|
-
import { ExpoPdfReaderView } from 'expo-pdf-reader';
|
|
16
|
-
|
|
17
|
-
export default function App() {
|
|
18
|
-
return (
|
|
19
|
-
<View style={styles.container}>
|
|
20
|
-
<ExpoPdfReaderView
|
|
21
|
-
style={styles.pdf}
|
|
22
|
-
url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
|
|
23
|
-
/>
|
|
24
|
-
</View>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
container: {
|
|
30
|
-
flex: 1,
|
|
31
|
-
backgroundColor: '#fff',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
},
|
|
35
|
-
pdf: {
|
|
36
|
-
flex: 1,
|
|
37
|
-
width: '100%',
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Configuration
|
|
43
|
-
|
|
44
|
-
### Android
|
|
45
|
-
|
|
46
|
-
No additional configuration required.
|
|
47
|
-
|
|
48
|
-
### iOS
|
|
49
|
-
|
|
50
|
-
No additional configuration required.
|
|
1
|
+
# expo-pdf-reader
|
|
2
|
+
|
|
3
|
+
A PDF reader for Expo.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install expo-pdf-reader
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { StyleSheet, View } from 'react-native';
|
|
15
|
+
import { ExpoPdfReaderView } from 'expo-pdf-reader';
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
return (
|
|
19
|
+
<View style={styles.container}>
|
|
20
|
+
<ExpoPdfReaderView
|
|
21
|
+
style={styles.pdf}
|
|
22
|
+
url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
|
|
23
|
+
/>
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
flex: 1,
|
|
31
|
+
backgroundColor: '#fff',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
},
|
|
35
|
+
pdf: {
|
|
36
|
+
flex: 1,
|
|
37
|
+
width: '100%',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
### Android
|
|
45
|
+
|
|
46
|
+
No additional configuration required.
|
|
47
|
+
|
|
48
|
+
### iOS
|
|
49
|
+
|
|
50
|
+
No additional configuration required.
|
package/android/build.gradle
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
|
|
4
|
-
group = 'expo.modules.pdfreader'
|
|
5
|
-
version = '0.1.3'
|
|
6
|
-
|
|
7
|
-
android {
|
|
8
|
-
compileSdkVersion 36
|
|
9
|
-
defaultConfig {
|
|
10
|
-
minSdkVersion 24
|
|
11
|
-
targetSdkVersion 36
|
|
12
|
-
versionCode 1
|
|
13
|
-
versionName "0.1.3"
|
|
14
|
-
}
|
|
15
|
-
lintOptions {
|
|
16
|
-
abortOnError false
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
dependencies {
|
|
21
|
-
implementation project(':expo-modules-core')
|
|
22
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.2.0"
|
|
23
|
-
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
|
24
|
-
}
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
group = 'expo.modules.pdfreader'
|
|
5
|
+
version = '0.1.3'
|
|
6
|
+
|
|
7
|
+
android {
|
|
8
|
+
compileSdkVersion 36
|
|
9
|
+
defaultConfig {
|
|
10
|
+
minSdkVersion 24
|
|
11
|
+
targetSdkVersion 36
|
|
12
|
+
versionCode 1
|
|
13
|
+
versionName "0.1.3"
|
|
14
|
+
}
|
|
15
|
+
lintOptions {
|
|
16
|
+
abortOnError false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dependencies {
|
|
21
|
+
implementation project(':expo-modules-core')
|
|
22
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.2.0"
|
|
23
|
+
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
|
24
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<manifest package="expo.modules.pdfreader">
|
|
2
|
-
</manifest>
|
|
1
|
+
<manifest package="expo.modules.pdfreader">
|
|
2
|
+
</manifest>
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
package expo.modules.pdfreader
|
|
2
|
-
|
|
3
|
-
import expo.modules.kotlin.modules.Module
|
|
4
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
-
|
|
6
|
-
class ExpoPdfReaderModule : Module() {
|
|
7
|
-
override fun definition() = ModuleDefinition {
|
|
8
|
-
Name("ExpoPdfReader")
|
|
9
|
-
|
|
10
|
-
View(ExpoPdfReaderView::class) {
|
|
11
|
-
Events(
|
|
12
|
-
"onReady",
|
|
13
|
-
"onPageChange",
|
|
14
|
-
"onAnnotationChange",
|
|
15
|
-
"onUndoRedoStateChange",
|
|
16
|
-
"onNotePress",
|
|
17
|
-
"onTextPress"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// ── Props ──────────────────────────────────────────────────────────────
|
|
21
|
-
Prop("url") { view: ExpoPdfReaderView, url: String? -> view.setUrl(url) }
|
|
22
|
-
Prop("displayMode") { view: ExpoPdfReaderView, mode: String? -> view.setDisplayMode(mode) }
|
|
23
|
-
Prop("initialPage") { view: ExpoPdfReaderView, page: Int? -> page?.let { view.setInitialPage(it) } }
|
|
24
|
-
Prop("minZoom") { view: ExpoPdfReaderView, v: Double? -> v?.let { view.setMinZoom(it) } }
|
|
25
|
-
Prop("maxZoom") { view: ExpoPdfReaderView, v: Double? -> v?.let { view.setMaxZoom(it) } }
|
|
26
|
-
Prop("tool") { view: ExpoPdfReaderView, tool: String? -> view.setTool(tool) }
|
|
27
|
-
Prop("strokeColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setStrokeColor(it) } }
|
|
28
|
-
Prop("strokeWidth") { view: ExpoPdfReaderView, w: Double? -> w?.let { view.setStrokeWidth(it) } }
|
|
29
|
-
Prop("textContent") { view: ExpoPdfReaderView, t: String? -> t?.let { view.setTextContent(it) } }
|
|
30
|
-
Prop("textColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setTextColor(it) } }
|
|
31
|
-
Prop("textFontSize") { view: ExpoPdfReaderView, size: Double? -> size?.let { view.setTextFontSize(it) } }
|
|
32
|
-
Prop("textBold") { view: ExpoPdfReaderView, v: Boolean? -> v?.let { view.setTextBold(it) } }
|
|
33
|
-
Prop("textItalic") { view: ExpoPdfReaderView, v: Boolean? -> v?.let { view.setTextItalic(it) } }
|
|
34
|
-
Prop("noteColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setNoteColor(it) } }
|
|
35
|
-
Prop("initialAnnotations") { view: ExpoPdfReaderView, annotations: List<Map<String, Any?>>? ->
|
|
36
|
-
annotations?.let { view.setAnnotations(it) }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// ── Commands (AsyncFunction) ───────────────────────────────────────────
|
|
40
|
-
AsyncFunction("undo") { view: ExpoPdfReaderView -> view.undo() }
|
|
41
|
-
AsyncFunction("redo") { view: ExpoPdfReaderView -> view.redo() }
|
|
42
|
-
AsyncFunction("setInitialPage") { view: ExpoPdfReaderView, page: Int ->
|
|
43
|
-
view.setInitialPage(page)
|
|
44
|
-
}
|
|
45
|
-
AsyncFunction("updateNote") { view: ExpoPdfReaderView, page: Int, index: Int, contents: String ->
|
|
46
|
-
view.updateNote(page, index, contents)
|
|
47
|
-
}
|
|
48
|
-
AsyncFunction("updateText") { view: ExpoPdfReaderView, page: Int, index: Int, contents: String ->
|
|
49
|
-
view.updateText(page, index, contents)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
package expo.modules.pdfreader
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.modules.Module
|
|
4
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
+
|
|
6
|
+
class ExpoPdfReaderModule : Module() {
|
|
7
|
+
override fun definition() = ModuleDefinition {
|
|
8
|
+
Name("ExpoPdfReader")
|
|
9
|
+
|
|
10
|
+
View(ExpoPdfReaderView::class) {
|
|
11
|
+
Events(
|
|
12
|
+
"onReady",
|
|
13
|
+
"onPageChange",
|
|
14
|
+
"onAnnotationChange",
|
|
15
|
+
"onUndoRedoStateChange",
|
|
16
|
+
"onNotePress",
|
|
17
|
+
"onTextPress"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
// ── Props ──────────────────────────────────────────────────────────────
|
|
21
|
+
Prop("url") { view: ExpoPdfReaderView, url: String? -> view.setUrl(url) }
|
|
22
|
+
Prop("displayMode") { view: ExpoPdfReaderView, mode: String? -> view.setDisplayMode(mode) }
|
|
23
|
+
Prop("initialPage") { view: ExpoPdfReaderView, page: Int? -> page?.let { view.setInitialPage(it) } }
|
|
24
|
+
Prop("minZoom") { view: ExpoPdfReaderView, v: Double? -> v?.let { view.setMinZoom(it) } }
|
|
25
|
+
Prop("maxZoom") { view: ExpoPdfReaderView, v: Double? -> v?.let { view.setMaxZoom(it) } }
|
|
26
|
+
Prop("tool") { view: ExpoPdfReaderView, tool: String? -> view.setTool(tool) }
|
|
27
|
+
Prop("strokeColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setStrokeColor(it) } }
|
|
28
|
+
Prop("strokeWidth") { view: ExpoPdfReaderView, w: Double? -> w?.let { view.setStrokeWidth(it) } }
|
|
29
|
+
Prop("textContent") { view: ExpoPdfReaderView, t: String? -> t?.let { view.setTextContent(it) } }
|
|
30
|
+
Prop("textColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setTextColor(it) } }
|
|
31
|
+
Prop("textFontSize") { view: ExpoPdfReaderView, size: Double? -> size?.let { view.setTextFontSize(it) } }
|
|
32
|
+
Prop("textBold") { view: ExpoPdfReaderView, v: Boolean? -> v?.let { view.setTextBold(it) } }
|
|
33
|
+
Prop("textItalic") { view: ExpoPdfReaderView, v: Boolean? -> v?.let { view.setTextItalic(it) } }
|
|
34
|
+
Prop("noteColor") { view: ExpoPdfReaderView, color: String? -> color?.let { view.setNoteColor(it) } }
|
|
35
|
+
Prop("initialAnnotations") { view: ExpoPdfReaderView, annotations: List<Map<String, Any?>>? ->
|
|
36
|
+
annotations?.let { view.setAnnotations(it) }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── Commands (AsyncFunction) ───────────────────────────────────────────
|
|
40
|
+
AsyncFunction("undo") { view: ExpoPdfReaderView -> view.undo() }
|
|
41
|
+
AsyncFunction("redo") { view: ExpoPdfReaderView -> view.redo() }
|
|
42
|
+
AsyncFunction("setInitialPage") { view: ExpoPdfReaderView, page: Int ->
|
|
43
|
+
view.setInitialPage(page)
|
|
44
|
+
}
|
|
45
|
+
AsyncFunction("updateNote") { view: ExpoPdfReaderView, page: Int, index: Int, contents: String ->
|
|
46
|
+
view.updateNote(page, index, contents)
|
|
47
|
+
}
|
|
48
|
+
AsyncFunction("updateText") { view: ExpoPdfReaderView, page: Int, index: Int, contents: String ->
|
|
49
|
+
view.updateText(page, index, contents)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|