react-native-readium 3.0.0 → 3.0.1

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
@@ -53,6 +53,8 @@ allows you to do things like:
53
53
  1. **iOS**: Requires an iOS target >= `13.0` (see the iOS section for more details).
54
54
  2. **Android**: Requires `compileSdkVersion` >= `31` (see the Android section for more details).
55
55
 
56
+ :warning: This library does not current support `newArch`. Please disable `newArch` if you intend to use it. PR's welcome.
57
+
56
58
  #### Install Module
57
59
 
58
60
  **NPM**
@@ -114,7 +114,9 @@ class ReadiumViewManager(
114
114
 
115
115
  @ReactProp(name = "settings")
116
116
  fun setSettings(view: ReadiumView, settings: ReadableMap) {
117
- view.updateSettingsFromMap(settings.toHashMap())
117
+ val map = mutableMapOf<String, Any>()
118
+ settings.toHashMap().forEach { (key, value) -> if (value != null) map[key] = value }
119
+ view.updateSettingsFromMap(map)
118
120
  }
119
121
 
120
122
  @ReactPropGroup(names = ["width", "height"], customType = "Style")
@@ -1,4 +1,4 @@
1
- import { requireNativeComponent, UIManager, } from 'react-native';
1
+ import { requireNativeComponent, UIManager } from 'react-native';
2
2
  import { COMPONENT_NAME, LINKING_ERROR } from '../utils';
3
3
  export const BaseReadiumView = UIManager.getViewManagerConfig(COMPONENT_NAME) != null
4
4
  ? requireNativeComponent(COMPONENT_NAME)
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useState, useEffect, forwardRef, useRef } from 'react';
1
+ import React, { useCallback, useState, useEffect, forwardRef, useRef, } from 'react';
2
2
  import { View, Platform, findNodeHandle, StyleSheet } from 'react-native';
3
3
  import { Settings } from '../interfaces';
4
4
  import { createFragment, getWidthOrHeightValue as dimension } from '../utils';
@@ -10,7 +10,7 @@ export const ReadiumView = forwardRef(({ onLocationChange: wrappedOnLocationChan
10
10
  height: 0,
11
11
  });
12
12
  // set the view dimensions on layout
13
- const onLayout = useCallback(({ nativeEvent: { layout: { width, height } } }) => {
13
+ const onLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => {
14
14
  setDimensions({
15
15
  width: dimension(width),
16
16
  height: dimension(height),
@@ -45,8 +45,8 @@ export const ReadiumView = forwardRef(({ onLocationChange: wrappedOnLocationChan
45
45
  }
46
46
  }, [defaultRef.current !== null]);
47
47
  return (<View style={styles.container} onLayout={onLayout}>
48
- <BaseReadiumView height={height} width={width} {...props} onLocationChange={onLocationChange} onTableOfContents={onTableOfContents} settings={unmappedSettings ? Settings.map(unmappedSettings) : undefined} ref={defaultRef}/>
49
- </View>);
48
+ <BaseReadiumView height={height} width={width} {...props} onLocationChange={onLocationChange} onTableOfContents={onTableOfContents} settings={unmappedSettings ? Settings.map(unmappedSettings) : undefined} ref={defaultRef}/>
49
+ </View>);
50
50
  });
51
51
  const styles = StyleSheet.create({
52
52
  container: { width: '100%', height: '100%' },
@@ -27,14 +27,14 @@ 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={loaderStyle}>Loading reader...</div>}
31
- <div id="D2Reader-Container" style={styles.d2Container}>
32
- <main style={mainStyle} tabIndex={-1} id="iframe-wrapper">
33
- <div id="reader-loading" className="loading" style={loaderStyle}></div>
34
- <div id="reader-error" className="error"></div>
35
- </main>
36
- </div>
37
- </View>);
30
+ {!reader && <div style={loaderStyle}>Loading reader...</div>}
31
+ <div id="D2Reader-Container" style={styles.d2Container}>
32
+ <main style={mainStyle} tabIndex={-1} id="iframe-wrapper">
33
+ <div id="reader-loading" className="loading" style={loaderStyle}/>
34
+ <div id="reader-error" className="error"/>
35
+ </main>
36
+ </div>
37
+ </View>);
38
38
  });
