Get the count of words that spills out of the view react native - react-native

I have a view which basically shows selected car's brands as text inside the view. But I want the count of the remaining car's brand whenever the text overflows the parent view.
See the image below for more info
see image
I tried using onLayout of text to calculate the max character count that can fit in the view but that doesn't work properly. Any help on this?

Related

Determine the size of chart bar in flutter

I am trying to create a chart that displays the data that came from the api that is supposed to be like this image
as for the date and the size of the columns, no matter how many data are coming
I have two problems:
1- I don't know Make the widget flexible so that the column always appears the same size
2- I don’t know. Make the date the same as what is needed. It is displayed in the same form in the API
how can I fix it
For making a widget flexible and appear the same size you can use BoxConstraints by adding Container or SizedBox as parent widget and defining height and width.

Android: Horizontal RecyclerView Layout with Cards is cutting off the bottom of larger layouts

It seems that the later cards (1st photo) are being cropped to the size of the biggest card that’s in the initial view (see card marked with red in 2nd photo). All the cards that would be bigger than that have the bottom of the view cut off/wrapped. I’m using a MaterialCardView with a ConstraintLayout inside that holds all the views you see in the card. The CardView, ConstraintLayout, and RecyclerView all have layout_height=wrap_content. I've tried changing setHasFixedSize() and a number of other random things around layout_height/width.
Any ideas to why that would be happening?
probably you put a android:layout_marginBottom on red marked card and using that for all of your cards . that will prevent the cards to show they're full content .
you can make you font or images smaller or change that android:layout_marginBottom

Create A view with fixed percentage of width in all orientations in React-Native

I want to create a view - that contains a Card - always with '90%' width of the window, whenever the device is vertical or horizontal, or Component is in a parent or not.
What I tried:
1 Using percentage
( width: '90%'):
It works well if I use my card separately on the main view of my screen, but when I use my card on a horizontal ScrollView with other cards I can see many cards, but I want to see only one card before scrolling.
2 Using React.Dimensions
( Dimensions.get('window').width*0.9 with some padding) :
It works perfectly when I use a card separately or even with many inside a scrollView but when I change the orientation of the screen it takes less width of the screen than '90%'.
3 Using flex basis based on this answer
Is there any better way to achieve my goal?
You might wanna look at this package https://github.com/marudy/react-native-responsive-screen
This package doesn't require any orientation change support. It's just one file actually, so you might wanna take a look at that

live tiles in Windows Phone and Grids

I'm trying to create a live tile for my application, using a user control.
The user control contains a grid, an image and a rectangle filled with color.
Now here comes the funny part.
I want the rectangle to act as a background for the tile's title, and the image to fill the rest of the tile. And i said to myself, well, lets put some rows in that grid and set the like you usually set them in a WPF/SL application.
I then write the entire thing in a WBM and save it to isostore.
The problem is, the parser seems to ignore the presence of grid's rows. regardless of what I try, the rectangle is not shown, and the image covers the full tile, when it should only cover the first row. It is as if the grid didn't even existed.
Another funny aspect is that it doesn't matter if I use rows or columns, the result is the same.
Any ideas?
Are you using the following method?
Dynamic LiveTile - adding background image?
I recently implemented a Live Tile using a Grid with Rows and Columns for layout of some TextBlocks. I encountered similar challenges, so I placed the control that I was using for my Live Tile on a blank page in my app to better see what was happening. Does the control render correctly when displayed on a page (versus being rendered to a WriteableBitmap)?
Another idea. Instead of trying to position the Rectangle relative to the tile's Title, why not leave the Title property blank and put the same text in a TextBlock within the user control?
If you are careful about the font and positioning of the TextBlock, the text on the resulting background image can appear indistinguishable from text displayed from the Title property. I decided to follow this strategy myself. I found the font information in the following answer:
Font size and family for a tile's title
Otherwise, could you post an example of the XAML you are using?

How does the Reeder Mac app animate lists when switching folders?

Initially I was under the impression that it uses the table row slideup/down animations while inserting/deleting new rows but I doubt if it's doing that as it does it so fluidly even with thousands of items in the list (otherwise it would take a lot of time for the deletions/insertions to work).
Am I right in my assumption that it's simply attaching a new instance of the News list at the bottom of the screen, shrinking the above one while the one at the bottom expands to fill up space?
UPDATE:
Please see this video of what I mean: http://dl.dropbox.com/u/4960327/ReederAnim.mov
I can not tell you exactly how Silvio Rizzi made this, but as you see in the playback, a list view is added behind the shown list view, and the front list view fades out (.alpha = 0.0;) while the list view behind it expands its height per row.
When you desicate it frame by frame it becomes quite clear what he does, and it is really not that advanced. But I have to admit, with the white "milky" polished interface, it looks quite neat.
In addition, you can see that while animating, the background list view only renders the top 7 entries (hopefully calculated by dividing the view height with the average height of the cells shown) making the list view quick to load. Then afterwards, he can load an extended array of cells once you start scrolling, or in a background thread starting once the animation is complete.