The scolling direction is reversed.
<GiftedChat
messages={[...]}
loadEarlier
user={{
_id: 114514,
}}
wrapInSafeArea={false}
isKeyboardInternallyHandled={false}
onSend={...}
/>
When mouse wheel scrolls down, the message container scrolls down.
I managed to get a workaround working... see these threads:
https://github.com/necolas/react-native-web/issues/995
https://codesandbox.io/s/react-native-dsyse?file=/src/App.js
You'd need to access the inner FlatList ref within GiftedChat. Assuming your GiftedChat ref is this.giftedChatRef you can do something like let listViewRef = this.giftedChatRef._messageContainerRef, then apply the invertedWheelEvent code from the codesandbox link. Make sure your refs are not null when the listener is attached
Mine looks something like this:
componentDidMount = () => {
let listViewRef = this.giftedChatRef._messageContainerRef
if (listViewRef.current) {
listViewRef.current.getScrollableNode().addEventListener('wheel', this.invertedWheelEvent)
listViewRef.current.setNativeProps({
style: {
transform: "translate3d(0,0,0) scaleY(-1)"
}
})
}
}
componentWillUnmount = () => {
let listViewRef = this.giftedChatRef._messageContainerRef
if (listViewRef.current) {
listViewRef.current.getScrollableNode().removeEventListener('wheel', this.invertedWheelEvent)
}
}
invertedWheelEvent = (e) => {
let listViewRef = this.giftedChatRef._messageContainerRef
if (listViewRef.current) {
listViewRef.current.getScrollableNode().scrollTop -= e.deltaY;
e.preventDefault()
}
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
seems this problem is chrome-only
This is a problem of react-native-web.
https://github.com/necolas/react-native-web/issues/995
seems this problem is chrome-only
We also need to consider arrow keys, page up/page down, home/end, and mousewheel drag.
Most helpful comment
I managed to get a workaround working... see these threads:
https://github.com/necolas/react-native-web/issues/995
https://codesandbox.io/s/react-native-dsyse?file=/src/App.js
You'd need to access the inner FlatList ref within GiftedChat. Assuming your GiftedChat ref is
this.giftedChatRefyou can do something likelet listViewRef = this.giftedChatRef._messageContainerRef, then apply theinvertedWheelEventcode from the codesandbox link. Make sure your refs are not null when the listener is attachedMine looks something like this: