React native 水平滚动视图未在React Native中滚动

React native 水平滚动视图未在React Native中滚动,react-native,scrollview,expo,styled-components,horizontalscrollview,React Native,Scrollview,Expo,Styled Components,Horizontalscrollview,我正在尝试渲染可单击照片的水平滚动视图。 垂直滚动工作正常,但一旦我设置了horizontal={true},我就限制了水平滚动的范围。它阻止我滚动超过中显示的内容 固定的。删除了“marginRight”,它起了作用。水平滚动视图不喜欢设置其子级页边距的样式 <Container> <ScrollView horizontal={true} contentContainerStyle={{ flex: 1,

我正在尝试渲染可单击照片的水平滚动视图。 垂直滚动工作正常,但一旦我设置了horizontal={true},我就限制了水平滚动的范围。它阻止我滚动超过中显示的内容

固定的。删除了“marginRight”,它起了作用。水平滚动视图不喜欢设置其子级页边距的样式

<Container>
       <ScrollView
      horizontal={true}
      contentContainerStyle={{
        flex: 1,
        paddingTop: "5%"
      }}
    >
      {posts.map(post => {
        return (
          <TouchableOpacity
            key={post.id}
            style={{
              width: width,
              flex: 1,
              height: height / 3,
              borderRadius: "8px",
              overflow: "hidden",
              marginRight: "2%"
            }}
          >
            <Thumbnail
              source={{
                uri: uri`
              }}
            />
            <PostTitle>{post.name}</PostTitle>
          </TouchableOpacity>
        );
      })}
    </ScrollView>
</Container>
const Container = styled.View`
  flex: 1;
  padding-top: 18%;
  background: #fff;
`;

const Title = styled.Text`
  color: #333;
  text-transform: uppercase;
  font-weight: 600;
  padding-left: 8%;
  padding-bottom: 5%;
`;


const Thumbnail = styled.Image`
  flex: 1;
  justify-content: center;
  align-items: center;
  resize-mode: cover;
`;

const PostTitle = styled.Text`
  color: #fdfdfd;
  font-size: 16px;
  font-weight: bold;
  position: absolute;
  top: 10%;
  left: 8%;
`;