Skip to content

Commit e994240

Browse files
machourHoussein Djirdeh
authored andcommitted
fix: reintroduce View to avoid list being cropped (#695)
1 parent 7486649 commit e994240

File tree

1 file changed

+41
-39
lines changed

1 file changed

+41
-39
lines changed

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

Lines changed: 41 additions & 39 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, Dimensions } from 'react-native';
6+
import { View, FlatList, Dimensions } from 'react-native';
77

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

130130
return (
131131
<ViewContainer>
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
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+
)}
146170
/>
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
171+
</ListContainer>
154172
)}
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-
)}
173+
</View>
172174
</ViewContainer>
173175
);
174176
}

0 commit comments

Comments
 (0)