Comments (25)
Thanks, Nathan.
Is there a pseudo selector for the disabled
state on buttons yet? If not, that would be really valuable here, too. For example, when isEnabled=false
on a button, this should match:
.myButton:disabled {
...
}
from nativescript.
+1
This would be great. I'd also like to see nth-child pseudo class so we can easily style alternating row color on a listivew:
myListViewItem:nth-child(odd) {
background-color: #ff0000;
}
from nativescript.
would be great to have support for :before and :after as well.
from nativescript.
For the segmented bar, it would be ideal if it was possible to style the selected
background color via css pseudo selectors. In the case of the segmented bar, only the background color can be changed, but that would at least allow all of the styling to be done in the CSS.
.segmented-bar:selected {
background-color: #efefef;
}
from nativescript.
Agreed @burkeholland, although in the segmented-bar case I would argue naming it active
over selected
would be better for aligning with the web equivalent.
from nativescript.
For the benefit of this thread, the :highlighted
pseudo selector is now supported.
It behaves more or less like the :active
selector from the web. You can find more details in this issue: NativeScript/theme#4.
from nativescript.
Would be great to see this! Not only would it be good to see for buttons, but also any UI element that has a tap event attached to it. This could extend into applying the Android ripple effect on tap.
We are currently using a stacklayout as a button, because this element can contain child elements (i.e. image and text).
from nativescript.
We could use these in our QSF 👍
from nativescript.
+1
from nativescript.
This would be awesome to see +1
from nativescript.
+1
from nativescript.
+1
It's not implemented already. I guess the ability to give differentiated color to buttons and then color variation when they're pressed, is extremely high prio.
Is any workaround available in the meantime?
(For instance someone maybe could implement a patch, or a temporary button implementation altogether. I don't understand the internals well enough to have any idea yet.)
from nativescript.
Could I somehow hook into the like "onMouseDown" and "onMouseUp" events and just change the button's .cssClass accordingly -
I can't find any "onpressed" and "onunpressed" events though - what am I missing?
from nativescript.
So those are called MotionEvent.ACTION_UP and MotionEvent.ACTION_DOWN on Android, and those in turn are mapped to the GestureStateType:s "began" and "ended" in the {N} runtime.
But they seem not to be exported to userland currently.
To make history happen faster I open a separate issue for that: #1366 .
Actually if you think about it, a ":pressed" CSS pseudo-class will only alter the CSS applied on a button, so there will be cases when you will want event listeners for this functionality. So I guess the request in that github issue makes a lot of sense.
from nativescript.
Just encountered this now, would be nice :) Had to look at the source to get selectedBackgroundColor on the segmented bar where
SegmentedBar:active{} (or whatever)
Would have been super handy
from nativescript.
Since my comment above here in this issue, touch events were implemented #1383 , so all I wanted can be done programmatically. While of course a ":pressed" pseudoclass would be super-nice, at least the same goal can be reached other ways, so, for me this is not an issue anymore (and things like an SVG renderer are much higher prio).
from nativescript.
+1 on this. Would be great to have first/last child selectors.
from nativescript.
Do we still not have :pressed
? Would go a long way to making elements feel more native if you could style them while your finger is on them.
from nativescript.
@BenKingBBC I guess the pressed style is handled by the platform itself (i.e Ripple on Android 5)
from nativescript.
That would be nice for repeaters as well. I'm using a repeater to emulate a ListView with headers. However, onTap
event doesn't seem natural. It's missing the :pressed
or :selected
colour.
from nativescript.
nth-child should handle the various hand-made even/odd implementations:
https://github.com/NativeScript/nativescript-sdk-examples-ng/blob/master/app/listview/creating-listview/creating-listview.component.html#L5
Possibly replacing the .even
and .odd
selectors with ListView>:nth-child(even)
and ListView>:nth-child(odd)
without additional code in the xml or html temlpates.
from nativescript.
@toddanglin just one clarification; this pseudo selector only supports buttons currently...
from nativescript.
Hi all,
Added support for pseudo states named in this issue:
button: pressed, active and highlighted state (button will enter this state when tap and hold)
view: disabled (isEnabled = false)
For the request from @burkeholland about SegmentedBar:selected state
We introduced a new css property named selected-background-color
with following usage:
.segmentedBar {
selected-background-color: red;
}
So closing issue, if you need some other pseudo class property please open a separate issue, since this one is way too big for reading.
Nedyalko
from nativescript.
+1
from nativescript.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from nativescript.
Related Issues (20)
- [Android] SegmentedBar selectedBackgroundColor not working
- dialog action with custom view, not jsut message
- ListView: Allow styling of the tapped item (i.e. active, highlighted)
- Support Apple's "Vision" framework for on-device OCR text recognition HOT 4
- minHour and minMinute crash the app on TimePicker HOT 1
- TextField with [secure] string don't work on Android with core plugin 8.6.2 HOT 10
- ns build iOS and Xcode build not working after upgrade to xcode 15 HOT 5
- ResumeEvent in a component's constructor not triggering
- TypeError: Cannot read properties of undefined (reading 'env')
- Transfer nativescript.org Domain To The OpenJS Foundation
- RootLayout enterFrom animation bugged on iOS
- ReferenceError: NSURLSessionConfiguration is not defined HOT 12
- Missing API declarations & calling of restricted APIs HOT 8
- Android apps becomes unresponsive after resolution change
- NS PREVIEW don't working properly HOT 8
- Overlap using GridLayout iOS issue HOT 1
- [Known Issue] `npm i -g nativescript` error: gyp: binding.gyp not found HOT 2
- [feature] Allow bundler, eslint and typings generator to show API/SDK version availability warnings
- Upgrading to @nativescript/webpack-5.0.19 requires upgrade to @nativescript/core-8.7.0 HOT 3
- Devtools 0.0.1 Error: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript.