[FIX] Use List.Separator in all places (#2931)
* [FIX] Use List.Separator in all places * add List.Separator * change List.Separator Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
98890df773
commit
bc8d6b72f5
|
@ -5,6 +5,7 @@ import {
|
||||||
View, Text, Switch, ScrollView, StyleSheet, FlatList
|
View, Text, Switch, ScrollView, StyleSheet, FlatList
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { dequal } from 'dequal';
|
import { dequal } from 'dequal';
|
||||||
|
import * as List from '../containers/List';
|
||||||
|
|
||||||
import TextInput from '../presentation/TextInput';
|
import TextInput from '../presentation/TextInput';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
|
@ -31,12 +32,6 @@ const styles = StyleSheet.create({
|
||||||
list: {
|
list: {
|
||||||
width: '100%'
|
width: '100%'
|
||||||
},
|
},
|
||||||
separator: {
|
|
||||||
marginLeft: 60
|
|
||||||
},
|
|
||||||
formSeparator: {
|
|
||||||
marginLeft: 15
|
|
||||||
},
|
|
||||||
input: {
|
input: {
|
||||||
height: 54,
|
height: 54,
|
||||||
paddingHorizontal: 18,
|
paddingHorizontal: 18,
|
||||||
|
@ -264,13 +259,6 @@ class CreateChannelView extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => <View style={[sharedStyles.separator, styles.separator]} />
|
|
||||||
|
|
||||||
renderFormSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[sharedStyles.separator, styles.formSeparator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({ item }) => {
|
renderItem = ({ item }) => {
|
||||||
const { baseUrl, user, theme } = this.props;
|
const { baseUrl, user, theme } = this.props;
|
||||||
|
|
||||||
|
@ -305,7 +293,7 @@ class CreateChannelView extends React.Component {
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
enableEmptySections
|
enableEmptySections
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
/>
|
/>
|
||||||
|
@ -341,13 +329,13 @@ class CreateChannelView extends React.Component {
|
||||||
theme={theme}
|
theme={theme}
|
||||||
underlineColorAndroid='transparent'
|
underlineColorAndroid='transparent'
|
||||||
/>
|
/>
|
||||||
{this.renderFormSeparator()}
|
<List.Separator />
|
||||||
{this.renderType()}
|
{this.renderType()}
|
||||||
{this.renderFormSeparator()}
|
<List.Separator />
|
||||||
{this.renderReadOnly()}
|
{this.renderReadOnly()}
|
||||||
{this.renderFormSeparator()}
|
<List.Separator />
|
||||||
{this.renderEncrypted()}
|
{this.renderEncrypted()}
|
||||||
{this.renderFormSeparator()}
|
<List.Separator />
|
||||||
{this.renderBroadcast()}
|
{this.renderBroadcast()}
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.invitedHeader}>
|
<View style={styles.invitedHeader}>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
View, FlatList, Text
|
View, FlatList, Text
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import * as List from '../../containers/List';
|
||||||
|
|
||||||
import Touch from '../../utils/touch';
|
import Touch from '../../utils/touch';
|
||||||
import RocketChat from '../../lib/rocketchat';
|
import RocketChat from '../../lib/rocketchat';
|
||||||
|
@ -182,11 +183,6 @@ class DirectoryView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[sharedStyles.separator, styles.separator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({ item, index }) => {
|
renderItem = ({ item, index }) => {
|
||||||
const { data, type } = this.state;
|
const { data, type } = this.state;
|
||||||
const { baseUrl, user, theme } = this.props;
|
const { baseUrl, user, theme } = this.props;
|
||||||
|
@ -251,7 +247,7 @@ class DirectoryView extends React.Component {
|
||||||
keyExtractor={item => item._id}
|
keyExtractor={item => item._id}
|
||||||
ListHeaderComponent={this.renderHeader}
|
ListHeaderComponent={this.renderHeader}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
ListFooterComponent={loading ? <ActivityIndicator theme={theme} /> : null}
|
ListFooterComponent={loading ? <ActivityIndicator theme={theme} /> : null}
|
||||||
onEndReached={() => this.load({})}
|
onEndReached={() => this.load({})}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import { Q } from '@nozbe/watermelondb';
|
import { Q } from '@nozbe/watermelondb';
|
||||||
|
import * as List from '../containers/List';
|
||||||
|
|
||||||
import Touch from '../utils/touch';
|
import Touch from '../utils/touch';
|
||||||
import database from '../lib/database';
|
import database from '../lib/database';
|
||||||
|
@ -27,9 +28,6 @@ import { goRoom } from '../utils/goRoom';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
separator: {
|
|
||||||
marginLeft: 60
|
|
||||||
},
|
|
||||||
button: {
|
button: {
|
||||||
height: 46,
|
height: 46,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
@ -195,10 +193,6 @@ class NewMessageView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[sharedStyles.separator, styles.separator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({ item, index }) => {
|
renderItem = ({ item, index }) => {
|
||||||
const { search, chats } = this.state;
|
const { search, chats } = this.state;
|
||||||
|
@ -238,7 +232,7 @@ class NewMessageView extends React.Component {
|
||||||
keyExtractor={item => item._id}
|
keyExtractor={item => item._id}
|
||||||
ListHeaderComponent={this.renderHeader}
|
ListHeaderComponent={this.renderHeader}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { FlatList, View, Text } from 'react-native';
|
||||||
import { dequal } from 'dequal';
|
import { dequal } from 'dequal';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import * as List from '../../containers/List';
|
||||||
|
|
||||||
import Avatar from '../../containers/Avatar';
|
import Avatar from '../../containers/Avatar';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
@ -121,11 +122,6 @@ class ReadReceiptView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[styles.separator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { receipts, loading } = this.state;
|
const { receipts, loading } = this.state;
|
||||||
const { theme } = this.props;
|
const { theme } = this.props;
|
||||||
|
@ -143,7 +139,7 @@ class ReadReceiptView extends React.Component {
|
||||||
<FlatList
|
<FlatList
|
||||||
data={receipts}
|
data={receipts}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
style={[
|
style={[
|
||||||
styles.list,
|
styles.list,
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FlatList, View } from 'react-native';
|
import { FlatList } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Q } from '@nozbe/watermelondb';
|
import { Q } from '@nozbe/watermelondb';
|
||||||
|
import * as List from '../../containers/List';
|
||||||
|
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
import UserItem from '../../presentation/UserItem';
|
import UserItem from '../../presentation/UserItem';
|
||||||
|
@ -419,11 +420,6 @@ class RoomMembersView extends React.Component {
|
||||||
<SearchBox onChangeText={text => this.onSearchChangeText(text)} testID='room-members-view-search' />
|
<SearchBox onChangeText={text => this.onSearchChangeText(text)} testID='room-members-view-search' />
|
||||||
)
|
)
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[styles.separator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({ item }) => {
|
renderItem = ({ item }) => {
|
||||||
const { baseUrl, user, theme } = this.props;
|
const { baseUrl, user, theme } = this.props;
|
||||||
|
|
||||||
|
@ -453,7 +449,7 @@ class RoomMembersView extends React.Component {
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
style={[styles.list, { backgroundColor: themes[theme].backgroundColor }]}
|
style={[styles.list, { backgroundColor: themes[theme].backgroundColor }]}
|
||||||
keyExtractor={item => item._id}
|
keyExtractor={item => item._id}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
ListHeaderComponent={this.renderSearchBar}
|
ListHeaderComponent={this.renderSearchBar}
|
||||||
ListFooterComponent={() => {
|
ListFooterComponent={() => {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect, batch } from 'react-redux';
|
import { connect, batch } from 'react-redux';
|
||||||
import { withSafeAreaInsets } from 'react-native-safe-area-context';
|
import { withSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
|
import * as List from '../../containers/List';
|
||||||
|
|
||||||
import { toggleServerDropdown as toggleServerDropdownAction } from '../../actions/rooms';
|
import { toggleServerDropdown as toggleServerDropdownAction } from '../../actions/rooms';
|
||||||
import { selectServerRequest as selectServerRequestAction, serverInitAdd as serverInitAddAction } from '../../actions/server';
|
import { selectServerRequest as selectServerRequestAction, serverInitAdd as serverInitAddAction } from '../../actions/server';
|
||||||
|
@ -174,11 +175,6 @@ class ServerDropdown extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[styles.serverSeparator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderServer = ({ item }) => {
|
renderServer = ({ item }) => {
|
||||||
const { server, theme } = this.props;
|
const { server, theme } = this.props;
|
||||||
|
|
||||||
|
@ -247,7 +243,7 @@ class ServerDropdown extends Component {
|
||||||
data={servers}
|
data={servers}
|
||||||
keyExtractor={item => item.id}
|
keyExtractor={item => item.id}
|
||||||
renderItem={this.renderServer}
|
renderItem={this.renderServer}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
/>
|
/>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { View, StyleSheet, FlatList } from 'react-native';
|
import { View, FlatList } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import { Q } from '@nozbe/watermelondb';
|
import { Q } from '@nozbe/watermelondb';
|
||||||
|
import * as List from '../containers/List';
|
||||||
|
|
||||||
import database from '../lib/database';
|
import database from '../lib/database';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
|
@ -27,12 +28,6 @@ import {
|
||||||
import { showErrorAlert } from '../utils/info';
|
import { showErrorAlert } from '../utils/info';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
separator: {
|
|
||||||
marginLeft: 60
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
class SelectedUsersView extends React.Component {
|
class SelectedUsersView extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
baseUrl: PropTypes.string,
|
baseUrl: PropTypes.string,
|
||||||
|
@ -225,11 +220,6 @@ class SelectedUsersView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSeparator = () => {
|
|
||||||
const { theme } = this.props;
|
|
||||||
return <View style={[sharedStyles.separator, styles.separator, { backgroundColor: themes[theme].separatorColor }]} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({ item, index }) => {
|
renderItem = ({ item, index }) => {
|
||||||
const { search, chats } = this.state;
|
const { search, chats } = this.state;
|
||||||
const { baseUrl, user, theme } = this.props;
|
const { baseUrl, user, theme } = this.props;
|
||||||
|
@ -275,7 +265,7 @@ class SelectedUsersView extends React.Component {
|
||||||
extraData={this.props}
|
extraData={this.props}
|
||||||
keyExtractor={item => item._id}
|
keyExtractor={item => item._id}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
ListHeaderComponent={this.renderHeader}
|
ListHeaderComponent={this.renderHeader}
|
||||||
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
||||||
enableEmptySections
|
enableEmptySections
|
||||||
|
|
Loading…
Reference in New Issue