Fixed header jumping on ProximoListScreen.js

This commit is contained in:
Arnaud Vergnet 2020-04-20 20:51:32 +02:00
parent 02f3ff0ff9
commit 6b04447535

View file

@ -10,7 +10,6 @@ import ProximoListItem from "../../components/Lists/Proximo/ProximoListItem";
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton"; import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
import {withCollapsible} from "../../utils/withCollapsible"; import {withCollapsible} from "../../utils/withCollapsible";
import CustomTabBar from "../../components/Tabbar/CustomTabBar"; import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import AutoHideHandler from "../../utils/AutoHideHandler";
function sortPrice(a, b) { function sortPrice(a, b) {
return a.price - b.price; return a.price - b.price;
@ -59,7 +58,6 @@ class ProximoListScreen extends React.Component<Props, State> {
modalRef: Object; modalRef: Object;
listData: Array<Object>; listData: Array<Object>;
shouldFocusSearchBar: boolean; shouldFocusSearchBar: boolean;
hideHandler: AutoHideHandler;
constructor(props) { constructor(props) {
super(props); super(props);
@ -70,8 +68,6 @@ class ProximoListScreen extends React.Component<Props, State> {
currentSortMode: 3, currentSortMode: 3,
modalCurrentDisplayItem: null, modalCurrentDisplayItem: null,
}; };
this.hideHandler = new AutoHideHandler(false);
this.hideHandler.addListener(this.onHideChange);
} }
@ -301,17 +297,8 @@ class ProximoListScreen extends React.Component<Props, State> {
itemLayout = (data, index) => ({length: LIST_ITEM_HEIGHT, offset: LIST_ITEM_HEIGHT * index, index}); itemLayout = (data, index) => ({length: LIST_ITEM_HEIGHT, offset: LIST_ITEM_HEIGHT * index, index});
onScroll = (event: Object) => {
this.hideHandler.onScroll(event);
};
onHideChange = (shouldHide: boolean) => {
this.props.navigation.setParams({hideTabBar: shouldHide});
}
render() { render() {
const {containerPaddingTop, scrollIndicatorInsetTop, onScrollWithListener} = this.props.collapsibleStack; const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
return ( return (
<View style={{ <View style={{
height: '100%' height: '100%'
@ -330,7 +317,7 @@ class ProximoListScreen extends React.Component<Props, State> {
getItemLayout={this.itemLayout} getItemLayout={this.itemLayout}
initialNumToRender={10} initialNumToRender={10}
// Animations // Animations
onScroll={onScrollWithListener(this.onScroll)} onScroll={onScroll}
contentContainerStyle={{ contentContainerStyle={{
paddingTop: containerPaddingTop, paddingTop: containerPaddingTop,
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT paddingBottom: CustomTabBar.TAB_BAR_HEIGHT