From 04723420f13a4f5aac911f3608a2d2f388293baa Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Thu, 24 Oct 2019 19:07:05 -0400 Subject: [PATCH] (fix): render w/o errors (stray strings, NaN aspect ratio) - never got these errors before the upgrade - one error was text outside of a Text element - oddly enough, narrowed these down to the existence checks before rendering an element - made them strictly bools - another was aspectRatio being NaN initialy due to 0/0 defaults - set them to null default instead and added them to existence checks before rendering the image --- components/chapterList.js | 2 +- components/pageList.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/chapterList.js b/components/chapterList.js index 9514109..8ece8f1 100644 --- a/components/chapterList.js +++ b/components/chapterList.js @@ -43,7 +43,7 @@ export default class ChapterList extends React.Component { {manga.title.toUpperCase()} - {manga.tags.length && + {manga.tags.length > 0 && {manga.tags.join(', ').toUpperCase()} } diff --git a/components/pageList.js b/components/pageList.js index 1a7fb75..6dab31a 100644 --- a/components/pageList.js +++ b/components/pageList.js @@ -97,8 +97,8 @@ export default class PageList extends React.Component { class Page extends React.PureComponent { state = { image: null, - imageWidth: 0, - imageHeight: 0 + imageWidth: null, + imageHeight: null } componentWillMount () { @@ -114,6 +114,8 @@ class Page extends React.PureComponent { render () { const { toggleNav } = this.props const { image, imageWidth, imageHeight } = this.state + const canRender = image && Number.isInteger(imageWidth) && + Number.isInteger(imageHeight) const { height, width } = Dimensions.get('window') // aspectRatio will be > 1, so set width instead of height @@ -124,7 +126,7 @@ class Page extends React.PureComponent { ...styles.page, ...{ height, width } }}> - {image &&