Does facebook's newsfeed use Flatlist in react native? - facebook

I wonder how they manage dynamic content heights in flatlist if they do. Because in flatlist to handle lots of items, we need to set getItemLayout which needs exact height of the content.
Or What might they use in Newsfeed unless it is flatlist from React Native?

Related

Get an image from a canvas HTML element in flutter?

In my flutter application, there is an image I would like to show that comes from another website. On that website, the image is actually a <canvas> element in HTML. I have seen resources about turning the Flutter Canvas into an image, or turning one's own <canvas> element into an image in JavaScript, but never anything about getting it from an external page.
The site I am trying to use is the NOAA Radar view. I could use a WebView to show the entire site but that seems needlessly heavy when I just need a still image.
What would be the best way about getting a still image from the site's <canvas> tag. I tried performing a http GET on the URL but there is no <canvas> tag present there when I do it in curl (via the html package). I believe this is because the canvas is rendered with JavaScript after the page loads.

Flutter: How to do responsiveness for "real" mobile/web applications?

I saw many articles and videos on how to do responsive design in flutter.
But they all have in common, that they show a standard web page with menu, pictures, text.
What I call "real" in the title, means a full interactive application, so with displaying tables of data, providing input fields and other input elements, showing charts, ... - so all the interaction of a "real" application, not just a web site.
Simple example: If I have a large data table on a desktop screen, it has to be different on a mobile screen to show data in a way, the user can read it and use it sensibly.
So, how do I make the app responsive for all screen sizes without having to implement something twice or have case distinctions all over the place?
Refractor codes into widgets. (very important to reduce boiler plates)
Create an idea on how the webpage will look like based on 12 grid system
In build method check for screen size and return layout based on the screen size.
Please note
The widgets should be responsive by itself based on the size available. For example a chart widget. It should build a chart within the space provided by its parent.
There may be instances where in desktop some elements are in a row and the same element will be in a column in mobile. So you can also write sections like banner section (define web and phone layout), about us section etc so its easier to manage
Use wrap widget to automatically bring widgets down based on screen size
Use BoxConstrains and max width to control a Containers max width
For tables you can use packages like responsive tables

React reverse engineering facebook / messenger chat input

I'm trying to recreate with React the chat input of facebook / messenger.
Until now, I understand that the chat input is a custom input for typing messages build with a <div /> where the attribute contentEditable set to true. This custom input grows up with a min-height to a maximum height.
Once the maximum height is reached, the custom input set a scrollbar to scroll his content.
I'm trying to figure out how this is handled with props of the custom input and the state of his mother component but I don't really see how to do it properly.
Is there a way, a tutorial or something else to do it ? Or to have good behaviours of the chat input ?

Use rems in Facebook Page Plugin

I want to set up Page Plugin on my website to display nicely on screens with a variety of resolutions and pixel densities. In order to truly achieve that, I'd have to have to possibility to use rems in data-width attribute. Unfortunately, when I enter a rem value, the data-width attribute is ignored.
Is there a way to make the plugin behave nicely with rems?
To make the Facebook Page Plugin responsive on initial page load, instead of using rems, you'll want to remove the data-width attribute and instead add
data-adapt-container-width="true"
This will make the Facebook Page Plugin responsive, but only on the initial page render, with a minimum width of 180px.
I'm still trying to figure out how to make it truly dynamically responsive, in spite of Facebook's caveat (I'll post an update if I ever find the answer).
No Dynamic Resizing
The Page plugin works with responsive, fluid and static layouts. You
can use media queries or other methods to set the width of the parent
element, yet:
The plugin will determine its width on page load.
It will not react changes to the box model after page load.
If you want to adjust the
plugin's width on window resize, you manually need to rerender the
plugin.
Source: https://developers.facebook.com/docs/plugins/page-plugin
You could make it dynamically responsive by reinitializing the widget on browser resize, but by doing that you run the risk of eating up memory very quickly.
There is some other stuff you can try here as well
Responsive width Facebook Page Plugin

GWT Cell Callback

I am writing a custom cell for GWT, but the data to be displayed will be fetched asynchronously (REST call). How do I make the rendering asynch for the cell?
I see ImageLoadingCell shows a spinner, then shows the image when it is loaded, this is done by a browser event, however, since mine is a REST call, I can't use the onBrowserEvent() method, and hence, I don't have a handle to the Element, to refresh its information.
I'm thinking maybe I have to do this through table.refresh()? I'd really like the render method to trigger the fetching however.
If you look at the goals of cell widgets, then I don't think this is possible and definitely not desirable :
Cell widgets (data presentation widgets) are high-performance,
lightweight widgets composed of Cells for displaying data.
I have faced a similar problem : suppose you have a Contact with a List of tags but only the tagIds are stored with the contact. To visualize the tags in the table, you would have to make callbacks to the server to get the names.
The solution is in using the adapter pattern. Create a ContactAdapter that holds the contact and the actual tags instead of the tagIds. Pre-fill the contact adapters with the tags based on the tagIds and set the List as the datasource for your celltable.