#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 { |
||||
padding: 0; |
||||
margin: 0; |
||||
} |
||||
|
||||
html { |
||||
width: 100vw; |
||||
height: 100vh; |
||||
html, |
||||
body { |
||||
padding: 0; |
||||
margin: 0; |
||||
width: 100vw; |
||||
height: 100vh; |
||||
} |
||||
|
||||
#root { |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
|
@ -1,20 +1,35 @@ |
||||
import { useRef } from 'react' |
||||
import ReactDOM from 'react-dom'; |
||||
import EpubViewer from 'modules/epubViewer/EpubViewer' |
||||
import ReactEpubViewer from 'modules/reactViewer/ReactViewer' |
||||
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 ref = useRef<ViewerRef>(null); |
||||
|
||||
return ( |
||||
<ReactEpubViewer
|
||||
url={EPUB_URL} |
||||
ref={ref} |
||||
/> |
||||
<> |
||||
{VIEWER_TYPE === "ReactViewer" && <> |
||||
<ReactEpubViewer
|
||||
url={EPUB_URL} |
||||
ref={ref} |
||||
/> |
||||
</> |
||||
} |
||||
{VIEWER_TYPE === "EpubViewer" && <> |
||||
<EpubViewer
|
||||
url={EPUB_URL} |
||||
ref={ref} |
||||
/> |
||||
</> |
||||
} |
||||
</> |
||||
); |
||||
} |
||||
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root')); |
Loading…
Reference in new issue