react-native - 嗨,我是 React Native 的新手,使用 Native-base 我正在尝试设计卡片视图
问题描述
在此处输入图像描述][2][![我在卡内遇到问题,能够看到描述部分我正在尝试实现它位于图像下方,实际上它应该位于图像旁边`
<ListItem>
<Card
style={{
marginTop: 0,
marginBottom: 0,
marginRight: 0,
marginLeft: 0,
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
flexDirection: 'row',
}}>
<View style={{flex: 1}}>
<CardItem>
<Thumbnail
source={require('../../assets/images/restaurant_128.png')}
/>
</CardItem>
</View>
<View style={{flex: 3, flexDirection: 'column'}}>
<CardItem>
<Body>
<Text>{item.Title}</Text>
<Text style={{backgroundColor: 'green'}}>
{item.Description}
</Text>
</Body>
</CardItem>
</View
</Card>
</ListItem>
`
解决方案
尝试这个:-
<View style={{
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
backgroundColor: "#B8B2B2",
width: "100%",
height: 100
}}>
<View style={{
width: "30%",
backgroundColor: "red",
height: 100
}}>
<Text>left image here</Text>
</View>
<View style={{
width: "70%",
backgroundColor: "#B8B2B2",
height: 100
}}>
<View style={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
backgroundColor: "#fff",
height: 50
}}>
<View style={{
width: "30%",
backgroundColor: "teal",
height: 50
}}>
<Text>lamb samosa</Text>
</View>
<View style={{
width: "30%",
backgroundColor: "teal",
height: 50
}}>
<Text>$4.5</Text>
</View>
</View>
<View style={{
width: "100%",
backgroundColor: "#B8B2B2",
height: 50
}}>
<Text>Lorem Ipsum</Text>
</View>
</View>
</View>
推荐阅读
- python - Netmiko 提交方法未提交且不退出配置模式
- swift - 使用 JSONDecoder() 将嵌套的 JSON 解码为字符串
- r - 如何使用 Tidyverse 按 ID 将最近的日期与参考日期进行比较?
- ios - 去编译iOS
- forms - 如果Url是图像并且视频加载视频控件,Xamarin如何加载图像控制
- python - 在 Jupyter Python 中突出显示相同的变量
- r - 尝试提取/计算字符串中的唯一字符(类字符)
- c# - 我想使用 C# 将文件上传到 FTP 服务器 - 来自 GetRequestStream() 的错误
- python - OpenCV 不显示 cv2 模块/函数,也没有自动检查或自动完成代码
- google-maps - 如何在 Xamarin iOS 中的聚集标记上显示自定义信息窗口