fix: 加载更多完成后页面抖动/导航栏弹出

ListFooterComponent 在 loading 结束时从 ActivityIndicator 变为 null,
content 高度骤降触发虚假 scroll event,diffClamp 误判为上滑把导航栏顶出。
改为 footer 保持固定高度 48px,仅切换 spinner 的显隐,消除高度变化。
This commit is contained in:
Developer
2026-03-10 21:07:40 +08:00
parent f2b4c404c3
commit 9ceb3b0d94

View File

@@ -58,7 +58,11 @@ export default function HomeScreen() {
refreshing={refreshing}
onEndReached={() => load()}
onEndReachedThreshold={0.5}
ListFooterComponent={loading ? <ActivityIndicator style={styles.footer} color="#00AEEC" /> : null}
ListFooterComponent={
<View style={styles.footer}>
{loading && <ActivityIndicator color="#00AEEC" />}
</View>
}
onScroll={Animated.event(
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
{ useNativeDriver: true }
@@ -152,8 +156,8 @@ const styles = StyleSheet.create({
backgroundColor: '#00AEEC',
borderRadius: 1,
},
row: { paddingHorizontal: 8 },
row: { paddingHorizontal: 8, justifyContent:'center' },
leftCol: { marginLeft: 4, marginRight: 2 },
rightCol: { marginLeft: 2, marginRight: 4 },
footer: { marginVertical: 16 },
footer: { height: 48, alignItems: 'center', justifyContent: 'center' },
});