Skip to content

Commit 72e31fb

Browse files
committed
refactor: remove unneeded View from user repos screen
1 parent 05b5d87 commit 72e31fb

File tree

1 file changed

+39
-41
lines changed

1 file changed

+39
-41
lines changed

src/user/screens/repository-list.screen.js

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { Component } from 'react';
33
import styled from 'styled-components/native';
44
import { connect } from 'react-redux';
55
import { bindActionCreators } from 'redux';
6-
import { FlatList, View, Dimensions } from 'react-native';
6+
import { FlatList, Dimensions } from 'react-native';
77

88
import {
99
ViewContainer,
@@ -129,48 +129,46 @@ class RepositoryList extends Component {
129129

130130
return (
131131
<ViewContainer>
132-
<View>
133-
<Header>
134-
<SearchBarWrapper>
135-
<SearchContainer>
136-
<SearchBar
137-
textColor={colors.primaryDark}
138-
textFieldBackgroundColor={colors.greyLight}
139-
showsCancelButton={searchFocus}
140-
onFocus={() => this.setState({ searchFocus: true })}
141-
onCancelButtonPress={() =>
142-
this.setState({ searchStart: false, query: '' })}
143-
onSearchButtonPress={query => {
144-
this.search(query);
145-
}}
146-
hideBackground
147-
/>
148-
</SearchContainer>
149-
</SearchBarWrapper>
150-
</Header>
151-
152-
{loading &&
153-
[...Array(searchStart ? repoCount : 10)].map(
154-
(item, index) => <LoadingRepositoryListItem key={index} /> // eslint-disable-line react/no-array-index-key
155-
)}
156-
157-
{!loading && (
158-
<ListContainer>
159-
<FlatList
160-
removeClippedSubviews={false}
161-
data={this.getList()}
162-
keyExtractor={this.keyExtractor}
163-
renderItem={({ item }) => (
164-
<RepositoryListItem
165-
repository={item}
166-
showFullName={authUser.login !== item.owner.login}
167-
navigation={navigation}
168-
/>
169-
)}
132+
<Header>
133+
<SearchBarWrapper>
134+
<SearchContainer>
135+
<SearchBar
136+
textColor={colors.primaryDark}
137+
textFieldBackgroundColor={colors.greyLight}
138+
showsCancelButton={searchFocus}
139+
onFocus={() => this.setState({ searchFocus: true })}
140+
onCancelButtonPress={() =>
141+
this.setState({ searchStart: false, query: '' })}
142+
onSearchButtonPress={query => {
143+
this.search(query);
144+
}}
145+
hideBackground
170146
/>
171-
</ListContainer>
147+
</SearchContainer>
148+
</SearchBarWrapper>
149+
</Header>
150+
151+
{loading &&
152+
[...Array(searchStart ? repoCount : 10)].map(
153+
(item, index) => <LoadingRepositoryListItem key={index} /> // eslint-disable-line react/no-array-index-key
172154
)}
173-
</View>
155+
156+
{!loading && (
157+
<ListContainer>
158+
<FlatList
159+
removeClippedSubviews={false}
160+
data={this.getList()}
161+
keyExtractor={this.keyExtractor}
162+
renderItem={({ item }) => (
163+
<RepositoryListItem
164+
repository={item}
165+
showFullName={authUser.login !== item.owner.login}
166+
navigation={navigation}
167+
/>
168+
)}
169+
/>
170+
</ListContainer>
171+
)}
174172
</ViewContainer>
175173
);
176174
}

0 commit comments

Comments
 (0)