39
39
  const loaderStyle = {
40
40
  width: '100%',
@@ -1,5 +1,5 @@
1
- import { Appearance, FontFamily, TextAlignment, ColumnCount, } from '../enums';
2
- import { RANGES, indexOfObjectValue, clamp, } from '../utils';
1
+ import { Appearance, FontFamily, TextAlignment, ColumnCount } from '../enums';
2
+ import { RANGES, indexOfObjectValue, clamp } from '../utils';
3
3
  /**
4
4
  * A reader settings object with sensible defaults.
5
5
  */
@@ -43,10 +43,10 @@ export class Settings {
43
43
  static map(settings) {
44
44
  const defaultValues = new Settings();
45
45
  const mapped = {};
46
- Object.keys(defaultValues)
47
- .forEach((key) => {
48
- // @ts-ignore
49
- mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];
46
+ Object.keys(defaultValues).forEach((key) => {
47
+ mapped[key] =
48
+ // @ts-ignore
49
+ settings[key] !== undefined ? settings[key] : defaultValues[key];
50
50
  });
51
51
  mapped.appearance = indexOfObjectValue(Appearance, mapped.appearance);
52
52
  mapped.fontFamily = indexOfObjectValue(FontFamily, mapped.fontFamily);
@@ -1,4 +1,6 @@
1
1
  import { Platform, PixelRatio } from 'react-native';
2
2
  export const getWidthOrHeightValue = (val) => {
3
- return Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(val) : val;
3
+ return Platform.OS === 'android'
4
+ ? PixelRatio.getPixelSizeForLayoutSize(val)
5
+ : val;
4
6
  };
@@ -68,18 +68,18 @@ export const useReaderRef = ({ file, onLocationChange, onTableOfContents, }) =>
68
68
  // consider bundling them with the library.
69
69
  const injectables = [
70
70
  {
71
- type: "style",
72
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css",
71
+ type: 'style',
72
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css',
73
73
  r2before: true,
74
74
  },
75
75
  {
76
- type: "style",
77
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css",
76
+ type: 'style',
77
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css',
78
78
  r2default: true,
79
79
  },
80
80
  {
81
- type: "style",
82
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css",
81
+ type: 'style',
82
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css',
83
83
  r2after: true,
84
84
  },
85
85
  ];
@@ -6,8 +6,5 @@ export const useSettingsObserver = (reader, settings) => {
6
6
  // are equivalent or not
7
7
  reader?.applyUserSettings(settings);
8
8
  }
9
- }, [
10
- settings,
11
- !!reader,
12
- ]);
9
+ }, [settings, !!reader]);
13
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-readium",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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,7 +24,8 @@
24
24
  "scripts": {
25
25
  "test": "jest",
26
26
  "typescript": "tsc --noEmit",
27
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
27
+ "lint": "eslint \"./src/**/*.{js,ts,tsx}\"",
28
+ "lint:fix": "eslint ./src --fix",
28
29
  "prepare": "rimraf lib && tsc",
29
30
  "release": "release-it",
30
31
  "example": "yarn --cwd example",
@@ -1,7 +1,4 @@
1
- import {
2
- requireNativeComponent,
3
- UIManager,
4
- } from 'react-native';
1
+ import { requireNativeComponent, UIManager } from 'react-native';
5
2
 
6
3
  import type { BaseReadiumViewProps } from '../interfaces';
7
4
  import { COMPONENT_NAME, LINKING_ERROR } from '../utils';
@@ -1 +1 @@
1
- export const BaseReadiumView = () => null
1
+ export const BaseReadiumView = () => null;
@@ -1,4 +1,10 @@
1
- import React, { useCallback, useState, useEffect, forwardRef, ForwardedRef, useRef, createRef } from 'react';
1
+ import React, {
2
+ useCallback,
3
+ useState,
4
+ useEffect,
5
+ forwardRef,
6
+ useRef,
7
+ } from 'react';
2
8
  import { View, Platform, findNodeHandle, StyleSheet } from 'react-native';
3
9
 
4
10
  import type { BaseReadiumViewProps, Dimensions } from '../interfaces';
@@ -8,74 +14,91 @@ import { BaseReadiumView } from './BaseReadiumView';
8
14
 
9
15
  export type ReadiumProps = BaseReadiumViewProps;
10
16
 
11
- export const ReadiumView: React.FC<ReadiumProps> = forwardRef(({
12
- onLocationChange: wrappedOnLocationChange,
13
- onTableOfContents: wrappedOnTableOfContents,
14
- settings: unmappedSettings,
15
- ...props
16
- }, forwardedRef) => {
17
- const defaultRef = useRef<any>(null);
18
- const [{ height, width }, setDimensions] = useState<Dimensions>({
19
- width: 0,
20
- height: 0,
21
- });
22
-
23
- // set the view dimensions on layout
24
- const onLayout = useCallback(({ nativeEvent: { layout: { width, height } }}: any) => {
25
- setDimensions({
26
- width: dimension(width),
27
- height: dimension(height),
17
+ export const ReadiumView: React.FC<ReadiumProps> = forwardRef(
18
+ (
19
+ {
20
+ onLocationChange: wrappedOnLocationChange,
21
+ onTableOfContents: wrappedOnTableOfContents,
22
+ settings: unmappedSettings,
23
+ ...props
24
+ },
25
+ forwardedRef
26
+ ) => {
27
+ const defaultRef = useRef<any>(null);
28
+ const [{ height, width }, setDimensions] = useState<Dimensions>({
29
+ width: 0,
30
+ height: 0,
28
31
  });
29
- }, []);
30
32
 
31
- // wrap the native onLocationChange and extract the raw event value
32
- const onLocationChange = useCallback((event: any) => {
33
- if (wrappedOnLocationChange) {
34
- wrappedOnLocationChange(event.nativeEvent);
35
- }
36
- }, [wrappedOnLocationChange]);
33
+ // set the view dimensions on layout
34
+ const onLayout = useCallback(
35
+ ({
36
+ nativeEvent: {
37
+ layout: { width, height },
38
+ },
39
+ }: any) => {
40
+ setDimensions({
41
+ width: dimension(width),
42
+ height: dimension(height),
43
+ });
44
+ },
45
+ []
46
+ );
37
47
 
38
- const onTableOfContents = useCallback((event: any) => {
39
- if (wrappedOnTableOfContents) {
40
- const toc = event.nativeEvent.toc || null;
41
- wrappedOnTableOfContents(toc);
42
- }
43
- }, [wrappedOnTableOfContents]);
48
+ // wrap the native onLocationChange and extract the raw event value
49
+ const onLocationChange = useCallback(
50
+ (event: any) => {
51
+ if (wrappedOnLocationChange) {
52
+ wrappedOnLocationChange(event.nativeEvent);
53
+ }
54
+ },
55
+ [wrappedOnLocationChange]
56
+ );
44
57
 
45
- // create the view fragment on android
46
- useEffect(() => {
47
- if (Platform.OS === 'android' && defaultRef.current) {
48
- const viewId = findNodeHandle(defaultRef.current);
49
- createFragment(viewId);
50
- }
51
- }, []);
58
+ const onTableOfContents = useCallback(
59
+ (event: any) => {
60
+ if (wrappedOnTableOfContents) {
61
+ const toc = event.nativeEvent.toc || null;
62
+ wrappedOnTableOfContents(toc);
63
+ }
64
+ },
65
+ [wrappedOnTableOfContents]
66
+ );
52
67
 
53
- // assign the forwarded ref
54
- useEffect(() => {
55
- if (forwardedRef && 'current' in forwardedRef) {
56
- forwardedRef.current = defaultRef.current;
57
- } else if (forwardedRef) {
58
- forwardedRef(defaultRef);
59
- }
60
- }, [defaultRef.current !== null])
68
+ // create the view fragment on android
69
+ useEffect(() => {
70
+ if (Platform.OS === 'android' && defaultRef.current) {
71
+ const viewId = findNodeHandle(defaultRef.current);
72
+ createFragment(viewId);
73
+ }
74
+ }, []);
61
75
 
62
- return (
63
- <View
64
- style={styles.container}
65
- onLayout={onLayout}
66
- >
67
- <BaseReadiumView
68
- height={height}
69
- width={width}
70
- {...props}
71
- onLocationChange={onLocationChange}
72
- onTableOfContents={onTableOfContents}
73
- settings={unmappedSettings ? Settings.map(unmappedSettings) : undefined}
74
- ref={defaultRef}
75
- />
76
- </View>
77
- );
78
- });
76
+ // assign the forwarded ref
77
+ useEffect(() => {
78
+ if (forwardedRef && 'current' in forwardedRef) {
79
+ forwardedRef.current = defaultRef.current;
80
+ } else if (forwardedRef) {
81
+ forwardedRef(defaultRef);
82
+ }
83
+ }, [defaultRef.current !== null]);
84
+
85
+ return (
86
+ <View style={styles.container} onLayout={onLayout}>
87
+ <BaseReadiumView
88
+ height={height}
89
+ width={width}
90
+ {...props}
91
+ onLocationChange={onLocationChange}
92
+ onTableOfContents={onTableOfContents}
93
+ settings={
94
+ unmappedSettings ? Settings.map(unmappedSettings) : undefined
95
+ }
96
+ ref={defaultRef}
97
+ />
98
+ </View>
99
+ );
100
+ }
101
+ );
79
102
 
80
103
  const styles = StyleSheet.create({
81
104
  container: { width: '100%', height: '100%' },
@@ -9,62 +9,66 @@ import {
9
9
  useLocationObserver,
10
10
  } from '../../web/hooks';
11
11
 
12
- export const ReadiumView = React.forwardRef<{
13
- nextPage: () => void;
14
- prevPage: () => void;
15
- }, ReadiumProps>(({
16
- file,
17
- settings,
18
- location,
19
- onLocationChange,
20
- onTableOfContents,
21
- style = {},
22
- height,
23
- width,
24
- }, ref) => {
25
- const readerRef = useReaderRef({
26
- file,
27
- onLocationChange,
28
- onTableOfContents,
29
- });
30
- const reader = readerRef.current;
31
-
32
- useImperativeHandle(ref, () => ({
33
- nextPage: () => {
34
- readerRef.current?.nextPage();
35
- },
36
- prevPage: () => {
37
- readerRef.current?.previousPage();
12
+ export const ReadiumView = React.forwardRef<
13
+ {
14
+ nextPage: () => void;
15
+ prevPage: () => void;
16
+ },
17
+ ReadiumProps
18
+ >(
19
+ (
20
+ {
21
+ file,
22
+ settings,
23
+ location,
24
+ onLocationChange,
25
+ onTableOfContents,
26
+ style = {},
27
+ height,
28
+ width,
38
29
  },
39
- }));
30
+ ref
31
+ ) => {
32
+ const readerRef = useReaderRef({
33
+ file,
34
+ onLocationChange,
35
+ onTableOfContents,
36
+ });
37
+ const reader = readerRef.current;
40
38
 
41
- useSettingsObserver(reader, settings);
42
- useLocationObserver(reader, location);
39
+ useImperativeHandle(ref, () => ({
40
+ nextPage: () => {
41
+ readerRef.current?.nextPage();
42
+ },
43
+ prevPage: () => {
44
+ readerRef.current?.previousPage();
45
+ },
46
+ }));
43
47
 
44
- const mainStyle = {
45
- ...styles.maximize,
46
- ...(style as CSSProperties),
47
- };
48
+ useSettingsObserver(reader, settings);
49
+ useLocationObserver(reader, location);
48
50
 
49
- if (height) mainStyle.height = height;
50
- if (width) mainStyle.width = width;
51
+ const mainStyle = {
52
+ ...styles.maximize,
53
+ ...(style as CSSProperties),
54
+ };
51
55
 
52
- return (
53
- <View style={styles.container}>
54
- {!reader && <div style={loaderStyle}>Loading reader...</div>}
55
- <div id="D2Reader-Container" style={styles.d2Container}>
56
- <main
57
- style={mainStyle}
58
- tabIndex={-1}
59
- id="iframe-wrapper"
60
- >
61
- <div id="reader-loading" className="loading" style={loaderStyle}></div>
62
- <div id="reader-error" className="error"></div>
63
- </main>
64
- </div>
65
- </View>
66
- );
67
- });
56
+ if (height) mainStyle.height = height;
57
+ if (width) mainStyle.width = width;
58
+
59
+ return (
60
+ <View style={styles.container}>
61
+ {!reader && <div style={loaderStyle}>Loading reader...</div>}
62
+ <div id="D2Reader-Container" style={styles.d2Container}>
63
+ <main style={mainStyle} tabIndex={-1} id="iframe-wrapper">
64
+ <div id="reader-loading" className="loading" style={loaderStyle} />
65
+ <div id="reader-error" className="error" />
66
+ </main>
67
+ </div>
68
+ </View>
69
+ );
70
+ }
71
+ );
68
72
 
69
73
  const loaderStyle: React.CSSProperties = {
70
74
  width: '100%',
@@ -1,7 +1,6 @@
1
1
  import type { Link } from './Link';
2
2
  import type { Locator } from './Locator';
3
3
 
4
-
5
4
  export interface File {
6
5
  /**
7
6
  * A string path to an eBook on disk.
@@ -1,15 +1,6 @@
1
- import {
2
- Appearance,
3
- FontFamily,
4
- TextAlignment,
5
- ColumnCount,
6
- } from '../enums';
1
+ import { Appearance, FontFamily, TextAlignment, ColumnCount } from '../enums';
7
2
 
8
- import {
9
- RANGES,
10
- indexOfObjectValue,
11
- clamp,
12
- } from '../utils';
3
+ import { RANGES, indexOfObjectValue, clamp } from '../utils';
13
4
 
14
5
  /**
15
6
  * A reader settings object with sensible defaults.
@@ -63,12 +54,11 @@ export class Settings {
63
54
  const defaultValues = new Settings();
64
55
  const mapped: Record<string, any> = {};
65
56
 
66
- Object.keys(defaultValues)
67
- .forEach((key: string) => {
57
+ Object.keys(defaultValues).forEach((key: string) => {
58
+ mapped[key] =
68
59
  // @ts-ignore
69
- mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];
70
- })
71
- ;
60
+ settings[key] !== undefined ? settings[key] : defaultValues[key];
61
+ });
72
62
 
73
63
  mapped.appearance = indexOfObjectValue(Appearance, mapped.appearance);
74
64
  mapped.fontFamily = indexOfObjectValue(FontFamily, mapped.fontFamily);
@@ -1,8 +1,8 @@
1
1
  export const RANGES = {
2
- fontSize: [100.0, 300.0],
3
- wordSpacing: [0.0, 0.5],
4
- letterSpacing: [0.0, 0.5],
5
- pageMargins: [0.5, 4.0],
6
- lineHeight: [1.0, 2.0],
2
+ fontSize: [100.0, 300.0],
3
+ wordSpacing: [0.0, 0.5],
4
+ letterSpacing: [0.0, 0.5],
5
+ pageMargins: [0.5, 4.0],
6
+ lineHeight: [1.0, 2.0],
7
7
  paragraphMargins: [0.0, 2.0],
8
8
  };
@@ -2,4 +2,4 @@ export const clamp = (val: number, lower: number, upper: number): number => {
2
2
  if (val < lower) return lower;
3
3
  if (val > upper) return upper;
4
4
  return val;
5
- }
5
+ };
@@ -9,7 +9,7 @@ export const createFragment = (viewId: number | null) => {
9
9
  // we are calling the 'create' command
10
10
  // @ts-ignore
11
11
  UIManager.getViewManagerConfig(COMPONENT_NAME).Commands.create.toString(),
12
- [viewId],
12
+ [viewId]
13
13
  );
14
14
  }
15
- }
15
+ };
@@ -1,5 +1,7 @@
1
1
  import { Platform, PixelRatio } from 'react-native';
2
2
 
3
3
  export const getWidthOrHeightValue = (val: number) => {
4
- return Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(val) : val;
5
- }
4
+ return Platform.OS === 'android'
5
+ ? PixelRatio.getPixelSizeForLayoutSize(val)
6
+ : val;
7
+ };
@@ -1,3 +1,3 @@
1
1
  export const indexOfObjectValue = (obj: any, val: any): number => {
2
2
  return Object.values(obj).indexOf(val);
3
- }
3
+ };
@@ -4,7 +4,7 @@ import type { Link, Locator } from '../../src/interfaces';
4
4
 
5
5
  export const useLocationObserver = (
6
6
  reader?: D2Reader | null,
7
- location?: Link | Locator | null,
7
+ location?: Link | Locator | null
8
8
  ) => {
9
9
  useDeepCompareEffect(() => {
10
10
  if (reader && location) {
@@ -7,7 +7,7 @@ export const useReaderRef = ({
7
7
  file,
8
8
  onLocationChange,
9
9
  onTableOfContents,
10
- }: Pick<ReadiumProps, 'file' | 'onLocationChange' | 'onTableOfContents' >) => {
10
+ }: Pick<ReadiumProps, 'file' | 'onLocationChange' | 'onTableOfContents'>) => {
11
11
  const readerRef = useRef<D2Reader | null>(null);
12
12
  const readingOrder = useRef<Locator[]>([]);
13
13
 
@@ -84,7 +84,7 @@ export const useReaderRef = ({
84
84
  run();
85
85
  }, [file.url]);
86
86
 
87
- return readerRef
87
+ return readerRef;
88
88
  };
89
89
 
90
90
  // NOTE: right now we're serving these through statically.io, which is just
@@ -92,19 +92,18 @@ export const useReaderRef = ({
92
92
  // consider bundling them with the library.
93
93
  const injectables: any[] = [
94
94
  {
95
- type: "style",
96
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css",
95
+ type: 'style',
96
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css',
97
97
  r2before: true,
98
98
  },
99
99
  {
100
- type: "style",
101
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css",
100
+ type: 'style',
101
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css',
102
102
  r2default: true,
103
103
  },
104
104
  {
105
- type: "style",
106
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css",
105
+ type: 'style',
106
+ url: 'https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css',
107
107
  r2after: true,
108
108
  },
109
109
  ];
110
-
@@ -4,7 +4,7 @@ import type { Settings } from '../../src/interfaces';
4
4
 
5
5
  export const useSettingsObserver = (
6
6
  reader?: D2Reader | null,
7
- settings?: Partial<Settings> | null,
7
+ settings?: Partial<Settings> | null
8
8
  ) => {
9
9
  useDeepCompareEffect(() => {
10
10
  if (reader && settings) {
@@ -12,8 +12,5 @@ export const useSettingsObserver = (
12
12
  // are equivalent or not
13
13
  reader?.applyUserSettings(settings as Partial<D2UserSettings>);
14
14
  }
15
- }, [
16
- settings,
17
- !!reader,
18
- ]);
15
+ }, [settings, !!reader]);
19
16
  };