ScrollView 不适用于本机反应

阿克萨马安

scrollView 在 react-native 中不起作用。它开始自动工作一次,但在我遇到同样的问题之前,然后在内容发生一些更改后再次停止工作vertical但是当我设置Horozontal={true} 它没有工作一次。如果只有text它工作scrollView但如果我添加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 ,它将起作用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章