Is there a React Native utility for drag-to-expand panels? - reactjs

I have a React Native App (using Expo) and I’m trying to implement a map/search layout similar to what is in Yelp or many other location-based hybrid map/search views (eg I checked all of the food related apps on my phone :slight_smile: McDonalds, Starbucks, DoorDash):
Specifically, I’m curious how to create that sort of draggable panel from the bottom, where you can drag it so that it overlaps the map.
Yelp/DoorDash technically have 3 states for this bottom panel: a completely collapsed state, an intermediate (default) state, and a completely expanded state, and you can even flick from completely collapsed to completely expanded.
Is there a standardized way to accomplish this with React Native? (I'm a little out-of-touch with the RN ecosystem.)

Ahh, here's a third party library where this behavior is implemented, and even the example in the documentation is off a map searchview. https://github.com/octopitus/rn-sliding-up-panel

Related

How to check if a component appears after scroll to bottom in react native

I created a screen whose information is taken entirely from the database by APIs.
It has now been made so that all parts are loaded in 'componentWillMount' Lifecycle, and this has caused the loading speed of my screen to be very time consuming.
I want to design the screen in such a way that when the user scrolls down, it is checked whether the component appears on the screen or not. So if the desired component appears after scrolling down, I can call the functions of that component and get the information of that part from the APIs.
I do not know how to do this.
What is the best way to do this? Is there a library that can do this for me?
I spent about 2 hours searching for this goal but to no avail.
I also found libraries for ReactJS that unfortunately can not be used in React Native.
Thank you in advance for your support.

Make View render while swiping up with PanResponder

I am able to change the position (swipe up) of my View accordingly with PanResPonder. The problem is during the swipe motion, the content of the View being dragged for the swipe do not render.
I tried using flexGrow:1 and flex:1 so as the View enlarge with the swipe, the View would be getting filled by content.
I know there a few libraries out there for swipes but I think this is fairly doable without library.
Thanks in advance cheers.
It really depends on your approach there. First things first.
You have to understand about JS Bridge and Native on react-native. The JSBridge is single-treaded and all the fired renders go through there. It means you can easily get dropped on FPS if you do not take it into account. The Native, well, is native code running, thats all.
To have performant app, you have to keep the passes over the bridge to a minimun.
The PanResponder touches happen on the native side, while the component renders use the bridge. You should put some code there, but i would bet that the problem is with too many renders happening and the JS Bridge gets overloaded.
Also try to use Direct Manipulation (https://facebook.github.io/react-native/docs/direct-manipulation.html) to avoit rendering one entire tree and perform it on the native side.

Place Image above another image dynamically in ReactNative App

I have an iOS app in which, we take user pics, and then allowed them to put some random custom images above the pics.
While placing these custom pics above real image, they can rotate, scale these custom image. ( See this StickerViewIOS )
Now I am looking for exact same solution while making ReactNative.
Tried lot of Googling but no results found.
Just want to ask community if any of the ReactNative component available for the same.
Thanks,
There's no rotation support, but I did something similar for an app I made for Chain React.
Here's the image component that supports gestures: https://github.com/cball/ChainReactPhotobomb/blob/master/App/Components/TransformableImage.js
To overlay them on top, just use the ImageBackground Component

Ionic framework vs Famo.us

What is the difference between Ionic Framework vs Famo.us Framework. It is possible to use both framework in one project . Which One support smooth render graphic on mobile devices ?
Both framework support AngularJs?
Both frameworks work with AngularJS, but they come from a different direction and have different goals.
Ionic
is built on top of AngularJS and extends it, providing you with buttons, grids and other ready made UI elements to help you publishing your mobile app real quick. AngularJS focuses on data binding and the MVC structure of your app and doesn't really care about whether it's running in a desktop browser or on a mobile device. Ionic concentrates on the presentation of your app data and extends AngularJS to make it fit for use on mobile devices and supply you with design patterns that mobile users have come to expect. Since Ionic sits on top of AngularJS, you can't really have Ionic without Angular.
Check out Ionic's components to get a better understanding.
Famo.us
on the other hand strives for the fastest render performance. It just so happens that you can put regular HTML into a Famo.us Surface — which is the container that holds the content to be displayed. That content can be HTML, but doesn't have to.
Famo.us itself doesn't use the standard HTML reflow to position its surfaces in the viewport but its very own implementation of a render tree, so you're free to manipulate surface position and rotation, even in 3D space, with buttery smooth performance. HTML that is put inside a surface on the other hand uses reflows to position its elements just like you're used to. Read more about the render tree.
Famo.us can output to HTML, but can also render using WebGL or even Mixed Mode, combining DOM with WebGL. This allows for fancy graphic effects that wouldn't be quite possible with plain CSS. There's also tight integration with Easing and Physics to allow for playful and realistic animation.
Now that there's Famo.us/Angular, I don't see why you couldn't use Ionic and Famo.us in the same app, although I haven't tried it yet.
Summary
Ionic sticks with the regular DOM for rendering and focuses on mobile design / UX patterns. Famo.us disregards the DOM and lets you (read: requires you to) build / populate the render tree, provides physics and allows for more complex and fluid animations. This also means that using Famo.us comes with a learning curve. Good thing is: you don't have to go 'all in', since you can build certain views of your app with Famo.us and then use regular HTML/CSS for everything else.
ionic lists work well when famous is loaded in the same index.html SPA.
Some things like touch to pan in angular-google-maps stop working when ionic and famo.us share the same page.
Transitions from a ionic tabbed state to a detail view using ion-nav-bar animate badly too.
So i recommend you to keep things separated just by switching your app from famous.html to ionic.html as needed. each implementation having its own stack of dependencies and its own separated styles as they come in the sample apps.
you can transition by using document.location.href
i think you can find a way to transition to specific states from one world to the other by setting the proper state in the url.

Nested dropdown menu in Bootstrap in mobile

I'm building this website using bootstrap.
The problem is that i have nested drop downs. The dropdowns look nice and not cluttered in desktop version.
However this is how it looks in mobile:
They look cluttered, and you can't fold/unfold the deepest level of dropdowns. It just doesn't allow this.
I'm thinking there are better ways to represent information in mobile view. My approach was when person touches 'buildings/land' tab, i replace bottom navbar with contents of Buildings/Land, thus reducing one level of dropdowns.
Question:
I'm really not experienced in developing UI. Is my approach sufficient?
How should i solve this problem?
I use a sweet JS plugin that plays nicely with Bootstrap, called Snap.js. If you've ever used the Facebook iOS app, you'll be familiar with this layout. There are some great demos here.

Resources