[Gekidou] Fix initial Channel list width on iPad (#6164)
* Fix initial Channel list width on iPad * feedback review
This commit is contained in:
parent
2b3d84ee61
commit
57e3334507
1 changed files with 12 additions and 7 deletions
|
|
@ -34,10 +34,21 @@ type ChannelListProps = {
|
|||
teamsCount: number;
|
||||
}
|
||||
|
||||
const getTabletWidth = (teamsCount: number) => {
|
||||
return TABLET_SIDEBAR_WIDTH - (teamsCount > 1 ? TEAM_SIDEBAR_WIDTH : 0);
|
||||
};
|
||||
|
||||
const ChannelList = ({channelsCount, currentTeamId, iconPad, isTablet, teamsCount}: ChannelListProps) => {
|
||||
const theme = useTheme();
|
||||
const styles = getStyleSheet(theme);
|
||||
const tabletWidth = useSharedValue(TABLET_SIDEBAR_WIDTH);
|
||||
const tabletWidth = useSharedValue(isTablet ? getTabletWidth(teamsCount) : 0);
|
||||
|
||||
useEffect(() => {
|
||||
if (isTablet) {
|
||||
tabletWidth.value = getTabletWidth(teamsCount);
|
||||
}
|
||||
}, [isTablet && teamsCount]);
|
||||
|
||||
const tabletStyle = useAnimatedStyle(() => {
|
||||
if (!isTablet) {
|
||||
return {
|
||||
|
|
@ -48,12 +59,6 @@ const ChannelList = ({channelsCount, currentTeamId, iconPad, isTablet, teamsCoun
|
|||
return {maxWidth: withTiming(tabletWidth.value, {duration: 350})};
|
||||
}, [isTablet]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isTablet) {
|
||||
tabletWidth.value = TABLET_SIDEBAR_WIDTH - (teamsCount > 1 ? TEAM_SIDEBAR_WIDTH : 0);
|
||||
}
|
||||
}, [isTablet, teamsCount]);
|
||||
|
||||
let content;
|
||||
|
||||
if (!currentTeamId) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue