Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐴] Additional tweaks to the message list #4075

Merged
merged 3 commits into from
May 17, 2024
Merged

[🐴] Additional tweaks to the message list #4075

merged 3 commits into from
May 17, 2024

Conversation

haileyok
Copy link
Contributor

No description provided.

Copy link

render bot commented May 17, 2024

Comment on lines -74 to -90
const [hasInitiallyRendered, setHasInitiallyRendered] = React.useState(false)

// HACK: Because we need to scroll to the bottom of the list once initial items are added to the list, we also have
// to take into account that scrolling to the end of the list on native will happen asynchronously. This will cause
// a little flicker when the items are first renedered at the top and immediately scrolled to the bottom. to prevent
// this, we will wait until the first render has completed to remove the loading overlay.
React.useEffect(() => {
if (
!hasInitiallyRendered &&
isConvoActive(convoState) &&
!convoState.isFetchingHistory
) {
setTimeout(() => {
setHasInitiallyRendered(true)
}, 15)
}
}, [convoState, hasInitiallyRendered])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a nasty hack, time to rm

Copy link

github-actions bot commented May 17, 2024

Old size New size Diff
6.82 MB 6.82 MB -135 B (-0.00%)

Comment on lines -95 to -106
// Since we are using the native web methods for scrolling on `List`, we only use the reanimated `scrollTo` on native
const scrollToOffset = React.useCallback(
(offset: number, animated: boolean) => {
if (isWeb) {
flatListRef.current?.scrollToOffset({offset, animated})
} else {
runOnUI(scrollTo)(flatListRef, 0, offset, animated)
}
},
[flatListRef],
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a galaxy far far away, developers have a Javascript ecosystem that interacts with native code fully synchronously, and they live very happily.

Alas, that is not our galaxy. There's some layouts that are not actually ready yet when we call scrollTo right now, particularly around sending a new message and expecting the view to scroll up. We've seen over the past week that the old way of doing things was solid, so let's return to that.

We will still use scrollTo for keyboard animation scrolling, because its 🔥🥵🔥 and doesn't cause problems.

another nit

nit

small annoyance

add a comment

only use `scrollTo` when necessary

remove now unnecessary styles
@haileyok haileyok mentioned this pull request May 17, 2024
@haileyok haileyok merged commit dd4c8d8 into main May 17, 2024
6 checks passed
@haileyok haileyok deleted the hailey/moar-fps branch May 17, 2024 15:21
estrattonbailey added a commit that referenced this pull request May 17, 2024
* origin/main:
  [🐴] Don't always show notification for everything (#4083)
  [🐴] Additional tweaks to the message list (#4075)
  Conditionally load unreads (#4072)
  Revert "Aggregate quickly-sent messages into batches (#4061)" (#4069)
  100% Real Deal™ (#4070)
  [🐴] 60 FPS Keyboard (#4066)
  Fix delete message error (#4065)
  Aggregate quickly-sent messages into batches (#4061)
  [🐴] Input hover and focus styles (#4064)
  fix typo (#4060)
  Fix error styles (#4063)
  Reset leave chat optimistic update if fails (#4058)
  don't show individual labels on own profile, only "have been placed..." (#4057)
  [🐴] Tweak header styles (#4053)
estrattonbailey added a commit that referenced this pull request May 17, 2024
* origin/main:
  [🐴] NUX (#4062)
  [🐴] Reduce header size (#4078)
  [🐴] Don't always show notification for everything (#4083)
  [🐴] Additional tweaks to the message list (#4075)
estrattonbailey added a commit that referenced this pull request May 17, 2024
* origin/main:
  [🐴] NUX (#4062)
  [🐴] Reduce header size (#4078)
  [🐴] Don't always show notification for everything (#4083)
  [🐴] Additional tweaks to the message list (#4075)
  Conditionally load unreads (#4072)
  Revert "Aggregate quickly-sent messages into batches (#4061)" (#4069)
  100% Real Deal™ (#4070)
  [🐴] 60 FPS Keyboard (#4066)
  Fix delete message error (#4065)
  Aggregate quickly-sent messages into batches (#4061)
  [🐴] Input hover and focus styles (#4064)
  fix typo (#4060)
  Fix error styles (#4063)
  Reset leave chat optimistic update if fails (#4058)
  don't show individual labels on own profile, only "have been placed..." (#4057)
  [🐴] Tweak header styles (#4053)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants