Skip to content

Commit 31f88aa

Browse files
committed
refactor: add poll changes
1 parent ed1b318 commit 31f88aa

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

package/src/components/Attachment/Gallery.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { getGalleryImageBorderRadius } from './utils/getGalleryImageBorderRadius
1111

1212
import { openUrlSafely } from './utils/openUrlSafely';
1313

14+
import { useTranslationContext } from '../../contexts';
1415
import { useChatConfigContext } from '../../contexts/chatConfigContext/ChatConfigContext';
1516
import {
1617
ImageGalleryContextValue,
@@ -29,7 +30,7 @@ import {
2930
useOverlayContext,
3031
} from '../../contexts/overlayContext/OverlayContext';
3132
import { useTheme } from '../../contexts/themeContext/ThemeContext';
32-
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
33+
3334
import { useLoadingImage } from '../../hooks/useLoadingImage';
3435
import { isVideoPlayerAvailable } from '../../native';
3536
import { FileTypes } from '../../types/types';

package/src/components/Poll/components/CreatePollOptions.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,11 @@ export const CreatePollOption = ({
9797
// The sanity check for position cache updated index, is added because after a poll is sent its been reset
9898
// by the composer and it throws an undefined error. This can be removed in future.
9999
useAnimatedReaction(
100-
() =>
101-
currentOptionPositionsDerived.value.positionCache[option.id]
102-
? currentOptionPositionsDerived.value.positionCache[option.id].updatedIndex
103-
: 0,
100+
() => currentOptionPositionsDerived.value.positionCache[option.id]?.updatedIndex ?? 0,
104101
(currentValue, previousValue) => {
105102
if (currentValue !== previousValue) {
106-
const updatedIndex = currentOptionPositionsDerived.value.positionCache[option.id]
107-
? currentOptionPositionsDerived.value.positionCache[option.id].updatedIndex
108-
: 0;
103+
const updatedIndex =
104+
currentOptionPositionsDerived.value.positionCache[option.id]?.updatedIndex ?? 0;
109105
top.value = withSpring(updatedIndex * createPollOptionHeight);
110106
}
111107
},

0 commit comments

Comments
 (0)