It’s a relatively new concept and may be confusing to use for the very first time, but all it does is simply make your app look good across all devices. To make this transition easier, Apple introduced Auto Layout. Fast forward to today, it has become quite frustrating to design an app that supports different screen sizes. Originally Apple had only one screen size, which was developer friendly since they did not have to be terribly flexible fitting into different screen sizes. It can be any number you like depending on the expensiveness of the drag you want to achieve.Have you ever had trouble designing an application to look good in both landscape and portrait orientation? Do not despair! Auto Layout is here to the rescue. Through this, we can pass in the latest value of the x axis. Initially, we don't want the drag to enable, hence we pass in 0.Īs for defining the coordinates of how much drag is to be done, the useTransform hook will help us. To achieve the actual value of the x we passed on the drag prop, we'll be using the useMotionValue hook which tracks the state and the velocity of the dragged element. Here, we do it horizontally so it's the x axis. So, on tapping the logo, we first need it to scale a bit, hence we add the scale property to the whileTap prop and for the drag, we need to pass on which axis dragging is to be done.
0 Comments
Leave a Reply. |