File tree Expand file tree Collapse file tree
FabricExample/src/screens/Examples/KeyboardChatScrollView
example/src/screens/Examples/KeyboardChatScrollView Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ const VirtualizedListScrollView = forwardRef<
4949 ref = { ref }
5050 automaticallyAdjustContentInsets = { false }
5151 contentContainerStyle = {
52- inverted ? invertedContentContainerStyle : contentContainerStyle
52+ isInvertedSupported
53+ ? invertedContentContainerStyle
54+ : contentContainerStyle
5355 }
5456 contentInsetAdjustmentBehavior = "never"
5557 freeze = { freeze }
Original file line number Diff line number Diff line change @@ -101,7 +101,9 @@ function KeyboardChatScrollViewPlayground() {
101101 { mode === "legend" && (
102102 < LegendList
103103 ref = { legendRef }
104+ alignItemsAtEnd = { inverted }
104105 data = { messages }
106+ initialScrollAtEnd = { inverted }
105107 keyExtractor = { ( item ) => item . text }
106108 renderItem = { ( { item } ) => < Message { ...item } /> }
107109 renderScrollComponent = { memoList }
@@ -110,8 +112,11 @@ function KeyboardChatScrollViewPlayground() {
110112 { mode === "flash" && (
111113 < FlashList
112114 ref = { flashRef }
113- data = { inverted ? reversedMessages : messages }
115+ data = { messages }
114116 keyExtractor = { ( item ) => item . text }
117+ maintainVisibleContentPosition = { {
118+ startRenderingFromBottom : inverted ,
119+ } }
115120 renderItem = { ( { item } ) => < Message { ...item } /> }
116121 renderScrollComponent = { VirtualizedListScrollView }
117122 />
Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ const VirtualizedListScrollView = forwardRef<
3333 ( ) => ( { paddingTop : TEXT_INPUT_HEIGHT + MARGIN } ) ,
3434 [ ] ,
3535 ) ;
36- // on new arch only FlatList supports `inverted` prop
37- const isInvertedSupported = inverted && mode === "flat" ? inverted : false ;
36+ // on old arch only FlatList and FlashList supports `inverted` prop
37+ const isInvertedSupported =
38+ inverted && ( mode === "flat" || mode === "flash" ) ? inverted : false ;
3839 const onLayout = useCallback (
3940 ( e : LayoutChangeEvent ) => {
4041 setLayoutPass ( ( l ) => l + 1 ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ function KeyboardChatScrollViewPlayground() {
101101 { mode === "legend" && (
102102 < LegendList
103103 ref = { legendRef }
104+ alignItemsAtEnd = { inverted }
104105 data = { messages }
105106 keyExtractor = { ( item ) => item . text }
106107 renderItem = { ( { item } ) => < Message { ...item } /> }
@@ -111,6 +112,7 @@ function KeyboardChatScrollViewPlayground() {
111112 < FlashList
112113 ref = { flashRef }
113114 data = { inverted ? reversedMessages : messages }
115+ inverted = { inverted }
114116 keyExtractor = { ( item ) => item . text }
115117 renderItem = { ( { item } ) => < Message { ...item } /> }
116118 renderScrollComponent = { VirtualizedListScrollView }
You can’t perform that action at this time.
0 commit comments