Titanium: Is there anyway to fire an event when an imageView starts to load an image? - titanium

I want to display an indicator that an image is loading. I can successfully stop the indicator with the 'load' event, but is there any way to fire an event when the image view starts to load my remote image?
Thank you!!

if your indicator inside the image and the remote image doesn't contain alpha color, use this and you dont need to handle any event when image load it's will hide the indicator
<View height="Ti.UI.SIZE" width="Ti.UI.SIZE>
<ActivityIndicator visible="true"/>
<ImageView backgroundColor="transparent" image="https//..."/>
</View>

There are 2 ways to do that.
Show activity indicator when you set remote link and hide that on load event.
Use httpClient to download image and show indicator before calling xhr request and hide it on Success or Error callback.

Related

How to make PanResponder work as expected when user double taps by inadvertance while dragging his finger?

I'm trying to build a recording button where the user needs to keep pressing on the button to record, and then release the button when he wants to finish recording. Also, if the user releases its finger while outside of the button area, the recording gets cancelled.
I'm using a PanResponder to implement this behavior:
<View {...panResponder.panHandlers}>
<Button />
</View>
Everything works fine in the most cases. However, if the user taps somewhere else on the screen with another finger while recording (most often by inadvertance), then the PanResponder stops to capture the recording drag. The onResponderRelease method is not called.
I have no clue how to solve this. I want the recording drag to be resilient to extra touches.
I have tried catching and blocking any extra touch, if in recording state, inside the parent view but it does not work.
Any help is appreciated !

How to move up just specific elements, having keyboard enabled in React-Native?

I'm creating a chat screen in React-Native, and the issue which I'm confronting now with, is that when I enable the keyboard, the content doesn't move as intended. I tried several things, but neither of them didn't work as expected.
Here is a screen where I've marked the content which has to be moved up when the keyboard is present :
Firstly, I've tried the next structure
<ScrollView scrollEnabled={false} keyboardShouldPersistTaps="handled">
<KeyboardAvoidingView behavior="position">
/...The rest of the content.../
</KeyboardAvoidingView>
</ScrollView
and here's the screen
as seen in the image, the whole container is "pushed" up by the keyboard, and when the keyboard disappears, the content returns to it's normal position.
In the second case, I've tried to assign to the behavior parameter of KeyboardAvoidingView the value "padding", but this didn't help, the keyboard just was going over the screen, and the content didn't modify at all
And at least, I've tried to assign to the same behavior the value "height", and it seemed to work as I wanted, but the problem appeared when the keyboard was gone - the moved content didn't moved to it's initial position. Here are the screens :
Problem resolve, I had just to put the last container (the one where is the input placed) in a KeyboardAvoidingView with behavior="padding"

Is it possible to place a transparent view on top of another view and have clicks register to the bottom view?

What I am basically trying to do is place a transparent view on top of my entire screen but have clicks still fire on the visibile view underneath. The transparent view will have buttons on it, so I can't make the transparent view have a zIndex less then the bottom view or anything like that.
Wondering if this is at all possible??
Thank you!
This would be a hack.
You could call the click event of the each underneath element from the click event of the transparent layer.
You would need to figure out where on the transparent layer the user clicked.
Also, it would make altering the layout underneath a lot of work also as you would need to retest and make sure the click points matched up.
The underlying view components aren't directly accessible, as an inverse to bubbleParent. However, it may be possible by mapping x, y touch coordinates of the veil to underlying positions (and rect) of child components and invoking fireEvent on the target view. Not ideal, but could be a solution.
Do you really need to create a transparent view with buttons in it, or do you only need the buttons? If you use absolute positioning and zIndex for your button, and you would set the containing view to layout="composite", you wouldn't need a transparant view.
For example, the following code creates an image-view(full-width) with an icon overlay(or a button or whatever you want) on top of it:
<Alloy>
<Window class="container">
<View layout="composite">
<View layout="vertical">
<ImageView id="detailImage" image="/car.png" />
</View>
<ImageView id="backToMenu" image="menu.png" />
</View>
The icon is absolute positioned and there is a click handler assigned to it:
"#backToMenu": {
zIndex: 20,
top: 10,
left: 10,
width: 24
}
It works smoothly, and I can still click on the picture below too (except there where the icon is rendered).

Titanium JS: How to stop a generated list view from appearing underneath the keyboard

I have a window in my Titanium Alloy app which has a search bar. After submit the server returns a JSON feed which is then used to build a list view in the area underneath it.
The problem I have is that the list view takes up the whole space of the screen and a portion of it appears underneath the keyboard.
I could set a height on that list view, however I feel that this is not platform agnostic. The height for an iPhone 5 may differ than that of an Android device.
How can I ensure that the list view generated does not show up underneath the keyboard? Is there a clean, multi-platform way of doing this?
<Alloy>
<Window layout="vertical">
<SearchBar id="searchBar" hintText="Search all shows" showCancel="true" />
<!-- List view added here will not
show underneath the search bar -->
</Window>
</Alloy>
I just had to implement the same thing, but was not able to do so in a cross platform way.
For iOS i used a combination of Ti.App.keyboardFrameChanged with Ti.App.keyboardVisible. Set the functions to adjust the height of the listview.
For android i put a touchstart event on the first/main view of the template. When touched, hides the keyboard. iOS didn't always want to fire off this event if the listview started scrolling TOO quickly. Android worked just fine. Trying to put a touchstart event on the listview itself failed in every case.

Page flip App for Windows Store APP for Surface , Scroll view not working properly

We are developing a PageFlip application for our publication's electronic edition.
we have used some thing like this (this is not exact code)
<FlipView>
<FlipViewItem>
<scrollView>
<Image>
</scrollView>
</FlipViewItem>
<FlipViewItem>
<scrollView>
<Image>
</scrollView>
</FlipViewItem>
</FlipView>
But the problem is, when the image is zoomed and half of the image is not visible then, if i try to swipe to see the right part of image it snaps back to left part.As soon as my finger leaves the screen it goes back to previous position. Does any one has an Idea why it is happening.
User should be able to flip through and Zoom in/out pages.
I know this is a late response but I had the same problem. You need to set HorizontalScrollBarVisibility = "Auto" on the ScrollViewer.