mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix list top padding on ios
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import React, {useCallback, useEffect, useMemo, useState} from 'react';
|
import React, {useCallback, useEffect, useMemo, useState} from 'react';
|
||||||
import {StyleSheet, useWindowDimensions} from 'react-native';
|
import {Platform, RefreshControl, StyleSheet, Text, useWindowDimensions, View} from 'react-native';
|
||||||
import {Dimensions, Platform, RefreshControl, Text, View} from 'react-native';
|
|
||||||
import Orientation from 'react-native-orientation';
|
|
||||||
import {initialWindowMetrics} from 'react-native-safe-area-context';
|
import {initialWindowMetrics} from 'react-native-safe-area-context';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
||||||
@@ -9,11 +7,7 @@ import {COLORS_NOTE, SIZE, WEIGHT} from '../../common/common';
|
|||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {ACTIONS} from '../../provider/actions';
|
import {ACTIONS} from '../../provider/actions';
|
||||||
import {eSendEvent} from '../../services/eventManager';
|
import {eSendEvent} from '../../services/eventManager';
|
||||||
import {
|
import {eClearSearch, eOpenLoginDialog, eScrollEvent,} from '../../services/events';
|
||||||
eClearSearch,
|
|
||||||
eOpenLoginDialog,
|
|
||||||
eScrollEvent,
|
|
||||||
} from '../../services/events';
|
|
||||||
import {db, ToastEvent} from '../../utils/utils';
|
import {db, ToastEvent} from '../../utils/utils';
|
||||||
import {PressableButton} from '../PressableButton';
|
import {PressableButton} from '../PressableButton';
|
||||||
|
|
||||||
@@ -40,12 +34,11 @@ const SimpleList = ({
|
|||||||
return r1 !== r2;
|
return r1 !== r2;
|
||||||
}).cloneWithRows([]),
|
}).cloneWithRows([]),
|
||||||
);
|
);
|
||||||
const {width, height, fontScale,scale} = useWindowDimensions();
|
const {width, fontScale} = useWindowDimensions();
|
||||||
|
|
||||||
const listData = data;
|
const listData = data;
|
||||||
const dataType = type;
|
const dataType = type;
|
||||||
const _onScroll = (event) => {
|
const _onScroll = (event) => {
|
||||||
|
|
||||||
if (!event) return;
|
if (!event) return;
|
||||||
let y = event.nativeEvent.contentOffset.y;
|
let y = event.nativeEvent.contentOffset.y;
|
||||||
eSendEvent(eScrollEvent, y);
|
eSendEvent(eScrollEvent, y);
|
||||||
@@ -168,7 +161,9 @@ const SimpleList = ({
|
|||||||
case 'MAIN_HEADER':
|
case 'MAIN_HEADER':
|
||||||
dim.width = width;
|
dim.width = width;
|
||||||
dim.height =
|
dim.height =
|
||||||
(user && user.Id) || !listData[0] || selectionMode ? 0 : 40 * fontScale;
|
(user && user.Id) || !listData[0] || selectionMode
|
||||||
|
? 0
|
||||||
|
: 40 * fontScale;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dim.width = width;
|
dim.width = width;
|
||||||
@@ -187,6 +182,7 @@ const SimpleList = ({
|
|||||||
return <RenderSectionHeader item={data}/>;
|
return <RenderSectionHeader item={data}/>;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
s
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -197,10 +193,10 @@ const SimpleList = ({
|
|||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
paddingTop:
|
paddingTop:
|
||||||
Platform.OS == 'ios'
|
Platform.OS === 'ios'
|
||||||
? listData[0] && !selectionMode
|
? listData[0] && !selectionMode
|
||||||
? 115
|
? 130
|
||||||
: 115 - 60
|
: 130 - 60
|
||||||
: listData[0] && !selectionMode
|
: listData[0] && !selectionMode
|
||||||
? 155 - initialWindowMetrics.insets.top
|
? 155 - initialWindowMetrics.insets.top
|
||||||
: 155 - initialWindowMetrics.insets.top - 60,
|
: 155 - initialWindowMetrics.insets.top - 60,
|
||||||
@@ -239,7 +235,7 @@ const SimpleList = ({
|
|||||||
export default SimpleList;
|
export default SimpleList;
|
||||||
|
|
||||||
const SearchHeader = () => {
|
const SearchHeader = () => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state,] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
const searchResults = {...state.searchResults};
|
const searchResults = {...state.searchResults};
|
||||||
|
|
||||||
@@ -269,7 +265,7 @@ const SearchHeader = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const LoginCard = ({type, data}) => {
|
const LoginCard = ({type, data}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state,] = useTracked();
|
||||||
const {colors, selectionMode, user, currentScreen} = state;
|
const {colors, selectionMode, user, currentScreen} = state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -339,7 +335,7 @@ const LoginCard = ({type, data}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ListHeaderComponent = ({type, data}) => {
|
const ListHeaderComponent = ({type, data}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, ] = useTracked();
|
||||||
const searchResults = {...state.searchResults};
|
const searchResults = {...state.searchResults};
|
||||||
|
|
||||||
return searchResults.type === type && searchResults.results.length > 0 ? (
|
return searchResults.type === type && searchResults.results.length > 0 ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user