Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改无限列表到底不触发onEndReached的问题 #141

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions src/pages/searchPage/components/resultPanel/resultWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ListReachEnd from '@/components/base/listReachEnd';
import useOrientation from '@/hooks/useOrientation';
import {FlashList} from '@shopify/flash-list';
import rpx from '@/utils/rpx';
import {StyleSheet, View} from 'react-native';

interface IResultWrapperProps<
T extends ICommon.SupportMediaType = ICommon.SupportMediaType,
Expand Down Expand Up @@ -58,15 +59,17 @@ function ResultWrapper(props: IResultWrapperProps) {
<FlashList
extraData={searchState}
ListEmptyComponent={() => <Empty />}
ListFooterComponent={() =>
searchState === RequestStateCode.PENDING ? (
<ListLoading />
) : searchState === RequestStateCode.FINISHED ? (
<ListReachEnd />
) : (
<></>
)
}
ListFooterComponent={() => (
<View style={style.wrapper}>
{searchState === RequestStateCode.PENDING ? (
<ListLoading />
) : searchState === RequestStateCode.FINISHED ? (
<ListReachEnd />
) : (
<></>
)}
</View>
)}
data={data}
refreshing={false}
onRefresh={() => {
Expand All @@ -87,3 +90,11 @@ function ResultWrapper(props: IResultWrapperProps) {
}

export default memo(ResultWrapper);
const style = StyleSheet.create({
wrapper: {
width: '100%',
height: rpx(140),
justifyContent: 'center',
alignItems: 'center',
},
});