Skip to content

Commit 4272a3e

Browse files
committed
add support for disabling thumbnails on the news views
1 parent 95c23d5 commit 4272a3e

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

source/views/news/news-container.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Props = TopLevelViewPropsType & {
1515
url: string,
1616
query?: Object,
1717
mode: 'rss' | 'wp-json',
18-
thumbnail: number,
18+
thumbnail: false | number,
1919
}
2020

2121
type State = {

source/views/news/news-list.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ type Props = TopLevelViewPropsType & {
2020
onRefresh: () => any,
2121
entries: StoryType[],
2222
loading: boolean,
23-
thumbnail: number,
23+
thumbnail: false | number,
2424
}
2525

2626
export class NewsList extends React.PureComponent<Props> {
2727
onPressNews = (url: string) => {
2828
return openUrl(url)
2929
}
3030

31-
renderSeparator = () => <ListSeparator spacing={{left: 101}} />
31+
renderSeparator = () => (
32+
<ListSeparator
33+
spacing={{left: this.props.thumbnail === false ? undefined : 101}}
34+
/>
35+
)
3236

3337
renderItem = ({item}: {item: StoryType}) => (
3438
<NewsRow

source/views/news/news-row.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {StoryType} from './types'
99
type Props = {
1010
onPress: string => any,
1111
story: StoryType,
12-
thumbnail: number,
12+
thumbnail: false | number,
1313
}
1414

1515
export class NewsRow extends React.PureComponent<Props> {
@@ -23,14 +23,19 @@ export class NewsRow extends React.PureComponent<Props> {
2323

2424
render() {
2525
const {story} = this.props
26-
const thumb = story.featuredImage
27-
? {uri: story.featuredImage}
28-
: this.props.thumbnail
26+
const thumb =
27+
this.props.thumbnail !== false
28+
? story.featuredImage
29+
? {uri: story.featuredImage}
30+
: this.props.thumbnail
31+
: null
2932

3033
return (
3134
<ListRow arrowPosition="top" onPress={this._onPress}>
3235
<Row alignItems="center">
33-
<Image source={thumb} style={styles.image} />
36+
{thumb !== null ? (
37+
<Image source={thumb} style={styles.image} />
38+
) : null}
3439
<Column flex={1}>
3540
<Title lines={2}>{story.title}</Title>
3641
<Detail lines={3}>{story.excerpt}</Detail>

0 commit comments

Comments
 (0)