ScrollView 在本机反应中不起作用
ScrollView is not working in react-native
scrollView 在 react-native 中不工作。它自动开始工作一次,但在我遇到同样的问题之前,然后在 vertical
的内容发生一些变化后它再次停止工作。但是当我设置 Horozontal={true}
它没有工作 如果 scrollView
中只有 text
则 once.It 工作但是如果我添加 view
它停止工作。是否有任何永久解决方案或替代方案?
<ScrollView contentContainerStyle={styles.ScrollView}>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
</ScrollView>
{/* </View> */}
</>
);
};
const styles = StyleSheet.create({
card: {
// flex: 1,
width: 150,
height: 200,
marginHorizontal: 16,
marginVertical: '10%',
backgroundColor: 'grey',
borderRadius: 25,
opacity: 0.9,
top: -15,
},
ScrollView: {
// justifyContent: 'space-between',
alignContent: 'space-between',
alignItems: 'center',
backgroundColor: 'pink',
flex: 1,
},
});
ScrollView是一个没有继承使用flex的组件。
从 ScrollView 样式中删除 flex: 1 即可。
scrollView 在 react-native 中不工作。它自动开始工作一次,但在我遇到同样的问题之前,然后在 vertical
的内容发生一些变化后它再次停止工作。但是当我设置 Horozontal={true}
它没有工作 如果 scrollView
中只有 text
则 once.It 工作但是如果我添加 view
它停止工作。是否有任何永久解决方案或替代方案?
<ScrollView contentContainerStyle={styles.ScrollView}>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
<View style={styles.card}>
<Text>asdas asdhs</Text>
</View>
</ScrollView>
{/* </View> */}
</>
);
};
const styles = StyleSheet.create({
card: {
// flex: 1,
width: 150,
height: 200,
marginHorizontal: 16,
marginVertical: '10%',
backgroundColor: 'grey',
borderRadius: 25,
opacity: 0.9,
top: -15,
},
ScrollView: {
// justifyContent: 'space-between',
alignContent: 'space-between',
alignItems: 'center',
backgroundColor: 'pink',
flex: 1,
},
});
ScrollView是一个没有继承使用flex的组件。 从 ScrollView 样式中删除 flex: 1 即可。