mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
refactor list
This commit is contained in:
@@ -47,24 +47,19 @@ const SimpleList = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
|
|
||||||
const [dataProvider, setDataProvider] = useState(
|
const [dataProvider, setDataProvider] = useState(
|
||||||
new DataProvider((r1, r2) => {
|
new DataProvider((r1, r2) => {
|
||||||
return r1 !== r2;
|
return r1 !== r2;
|
||||||
}).cloneWithRows([header, {type: 'empty'}]),
|
}).cloneWithRows([header, {type: 'empty'}]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
const {width, fontScale} = useWindowDimensions();
|
const {width, fontScale} = useWindowDimensions();
|
||||||
|
const refreshing = false;
|
||||||
const listData = data;
|
const listData = data;
|
||||||
const dataType = type;
|
const dataType = type;
|
||||||
const _onScroll = (event) => {
|
|
||||||
if (!event) return;
|
|
||||||
let y = event.nativeEvent.contentOffset.y;
|
|
||||||
eSendEvent(eScrollEvent, y);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
@@ -85,6 +80,12 @@ const SimpleList = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _onScroll = (event) => {
|
||||||
|
if (!event) return;
|
||||||
|
let y = event.nativeEvent.contentOffset.y;
|
||||||
|
eSendEvent(eScrollEvent, y);
|
||||||
|
};
|
||||||
|
|
||||||
const _layoutProvider = new LayoutProvider(
|
const _layoutProvider = new LayoutProvider(
|
||||||
(index) => {
|
(index) => {
|
||||||
return dataProvider.getDataForIndex(index).type;
|
return dataProvider.getDataForIndex(index).type;
|
||||||
@@ -174,6 +175,7 @@ const SimpleList = ({
|
|||||||
index={index}
|
index={index}
|
||||||
headerProps={headerProps}
|
headerProps={headerProps}
|
||||||
jumpToDialog={jumpToDialog}
|
jumpToDialog={jumpToDialog}
|
||||||
|
sortMenuButton={sortMenuButton}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'empty':
|
case 'empty':
|
||||||
@@ -238,7 +240,7 @@ const SimpleList = ({
|
|||||||
|
|
||||||
export default SimpleList;
|
export default SimpleList;
|
||||||
|
|
||||||
const RenderSectionHeader = ({item, index, headerProps, jumpToDialog}) => {
|
const RenderSectionHeader = ({item, index, headerProps, jumpToDialog,sortMenuButton}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user