I'm using Titanium 3.4 and Ally 1.5.1 for a crossplatform app (iOS and Android).
I have a problem with my TableViews and ScrollViews. When the content is larger than the screen, the Views are correctly scrollable but on iOS when I use a swipe gesture the view keeps scrolling for a bit until it comes to a stop. On Android however, as soon as I pull my finger from the screen it stops scrolling.
I've installed the "Todo list" sample app and it doesn't have this behaviour on Android, after a swipe the list keeps scrolling.
How can I activate this continuous scrolling feature on Android? (or how did I accidentaly deactivate it)
A sample view:
<Alloy>
<View id="experiencesList">
<View id="contentWrapper">
<TableView class="cTable" id="experienceTable" onClick="experienceListOnClick"/>
</View>
</View>
</Alloy>
A sample tss:
"#experiencesList":{
width: Ti.UI.Fill,
height: Ti.UI.Fill,
layout: "absolute"
},
"#contentWrapper":{
top: "0dp",
height: Alloy.Globals.appConfig.contentHeight,
backgroundColor: "white"
},
"TableView":{
height: Ti.UI.SIZE,
top: 0,
separatorInsets: {
left: 0,
right: 0
},
scrollable: true,
separatorColor: "black"
},
"TableView[platform=ios]":{
scrollIndicatorStyle: Titanium.UI.iPhone.ScrollIndicatorStyle.BLACK
}
Do you have a 'swipe' event defined somewhere? I've experienced this on Android when I have a horizontal swipe on a Listview that also has vertical scrolling.
The issue below from Titanium resolved with a "Won't fix" is stating that this is standard Android behavior:
The swipe event is eating the scroll event. This is expected behavior
with the current Android architecture. Swipe event is not recommended
to use along with a scrollable widget.
https://jira.appcelerator.org/browse/TIMOB-16344
Related
I have been facing an issue with clearButtonMode property of UiTextField in my input box. If I use app in light mode then everything work well but the moment I switched to dark mode that clear button is not at all visible in input box.
So, Just want to know is it Possible to add backgroundColor to that button for dark mode?
Or is there any possibilities to make it visible in Dark Mode.
I have attached the code and screenshot of my problem.
Here is text Field code.
var checkField = Ti.UI.createTextField({
width: Ti.UI.FILL,
height: 30,
top: 10,
left: 10,
right: 10,
color: '#000000',
backgroundColor: 'white',
tintColor: '#000000',
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
returnKeyType: Ti.UI.RETURNKEY_DONE,
clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ALWAYS,
});
Screenshot:
Thanks in Advance!!!
it looks like it is a very light grey (when you set it to a dark backgroundColor you'll see the X again.
But it looks like it is native behavior:
https://developer.apple.com/forums/thread/124973
and you'll need to create a custom textfield image (https://stackoverflow.com/a/10274246/5193915) but that means inside the SDK.
As a quick workaround I would just create an image and place it on top of the TextField and move it to the right corner.
I want to create an overlay on top of react-native camera. However, I want only the center area to be clear and all other area to have some overlay with small opacity.
I have created component which acts as a wrapper and add corners, but I can't get overlay except in center. If I add overlay with background opacity it applies to whole screen including center box.
This is what I have so far.
<Camera style={[cameraStyle.camera]}>
<CustomView center style={[cameraMarkerStyles.container]}>
<CustomView
transparentBg
spaceBetween
style={[cameraMarkerStyles.cameraMarker]}
>
<CustomView row spaceBetween>
<CornerBox status={status} position="topLeft" />
<CornerBox status={status} position="topRight" />
</CustomView>
<CustomView row spaceBetween>
<CornerBox status={status} position="bottomLeft" />
<CornerBox status={status} position="bottomRight" />
</CustomView>
</CustomView>
<CustomView
style={[cameraMarkerStyles.container, cameraMarkerStyles.overlay]}
/>
</CustomView>
</Camera>
Bascially I add a View which is center area, which has 4 boxes at all corners which create the border. And then at the end there is a View which acts as overlay for whole screen. Now that last View if I change the background color to something other than transparent, it covers center area as well.
I have tried changing zIndex, set it to -1 as well. However that also did not work.
One very dirty solution that I have is I can place a View above center area and below center area and on each side of it and then give those views as some background and opacity. In that way we can add overlay just apart from center area.
Does anyone know any good way to implement such kind of layout? Even simple idea is enough, I don't need whole code.
Adding styles just in case anyone needs to see.
const markerSize = 250
const cornerBoxSize = 50
const cornerBoxBorderSize = 5
const cameraMarkerStyles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
},
overlay: {
zIndex: -1,
backgroundColor: 'rgba(0, 0, 0, 0.2)',
},
cameraMarker: {
width: markerSize,
height: markerSize,
},
cornerBox: {
width: cornerBoxSize,
height: cornerBoxSize,
},
topLeftBox: {
borderTopWidth: cornerBoxBorderSize,
borderLeftWidth: cornerBoxBorderSize,
},
})
const cameraStyle = StyleSheet.create({
camera: {
height: Dimensions.get('screen').height,
backgroundColor: 'transparent',
},
})
we talked about this on Twitter but I wanted to make sure the proposed solution was logged...
I suggest you create four translucent gray boxes for the four sides of the screen. The center of the screen will be blank and those four boxes will form a mask on each side of the center-area
I have a simple progress bar, it has a borderRadius and overflow set to hidden. I have a child of this, it has no borderRadius, and it is overflowing outside of the corners. Here is my markup:
<View style={style.progressbar}>
<View style={[style.progressbarfill, { width:'50%' }]} />
</View>
const style = {
progressbar: {
backgroundColor: '#ccc',
height: 25,
width: '90%',
borderRadius: 12,
overflow: 'hidden'
},
progressbarfill: {
backgroundColor: 'springgreen',
width: '10%',
height: '100%'
}
}
This is what it looks like:
I put arrows on where the green is covering the border. The green should not overflow outside the edges.
Does anyone know why this is?
Actually I'm testing it right now, seems to be working fine on iOS, but Android is the one having the issue with the overflow right now. It looks like that is still getting more support currently. A temporary fix, is to just add the same borderRadius on the progressbarfill.
Here is the issue on the React Native Docs:
The overflow style property defaults to hidden and cannot be changed
on Android This is a result of how Android rendering works. This
feature is not being worked on as it would be a significant
undertaking and there are many more important tasks.
Another issue with overflow: 'hidden' on Android: a view is not
clipped by the parent's borderRadius even if the parent has overflow:
'hidden' enabled – the corners of the inner view will be visible
outside of the rounded corners. This is only on Android; it works as
expected on iOS. See the corresponding issue.
I found that, in addition to overflow: 'hidden' needed on the parent, I also needed backgroundColor: 'transparent' added to the parent
Edit: I also found that sometimes testing this required a refresh of my app.
I have a scroll view defined in the XML file for a controller:
<ScrollView id="searchResultsContainer"/>
In the TSS, I show the scrollbar indicator to true:
"#searchResultsContainer":{
backgroundColor: "#fff",
layout: "vertical",
width: "100%",
top: "65dp",
height: "400dp",
showVerticalScrollIndicator: "true"
}
How do I set the colour of the scroll bar? It is currently grey and not very visible on a grey background.
You can edit these properties, create a new custom theme, you can set them to a 9 patch image for example.
In my app I'm using <ScrollView /> to view pages of a book scrolling horizontally. When a user gets to the end of the <ScrollView /> there is a bounce that shows a white area to the right that is only visible if the user drags the last page to the left. I want to add some text there that says "The End" vertically. How can I add content to the right of the <ScrollView /> in the bounce area?
I ALMOST figured it out. This is close but shows up in the right side of the last page but not off the page on the right in the bounce area. I want it to show up "to the right of the page" not "on the right side of the page." Any other ideas?
Create a <View style={styles.end} /> with this style:
theEnd: {
position: 'absolute',
top: 0,
right: 0,
width: 100,
height: 768, // Device height
alignItems: 'center',
}
Place it right before the <ScrollView /> and put whatever you want to show inside of the View component with the "theEnd" style.
This probably doesn't apply to your content, but I had the same situation except with a large image for the ScrollView content. I wanted both horizontal and vertical scrolling, where the edge of the image would show up only in the bounce margin. I figured out that the scale transformation works great for this:
<ScrollView horizontal={true}>
<Image
source={require('./img/map.jpg')}
style={{transform: [{scale: 1.1}]}}
/>
</ScrollView>
So the image takes up 110% of the height and width of its box (which is then inside a yet smaller ScrollView).
EDIT: FYI, after testing, discovered this only works on iOS, not Android. (Android won't allow vertical scrolling if you set horizontal to true, and also I think it didn't render the parts outside of the normal viewing area, so the bounce margin was empty.)
there is a prop for this called contentContainerStyle
<ScrollView
horizontal={true}
contentContainerStyle={{
paddingLeft: 25,
paddingRight: 25,
}}>
*** CONTENT ***
</ScrollView>