如何在React Native中为产品详细信息创建可扩展的视图?
I'm having problem on creating an expandable view for the product details. Can anyone help me out on how to create an expandable view like the picture attached. I want like if a user clicks the product details container, it will show product details. Pls help me out as im quite new to react native.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,创建需要
扩展的ExpanableView组件,
prop。应在父组件中设置/更新道具本身(IS扩展
)。在此中添加效果依赖性,在ExpanableView中扩展了
prop以运行动画。请注意,每次exped
的值都会更改,它都会重新启动ExpandableView组件。确保仅在需要时才会发生重新读取,否则您将遇到性能问题。https://codesandbox.io/s/expandableview-qpkznz
/I.SSTATIC.NET/M8EZ4.GIF“ RER =“ Noreferrer”>
First, create ExpandableView component that requires
expanded
prop. The prop itself should be set/updated in parent component (isExpanded
). Add effect dependency to thisexpanded
prop in ExpandableView to run the animation. Notice that every timeisExpanded
's value is changed, it rerenders ExpandableView component. Make sure rerendering happens only when needed, or you'll have performance issue.https://codesandbox.io/s/expandableview-qpkznz