I am implementing a slide menu. Below is my view. $.MenuWrapper is of full width with transparent background and $.menu width is "70%" with white background
<Alloy>
<View id="MenuWrapper">
<View id="menu" >
<TableView id="Nodes" />
</View>
</View>
</Alloy>
Now to close the menu I want to drag $.menu and once it reaches the left end then only it should close the entire menu like many App does. Please help
I think that you are trying to implement a DrawerMenu style yeah?
Well, that is not an exactly answer to your question, but I think that you can embrace the flexibility of the Alloy Widgets and the power of Titanium community to reduce your development time focusing in your business logical and not implementing things that someone else already did.
Here is a good DrawerMenu widget powered by #FokkeZB
https://github.com/FokkeZB/nl.fokkezb.drawer
You can also check ready-to-use widgets here
Related
Sorry if this has been asked previously, but I hadn't found a working answer.
I'm currently working on a simple app. The main screen features a vertical flatlist with user generated content. The header, though, is transparent and has a predefined height, so the user can see a background image; when the flatlist is scrolled, it covers this background image, which remains static. The goal is to give the user the feeling that they're covering this image, similar to the pull-up element on google maps, which covers the map to show more data.
This would be a simplified example of the current, working code, so you get the gist of it:
const HomeComponent = () => (
<View>
<ImageBackground source={require('../assets/background.png')}>
<Flatlist
headerComponent={<TransparentHeaderOfPredefinedHeight/>}
data={DATA}
renderItem={renderItem}
keyExtractor={item => item}/>
</ImageBackground>
</View> )
Up until here, everything is fine. The thing is, I would like to add a touchable button on this background, that is subsequently covered when the Flatlist is scrolled.
Here's the issue. I have no way to make the touch event propagate through the flatlist's header and reach this button. I tried using pointerEvents='none' and 'box-only' in different combinations, but whenever I was able to touch that button, I was in turn unable to scroll or to interact with the flatlist elements.
I also tried pushing the background image and button on the flatlist header, and using the vertical offsite of the flatlist scrolling to move these elements and simulate the flatlist scrolling over it. Unfortunately, the result was absolutely atrocious, lacking any kind of smoothness.
Does anyone know how I could implement this functionality? I can provide more info if needed. Thank you in advance!
I would like to remove my "Load more" button from my application and implement a "inifinite-scroll" type of feature, which allows users to scroll up through their message history and download older messages as they're requested.
I'm moving to the FlatList component due to ListView being depricated and I'm trying to figure out a nice implementation for determining when the user has scrolled to the top of the page. Due to the fact that a FlatList always starts at the top of the list, we want to make sure to only call onTopReached when the user is scrolling through the list.
How can I go about this?
Links to open-sourced implementations will be appreciated, but should be listed as a comment and not an answer. Implementations using the ListView are irrelevant.
In this case, you can use refresh control for this purpose.
You can do it similar to this
<FlatList
data={feedList}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
refreshControl={
<RefreshControl refreshing={isloading} onRefresh={this.handleRefresh} />
}
/>
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).
I'm trying to get an element in a scrollview to always stay to the left of the screen. Kinda like the number rows in Excel. They stay to the left when scrolling horizontally but scroll also down when scrolled vertically. So far I tried animating the element by hooking up the onscroll element to it. It does work but it feels very choppy. It is fast but not fluid. Almost looks like the element is vibrating.
Are there any other techniques in react native to get the desired result? Here the important lines I'm using.
scrollPositionX: new Animated.Value(0),
scrollEventThrottle={16}
onScroll={Animated.event([{nativeEvent: {contentOffset: {x: this.state.scrollPositionX}}}] )}
<Animated.View style={[styles.times, {
transform: [{translateX: this.state.scrollPositionX}]
}]}>
...
</Animated.View>
A crude way to do it is to render the sticky columns outside of the horizontal ScrollView. Just make sure your stick and non sticky cells end up being the same height so everything lines up.
If you want to scroll vertically as well, wrap them both inside of another ScrollView.
<ScrollView>
<View>
// render the sticky cells
</View>
<ScrollView horizontal={true}>
// render the non sticky cells
</ScrollView>
</ScrollView>
The problem is that if you have a lot of rows, especially with more complex components within them, you'll have performance issues.
ListViews are better at handling lots of data, but I haven't found a way to make use of them for this scenario. You'd need one for both the sticky column and normal cells, and there's no way to keep them in sync without watching onScroll as you're doing.
I'm hoping someone has better way to do this though. I really need this functionality as well.
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.