Unable to apply both "Theme.AppCompat.NoActionBar" and "Theme.AppCompat.Light" at the same time - titanium

I am using
<style name="MyThemeActionbar" parent="#style/Theme.AppCompat.Light">
<item name="colorAccent">#0d786e</item>
</style>
and also
<style name="MyThemeActionbar1" parent="#style/Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">#003300</item>
</style>
this style globally . Both are not working at a time. May I know why?

Setting up a test app with your themes:
var win = Ti.UI.createWindow({
backgroundColor: '#fff',
theme: "MyThemeActionbar1"
});
var btn = Ti.UI.createButton({
title: "open"
});
btn.addEventListener("click",function(){
var win2 = Ti.UI.createWindow({
backgroundColor: '#fff',
theme: "MyThemeActionbar"
});
win2.open();
})
win.add(btn);
win.open();
is working fine for me.
Theme file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyThemeActionbar1" parent="#style/Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">#003300</item>
</style>
<style name="MyThemeActionbar" parent="#style/Theme.AppCompat.Light">
<item name="colorAccent">#0d786e</item>
</style>
</resources>

I changed the parent style which was written separately as Theme.AppCompat.Light.NoActionBar it worked for my scenario exactly the way i wanted.

Related

Custom navigation with Swiper 9 and Sveltekit

I managed to put the default navigation buttons of swiper.js, but I would like to be able to set up custom buttons and use the slideNext() and slidePrev() methods when clicking on them.
Unfortunately, I tried several methods, but nothing worked, and I have no idea how to do this with sveltekit.
Thanks for your help!
My code :
<script>
import SwiperSlide from './SwiperSlide.svelte';
import { register } from 'swiper/element/bundle';
register();
</script>
<swiper-container
navigation={true}
slides-per-view={1}
direction="horizontal"
space-between={30}
centered-slides={true}
keyboard={true}
pagination={{
hideOnClick: false,
clickable: true
}}
>
<SwiperSlide id={1} />
<SwiperSlide id={0} />
<SwiperSlide id={2} />
</swiper-container>
<style>
swiper-container {
width: 80%;
height: 100vh;
max-height: 1000px;
padding: 50px 0;
}
</style>
<SwiperSlide> is a component with a <swiper-slide></swiper-slide>.

How to force disable android dark mode in React Native

I made one app in react-naive using
"react-native": "0.62.0",
"react": "16.11.0",
as I put my android device in dark mode, my UI designs get disturbed so i want to make it disable for now.
please help.
You can disable force dark mode in android by adding this line in your styles.xml in your android folder
<item name="android:forceDarkAllowed">false</item>
Like this
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:forceDarkAllowed">false</item>
<item name="android:textColor">#000000</item>
</style>
</resources>
You need to run the app again after doing these changes since these changes are native level.
File path: android/app/src/main/res/values/styles.xml
change
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
to
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
For IOS change your info.plist
<key>UIUserInterfaceStyle</key>
<string>Light</string>
It's complicade because you can try many things but if you buy a theme of other developer maybe the code have lines to force the dark mode. I bought a theme a have this lines, like this:
export const useTheme = () => {
const isDarkMode = useColorScheme() === 'dark';
const forceDark = useSelector(state => state.application.force_dark);
const themeStorage = useSelector(state => state.application.theme);
const listTheme = ThemeSupport.filter(item => item.theme == themeStorage);
const theme = listTheme.length > 0 ? listTheme[0] : DefaultTheme;
if (forceDark) {
return {theme: theme.dark, colors: theme.dark.colors}; <--- change here
}
if (forceDark === false) {
return {theme: theme.light, colors: theme.light.colors};
}
return isDarkMode
? {theme: theme.dark, colors: theme.dark.colors} <----- change here
: {theme: theme.light, colors: theme.light.colors};
};
So I change dark to ligth and solved my problem.

Changing components element colour with class binding

I have a component which is being used in different places but at once place, the colour of the link need to change. I tried the following but it doesn't my work.
component
<section class="contact__info">
<div class="details">{{days}}</div>
<div>
<a :href="'telephone'">
<strong>{{telephone}}</strong>
</a>
</div>
</section>
<style lang="scss">
.contact__info{
a {
color: grey;
font-weight: bolder
}
}
</style>
I am calling it as following in the page which needs the colour change for the anchor in that component and which is not working is as follows
<CallWidget
:class="{anchor : isFooter}"
title="Call Us:"
days="Mon - Fri"
telephone="0123"
/>
<script>
export default {
data(){
return{
isFooter: true
}
},
};
</script>
<style lang="scss" scoped>
.anchor {
a {
color: white;
}
}
</style>
If class is inside a child component you need to add /deep/ or >>> before it to tell Vue to check inside child components.
<style lang="scss" scoped>
/deep/ .anchor {
a {
color: white;
}
}
</style>
Take a look at https://vue-loader.vuejs.org/guide/scoped-css.html#deep-selectors

Set max width for Office UI Fabric TextField

How do I set max width for a TextField? By default, the width is set to maximum size
You can set the max-width property of the component by implementing your own styles function as done in this Codepen example.
const getStyles = () => {
return {
root: {
maxWidth: '100px'
}
}
};
<TextField
id='myTextField'
spellcheck={ false }
name='bar'
placeholder='Placeholder text'
defaultValue='Default text'
styles={ getStyles }
/>
More documentation about this approach can be found at https://github.com/OfficeDev/office-ui-fabric-react/wiki/Component-Styling#styles-prop.
You can add style attribute to a <TextField> component:
<TextField
...
style={{maxWidth: '100px'}}
/>
I hope it will help you.
Try to use max-width to set the maximum width the container should have.
.text-field{
width: 100%;
max-width: 500px;
height: 50px;
border: 2px solid black;
}
<div class="text-field">
<p>example<p>
<div>

Dijit ConfirmDialog - change its default style

How to change the default style (bar color, content color, etc) of the dijit ConfirmDialog? Please see codes below. Neither width or color were changed for the Confirm Dialog.
var confirm = new ConfirmDialog({
title: "Confirmation",
content: "This is the content",
style: "width: 400px, color: grey"
}).show();
I believe you just need to change the , to a semi-colon ;
var confirm = new ConfirmDialog({
title: "Confirmation",
content: "This is the content",
style: "width: 400px; color: grey"
}).show();
BTW, the color property in style is just the content color. To change the title bar background color, this link says:
You'd have to override the background-color on the .dijitDialogTitleBar css. For example,
<link rel="stylesheet" type="text/css" href="dojo-release-1.6.1-src/dojo/resources/dojo.css" />
<link rel="stylesheet" type="text/css" href="dojo-release-1.6.1-src/dijit/themes/claro/claro.css" />
<style> .claro .dijitDialogTitleBar { background-color: #00FF00 } </style>
Here, the color is changed to green.