fix flickering in channel list

This commit is contained in:
Roland Osborne 2022-09-20 12:05:32 -07:00
parent 398e118c45
commit 61cb4fc903
4 changed files with 34 additions and 5 deletions

View File

@ -64,7 +64,6 @@ export function useChannelContext() {
const { server, appToken, guid } = session.current; const { server, appToken, guid } = session.current;
const delta = await getChannels(server, appToken, setRevision.current); const delta = await getChannels(server, appToken, setRevision.current);
console.log(delta);
for (let channel of delta) { for (let channel of delta) {
if (channel.data) { if (channel.data) {
if (channel.data.channelDetail && channel.data.channelSummary) { if (channel.data.channelDetail && channel.data.channelSummary) {
@ -139,7 +138,6 @@ console.log(delta);
updateState({ account: null, channels: channels.current }); updateState({ account: null, channels: channels.current });
}, },
setRevision: (rev) => { setRevision: (rev) => {
console.log("CHANNEL REVISION:", rev);
curRevision.current = rev; curRevision.current = rev;
sync(); sync();
}, },

View File

@ -0,0 +1,28 @@
import { StyleSheet } from 'react-native';
import { Colors } from 'constants/Colors';
export const styles = StyleSheet.create({
container: {
width: '100%',
display: 'flex',
flexDirection: 'row',
height: 48,
alignItems: 'center',
borderBottomWidth: 1,
borderColor: Colors.itemDivider,
},
detail: {
paddingLeft: 12,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
flexGrow: 1,
flexShrink: 1,
},
subject: {
},
message: {
color: Colors.disabled,
},
})

View File

@ -67,8 +67,13 @@ export function useChannels() {
if (contacts.length) { if (contacts.length) {
let names = []; let names = [];
for (let contact of contacts) { for (let contact of contacts) {
if (contact?.profile?.name) {
names.push(contact.profile.name);
}
else {
names.push(contact?.profile?.handle); names.push(contact?.profile?.handle);
} }
}
subject = names.join(', '); subject = names.join(', ');
} }
else { else {

View File

@ -1,7 +1,6 @@
import { useState, useEffect, useContext } from 'react'; import { useState, useEffect, useContext } from 'react';
import { useWindowDimensions } from 'react-native'; import { useWindowDimensions } from 'react-native';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { AppContext } from 'context/AppContext';
import config from 'constants/Config'; import config from 'constants/Config';
export function useSession() { export function useSession() {
@ -14,7 +13,6 @@ export function useSession() {
converstaionId: null, converstaionId: null,
}); });
const dimensions = useWindowDimensions(); const dimensions = useWindowDimensions();
const app = useContext(AppContext);
const navigate = useNavigate(); const navigate = useNavigate();
const updateState = (value) => { const updateState = (value) => {