这很奇怪,我找不到任何关于它的东西。
我有一个非常简单的项目(刚刚开始使用原生react ),当我在滚动视图中放置一个项目列表时,我会不断地“颤动”。以下是该行为的视频:https://imgur.com/a/MYerrFl
在iOS模拟器和我的手机上都会发生这种情况。
下面是非常简单的代码:
const App = () => {
return (
<ScrollView style={{
backgroundColor: '#fcfcfc'
}}>
<SafeAreaView>
{['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'].map((letter) => {
return <Text style={{
backgroundColor: 'red',
padding: 20,
margin: 3
}} key={letter}>{letter}</Text>
})}
</SafeAreaView>
</ScrollView>
);
};当我拿掉SafeAreaView的时候,它一点都不颤动...
发布于 2019-11-13 06:28:58
最终找到了一个解决方案:https://github.com/facebook/react-native/issues/16997#issuecomment-423814312
诀窍是将contentInsetAdjustmentBehavior="automatic"添加到滚动视图中。
https://stackoverflow.com/questions/58826976
复制相似问题