admin管理员组文章数量:1291043
render() {
return(
<Card style={{ padding: 0 }}>
<CardItem listItemPadding={0} header style=styles.Card}>
<Text style={styles.cardText}>
{this.props.library.title}
</Text>
</CardItem>
</Card>
);
}
The docs say that listItemPadding
can be used but it's not working
I have tried to change the padding of to 0 but it's not working either.
render() {
return(
<Card style={{ padding: 0 }}>
<CardItem listItemPadding={0} header style=styles.Card}>
<Text style={styles.cardText}>
{this.props.library.title}
</Text>
</CardItem>
</Card>
);
}
The docs say that listItemPadding
can be used but it's not working
I have tried to change the padding of to 0 but it's not working either.
- Check this out: Github issues #1219 – Nay Commented Dec 23, 2018 at 19:27
5 Answers
Reset to default 3Use the cardBody attribute in cardItem it will work.
I see that you are trying to use listItemPadding
prop which doesn't exist at the moment.
ListItem
, Card
and CardItems
, each have some padding or margin of their own. You can just inspect the screen, check it and remove the padding/margin as per your requirement using style. Or you can eject NativeBase theme (Customize) and do your changes in the theme of those ponents. That way you will have the same styles for those ponents in your whole app.
Probably you are looking for a paddingVertical
property. You can add a negative value and then edit your ponent style as you will normally do.
native-base-theme/ponents/CardItem.js
paddingVertical: variables.cardItemPadding - 5,
Then on your ponent:
render() {
return(
<Card style={{ padding: 10 }}>
<CardItem header style={{ paddingTop: 10 }}>
<Text>Item</Text>
</CardItem>
</Card>
);
}
try this code:
render() {
return(
<View style={{ flex: 0,
elevation: 3,
shadowColor: "#000",
shadowOpacity: 0.1,
shadowOffset: { width: 0, height: 2 },
shadowRadius: 1.0,
marginVertical: 1,
borderRadius: 2,
marginHorizontal: 1,
margin: 0,
padding: 0,
borderWidth: 0, }}>
<CardItem listItemPadding={0} header style=styles.Card}>
<Text style={styles.cardText}>
{this.props.library.title}
</Text>
</CardItem>
</View>
);
}
you can use marginTop
const styles = StyleSheet.create({
shadowOffset: { width: 0, height: 5 },
shadowRadius: 6,
shadowOpacity: 0.26,
elevation: 8,
backgroundColor: 'white',
padding: 20,
borderRadius: 10,
paddingTop: 20,
width: 400,
maxWidth: '50%',
marginTop: 10,
});
To control the padding, put all the sides...
paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0
...you can then put the appropriate padding number in any of the sides. But declare padding for all the four sides.
本文标签: javascriptReactNative nativebase How to decrease the spacing between card ItemsStack Overflow
版权声明:本文标题:javascript - React-Native native-base How to decrease the spacing between card Items? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741511731a2382645.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论