简体   繁体   English

react native如何做复杂的设计?

[英]How to make complicated designs in react native?

I am new to application development.我是应用程序开发的新手。 I want to make a tabbar like below in the application, but I can't.我想在应用程序中创建一个如下所示的标签栏,但我不能。 I tried to do it by styling, but it doesn't responsive.我试图通过造型来做到这一点,但它没有响应。 How can I do that?我怎样才能做到这一点?

在此处输入图像描述

There is such a thing called constraints which is the positioning of the elements on mobile devices, if you understand how that works it will be easier for you,https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout.有一种叫做约束的东西,它是元素在移动设备上的定位,如果你了解它是如何工作的,对你来说会更容易,https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout . I know this is not the answer but the mobile styling is different from web, you can check this flexbox implementation too for reference: https://www.javatpoint.com/react-native-positioning-element-with-flex我知道这不是答案,但移动样式与 web 不同,您也可以检查此 flexbox 实现以供参考: https.compositioningpoint-with-flex-act-native://www.java-element-with-flex-act-native.

try below steps.尝试以下步骤。

  1. create round view ( height = width, borderRadius=height/2)创建圆形视图(高度=宽度,边界半径=高度/2)
  2. add border with like 10-20 with border color添加边框颜色为 10-20
  3. make it absolute and alignSelf to center.使其成为绝对并将 alignSelf 居中。
  4. new create new view for bottom bar with background color and height, width:'100%'新创建具有背景颜色和高度的底部栏的新视图,宽度:'100%'
  5. add rounded view after bar view and give ( bottom = <apropriate value to keep round little up )在条形视图之后添加圆形视图并给出(底部= <适当的值以保持小幅向上)

For these kinds of unorthodox shapes, its better to make your own shapes with SVG and do animations with reanimated libraries.对于这些非正统的形状,最好用 SVG 制作你自己的形状,并用复活的库做动画。 You will find a lot of similar works in GitHub.你会在 GitHub 中找到很多类似的作品。

This might actually help you, https://github.com/nomi9995/react-native-curved-bottom-tabbar it is not exactly your requirement but you will figure it out if you go through the code这实际上可能对您有所帮助, https://github.com/nomi9995/react-native-curved-bottom-tabbar这不完全是您的要求,但是您会通过代码弄清楚 go

This one too https://www.npmjs.com/package/react-native-curved-bottom-bar这个也是https://www.npmjs.com/package/react-native-curved-bottom-bar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM