#3 Fix doesn't re-rerendering bug
Fixed a bug where re-rendering would not work when options and styles were changed.main
parent
73f2b9d98b
commit
7dae8d3fbe
5 changed files with 160 additions and 126 deletions
@ -1,14 +1,14 @@ |
|||||||
html, body { |
html, |
||||||
padding: 0; |
body { |
||||||
margin: 0; |
padding: 0; |
||||||
} |
margin: 0; |
||||||
|
width: 100vw; |
||||||
html { |
height: 100vh; |
||||||
width: 100vw; |
|
||||||
height: 100vh; |
|
||||||
} |
} |
||||||
|
|
||||||
#root { |
#root { |
||||||
width: 100%; |
height: 100%; |
||||||
height: 100%; |
display: flex; |
||||||
} |
align-items: center; |
||||||
|
justify-content: center; |
||||||
|
} |
||||||
|
@ -1,20 +1,35 @@ |
|||||||
import { useRef } from 'react' |
import { useRef } from 'react' |
||||||
import ReactDOM from 'react-dom'; |
import ReactDOM from 'react-dom'; |
||||||
|
import EpubViewer from 'modules/epubViewer/EpubViewer' |
||||||
import ReactEpubViewer from 'modules/reactViewer/ReactViewer' |
import ReactEpubViewer from 'modules/reactViewer/ReactViewer' |
||||||
import { ViewerRef } from 'types' |
import { ViewerRef } from 'types' |
||||||
|
|
||||||
|
interface Props { |
||||||
|
VIEWER_TYPE?: "ReactViewer" | "EpubViewer" |
||||||
|
}
|
||||||
|
|
||||||
const App = () => { |
const App = ({ VIEWER_TYPE = "ReactViewer" }: Props) => { |
||||||
const EPUB_URL = "/react-epub-viewer/files/Alices Adventures in Wonderland.epub"; |
const EPUB_URL = "/react-epub-viewer/files/Alices Adventures in Wonderland.epub"; |
||||||
const ref = useRef<ViewerRef>(null); |
const ref = useRef<ViewerRef>(null); |
||||||
|
|
||||||
return ( |
return ( |
||||||
<ReactEpubViewer
|
<> |
||||||
url={EPUB_URL} |
{VIEWER_TYPE === "ReactViewer" && <> |
||||||
ref={ref} |
<ReactEpubViewer
|
||||||
/> |
url={EPUB_URL} |
||||||
|
ref={ref} |
||||||
|
/> |
||||||
|
</> |
||||||
|
} |
||||||
|
{VIEWER_TYPE === "EpubViewer" && <> |
||||||
|
<EpubViewer
|
||||||
|
url={EPUB_URL} |
||||||
|
ref={ref} |
||||||
|
/> |
||||||
|
</> |
||||||
|
} |
||||||
|
</> |
||||||
); |
); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root')); |
ReactDOM.render(<App />, document.getElementById('root')); |
Loading…
Reference in new issue