-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clipclops] Refactor message list (#3832)
* rework the list for accessibility * Reverse reverse * progress * good to start testing * memo `MessageItem` * small hack * use our custom `List` impl * use `ScrollProvider` for `onScroll` event * remove use of `runOnJS` * actually, let's keep it * add some comments --------- Co-authored-by: Eric Bailey <[email protected]>
- Loading branch information
1 parent
6a4199f
commit 8768166
Showing
7 changed files
with
158 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/screens/Messages/Conversation/useScrollToEndOnFocus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import {FlatList, Keyboard} from 'react-native' | ||
|
||
export function useScrollToEndOnFocus(flatListRef: React.RefObject<FlatList>) { | ||
React.useEffect(() => { | ||
const listener = Keyboard.addListener('keyboardDidShow', () => { | ||
requestAnimationFrame(() => { | ||
flatListRef.current?.scrollToEnd({animated: true}) | ||
}) | ||
}) | ||
|
||
return () => { | ||
listener.remove() | ||
} | ||
}, [flatListRef]) | ||
} |
6 changes: 6 additions & 0 deletions
6
src/screens/Messages/Conversation/useScrollToEndOnFocus.web.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react' | ||
import {FlatList} from 'react-native' | ||
|
||
// Stub for web | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export function useScrollToEndOnFocus(flatListRef: React.RefObject<FlatList>) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters