mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
fix: 加载更多完成后页面抖动/导航栏弹出
ListFooterComponent 在 loading 结束时从 ActivityIndicator 变为 null, content 高度骤降触发虚假 scroll event,diffClamp 误判为上滑把导航栏顶出。 改为 footer 保持固定高度 48px,仅切换 spinner 的显隐,消除高度变化。
This commit is contained in:
@@ -58,7 +58,11 @@ export default function HomeScreen() {
|
|||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onEndReached={() => load()}
|
onEndReached={() => load()}
|
||||||
onEndReachedThreshold={0.5}
|
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(
|
onScroll={Animated.event(
|
||||||
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
|
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
|
||||||
{ useNativeDriver: true }
|
{ useNativeDriver: true }
|
||||||
@@ -152,8 +156,8 @@ const styles = StyleSheet.create({
|
|||||||
backgroundColor: '#00AEEC',
|
backgroundColor: '#00AEEC',
|
||||||
borderRadius: 1,
|
borderRadius: 1,
|
||||||
},
|
},
|
||||||
row: { paddingHorizontal: 8 },
|
row: { paddingHorizontal: 8, justifyContent:'center' },
|
||||||
leftCol: { marginLeft: 4, marginRight: 2 },
|
leftCol: { marginLeft: 4, marginRight: 2 },
|
||||||
rightCol: { marginLeft: 2, marginRight: 4 },
|
rightCol: { marginLeft: 2, marginRight: 4 },
|
||||||
footer: { marginVertical: 16 },
|
footer: { height: 48, alignItems: 'center', justifyContent: 'center' },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user