react-native - 小猫 UI 网络图库
问题描述
我是 C# 中一个新的但很好的程序员。然而,我正在努力学习 React 世界。对我来说看起来不错。我正在尝试使用 react-native-ui-kitten 插件的 RkGallery 组件。
简单的使用示例:
<RkGallery items={[
require('path/to/my-awesome-pic-0.jpg'),
require('path/to/my-awesome-pic-1.jpg'),
]} />
那么问题来了。我试图在这个组件上实现简单的网络图像。喜欢
<RkGallery items={[
"uri:imageURL1",
"uri:imageURL2",
]} />
也不
<RkGallery items={[
<Image style={{width: 150, height: 150}} source={{uri: imgURL1}} />,
<Image style={{width: 150, height: 150}} source={{uri: imgURL2}} />,
]} />
然而我无法实现它。任何人都可以帮助我吗?
解决方案
看起来您已经具备此能力 :) 如果您查看资源,您应该会看到,这些RkGallery
项目是RkGalleryImage。当您将项目数组传递给 时RkGallery
,它会通过道具将其一一翻译到每个 RkGalleryImage 中source
。这个 prop 的工作方式与普通的 react-nativeImage
组件相同。所以你可以像这样使用它:
<RkGallery items={[
{uri: 'https://path-to/my-awesome-pic-0.jpg'},
{uri: 'https://path-to/my-awesome-pic-0.jpg'},
]} />
推荐阅读
- c# - Dropbox.GetFileList 只返回有限数量的文件
- javascript - 错误 socket.io net::ERR_CONNECTION_TIMED_OUT
- asp.net - 如何将多个应用程序加载到单页应用程序中
- html - 旋转文本后如何自动调整容器/父级的宽度?
- javascript - javascript alt/花式文本生成
- javascript - 使用节点检查器 CLI 调试 typescript 时显示原始 typescript 文件
- excel - 从同一工作簿中的另一个工作表读取数据的用户定义函数
- c - C中的字谜测试器
- java - 如果语句和布尔问题?
- javascript - 写入和读取文件可能会进行currying和回调吗?