Need help to change markers based on horizontal scrolling on list react native - react-native

i need to highlight the marker based on the corresponding restaurant selected in the horizontal list and on scroll the marker highlight needs to change
any tips or example code to achieve this would be a great help.
i'm using react-native-maps library
Thanks.

If you map list elements with the markers on creation, you can retrieve which element is displayed like this:
int last = listView1.getLastVisiblePosition();
int first = listView1.getFirstVisiblePosition();
so after scroll, when you notify change to adapter, you can change color of specific marker:
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
Hope it helps.

Follow these steps to achieve this:
Set resturantId as Tag to each Marker.
Add scroll listener to your ListView and on scroll stop get the position of
of last visible item like this: int last = listView.getLastVisiblePosition();
Get the id of the current focused item and apply a Loop on All markers and if Tag of marker matches with the resturantId then change marker icon accordingly and a different icon for all other markers.
This would help you.

Related

Textbox scroll to bottom in Avalonia

I have a textbox that I write info to that automatically creates a scroll bar when the screen is filled, and I'd like to scroll to the bottom of it. It seems like what I need to do is set the scrollbar Offset to some vector, but my problem is finding the ScrollViewer.
I can't use FindControl because it's not named anywhere in the xaml, and I can only change a few values using textbox.SetValue
The only way to scroll a TextBox currently is to set the CaretPosition. For example to scroll to the end of the text you could use:
textbox.CaretIndex = int.MaxValue;
For me it works only when I set textbox.CaretIndex to the length of the text. Assuming that property Logs (string type) is binded to textbox I used this
textbox.CaretIndex = Logs.Length

Spinner on clicking an item in DetailsList

How do I show a spinner in a DetailsList? For instance, let's say I have the following items in a DetailsList:
list of items
On clicking the item with the name 'AdipiscingUt.onetoc', show a spinner on the rightmost side of that item (next to 125 KB). Please let me know if you have any suggestions on the same.
Thanks!
You can use selection attribute in <DetailsList> component to catch the selection events. Then create extra column with hidden spinner and display it via selection event.
At least I had the experience when I needed to display the icon status according to each item. I added unique id per each item (using onRender method for columns attribute in <DetailsList>) and use it for identification.

How to get size of a View before render it for react-native FlatList getItemLayout

I need set initialScrollIndex on FlatList to 1, so second row will be visible on initial loading. It's depend on getItemLayout.
My FlatList cells contains text of different length, which leads to different height of each cell, which leads i can not return fixed value in getItemLayout.
My strategy is:
On load, iterate through dataset for list and calculate height of each row
Cache calculated data into array or dictionary
Return cached data inside getItemLayout depend on index
The problem is - i can not find the way how to calculate the height of an view before it will be mounted into DOM hierarchy. I read a lot about onLayout prop, but it looks like View should be rendered first to get it to work.
So, what do you use to achieve scrolling to specified row in react-native when list cell is not the same for each row?
My first thought - try render it hidden, take size and make it visible.
EDIT: You also can try use react-native-text-size to calculate cell heights manually.
Try setting scrollToIndex or scrollToItem in your flat list
https://facebook.github.io/react-native/docs/flatlist.html#scrolltoindex
see the other methods you can use to scroll to a specific location on your list
https://facebook.github.io/react-native/docs/flatlist.html#methods

how to combine bing map and list view?

i have a bing map in my application. All stored locations from my db are displayed on map as pushpins. On the right of the map i have a list of this positions. What do I need to do to change the color of pushpin on the map after clickng the position on the list view ?
To do this you need some kind of data to link the list item to the pushpin. If you have a unique ID value to can store this as an attribute of your list item (Tag property works well). You can also store the ID value in the Tag property of the pushpin.
Then, when you want to set the selected pushpin, loop through all the pushpins on the map and check for the correct, id in the tag property. want to set the background color of the pushpins to the default value you want, and when you find the pushpin with the matching id, set the background color to the highlighting color.

get label from notebook tab

I have a gtk.Notebook and i want get text of label from current gtk.noteBook tab.
I make that:
text = self.get_tab_label(self.get_nth_page(self.get_current_page()))
if i print text i see:
But in gtk help i read that: get_tab_label_text: returnvalue: the text of the tab label, or None if the tab label widget is not a gtk.Label.
How can i get tet from label in this situation?
Thank you.
Any gtk.Widget can be a Notebook tab label. It is usually a gtk.Label, but not always. So two API methods exist to cover both situations:
gtk.Notebook.get_tab_label() returns a gtk.Widget that is the label widget. If it is a gtk.Label, you will need to call gtk.Label.get_text() to get the text.
gtk.Notebook.get_tab_label_text() returns a string of text only if the label widget is a gtk.Label, otherwise will return None.