Skip to content

Commit

Permalink
fix mobile search scrolling (#25028)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnojima committed Jun 1, 2022
1 parent cd9b9b2 commit 6b04adb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 57 deletions.
15 changes: 11 additions & 4 deletions shared/chat/conversation/list-area/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,19 @@ class ConversationList extends React.PureComponent<Props> {
if (!list) {
return
}
const index =
const _index =
this.props.centeredOrdinal === undefined ? -1 : this.getOrdinalIndex(this.props.centeredOrdinal)
if (index >= 0) {
debug(`scrollToCentered: ordinal: ${this.props.centeredOrdinal} index: ${index}`)
if (_index >= 0) {
const index = _index + 1 // include the top item
debug(
`scrollToCentered: ordinal: ${this.props.centeredOrdinal} index: ${index} len: ${this.props.messageOrdinals.length}`
)
this.scrollCenterTarget = index
list.scrollToIndex({animated: false, index, viewPosition: 0.5})
list.scrollToIndex({
animated: false,
index,
viewPosition: 0.5,
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion shared/common-adapters/native-wrappers.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import {
TouchableOpacity as NativeTouchableOpacity,
TouchableWithoutFeedback as NativeTouchableWithoutFeedback,
View as NativeView,
VirtualizedList as NativeVirtualizedList,
} from 'react-native'
import NativeScrollView from './scroll-view.native'
import {NativeImage, FastImage as NativeFastImage} from './native-image.native'
import NativeVirtualizedList from './virtualized-list.native'
import {WebView as NativeWebView} from 'react-native-webview'
import {Picker as NativePicker} from '@react-native-picker/picker'

Expand Down
52 changes: 0 additions & 52 deletions shared/common-adapters/virtualized-list.native.tsx

This file was deleted.

0 comments on commit 6b04adb

Please sign in to comment.