Update index.tsx

This commit is contained in:
Gerzon Z 2021-11-04 14:25:05 -04:00
parent 767637bdaf
commit 0a3bdb65bd
1 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ interface IDiscussionsViewProps {
}; };
} }
interface IState { interface IDiscussionsViewState {
login?: { login?: {
user: object; user: object;
}; };
@ -52,11 +52,11 @@ interface IState {
const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => { const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => {
const rid = route.params?.rid; const rid = route.params?.rid;
const user = useSelector((state: IState) => state.login?.user); const user = useSelector((state: IDiscussionsViewState) => state.login?.user);
const baseUrl = useSelector((state: IState) => state.server?.server); const baseUrl = useSelector((state: IDiscussionsViewState) => state.server?.server);
const useRealName = useSelector((state: IState) => state.settings?.UI_Use_Real_Name); const useRealName = useSelector((state: IDiscussionsViewState) => state.settings?.UI_Use_Real_Name);
const timeFormat = useSelector((state: IState) => state.settings?.Message_TimeFormat); const timeFormat = useSelector((state: IDiscussionsViewState) => state.settings?.Message_TimeFormat);
const isMasterDetail = useSelector((state: IState) => state.app?.isMasterDetail); const isMasterDetail = useSelector((state: IDiscussionsViewState) => state.app?.isMasterDetail);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [discussions, setDiscussions] = useState([]); const [discussions, setDiscussions] = useState([]);
@ -179,7 +179,7 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem
rid: item.drid, rid: item.drid,
prid: item.rid, prid: item.rid,
name: item.msg, name: item.msg,
t: 'c' t: item.rid === 'GENERAL' ? 'c' : 'p'
}); });
}, },
1000, 1000,
@ -211,7 +211,7 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem
data={isSearching ? search : discussions} data={isSearching ? search : discussions}
renderItem={renderItem} renderItem={renderItem}
keyExtractor={(item: any) => item.msg} keyExtractor={(item: any) => item.msg}
style={{ backgroundColor: themes[theme!].backgroundColor }} style={{ backgroundColor: themes[theme].backgroundColor }}
contentContainerStyle={styles.contentContainer} contentContainerStyle={styles.contentContainer}
onEndReachedThreshold={0.5} onEndReachedThreshold={0.5}
maxToRenderPerBatch={5} maxToRenderPerBatch={5}