Change react-native-calendar to dark mode - react-native

We are using react-native-calendar from wix.com, we are planning to create a dark mode version but we can not change the agenda background colore. how can i access it ?
I've found a solution to style the calendar element, the scrollpad, but ot the background of the view where all events are renderd.

I saw an example of the Agenda component on the repository and figure out it has a prop called theme. In the types.ts file, you can see the theme interface and all properties. Follow a simple example:
<Agenda
// Agenda theme
theme={{
agendaKnobColor: '#768390',
calendarBackground: '#2d333b',
}}
/>
I created a snack on Expo for you to see the complete example on the computer with the source code. Or you scan the QR Code from your smartphone using the Expo Go app.

You can change the agenda background color by modifying the value of reservationsBackgroundColor inside your theme object. Here is an example :
theme = {
{
reservationsBackgroundColor: "#000000",
}
}

Related

How can I alter FontAwesomeIcon properties outside the initial <FontAwesomeIcon /> call in React Native?

I currently have a modal where the user can pick from a large flatlist of icons. All have size: '45' and color: 'white'. When a user selects an icon, the modal is closed and their selected icon appears on the card (this feature is one that allows the user to create a custom card).
I then have a feature that allows the user to change the line colour from white to black and visa versa on the card to contrast with their selected background colour. I would also like the colour of the icon to change with the lines, but I cannot find a solution! The icon object itself is read-only and using a StyleSheet seems to only apply styles when it is referenced within the original call like:
<FontAwesomeIcon icon={archive} style = {styles.text} />
I can't seem to wrap it in a styled view and then change the style from there.
Any ideas on how to alter the colour? And the size while I'm asking?
You can make state like this :
const [style,setStyle]=useState()
You change state with user color, and apply it to your FontAwesome icon
<FontAwesomeIcon icon={archive} style = {style} />
Thanks for the answers! I ended up creating a library to reference and just passed the library prefix (fab, far, fas) and the icon name (coffee, archive, wifi). Then used:
<FontAwesomeIcon icon={[icon.props.icon[0], icon.props.icon[1]]} style ={blabla} size = {blabla} />
Meaning I can now manipulate the size and colour wherever I want! Very handy.

'borderBottomStyle : dashed' is not working in the react native. Can anyone suggest better way to do that?

BorderBottomStyle is not working in the React native and as well as styled-components. BorderStyle is working fine. But BorderBottomStyle-dashed is not working and getting Component Exception.
<LocationText>BORDERBOTTOMSTYLE</LocationText>
LocationText = styled.Text`
margin-left:2%;
font-family:metropolisRegular;
font-size:20px;
padding-left:2px;
border-bottom-color:rgba(0,0,0,0.3);
border-bottom-width:2px;
border-bottom-style:dashed;
`;
https://i.stack.imgur.com/GzzUU.png
Any Better idea to style only the border Bottom with dashed in React native??
In react-native, you can't style many components directly as this is not necessary. Often times the better approach is to put the component inside a container and then style the container.
If you're a beginner, then how you attach the styles to the "View" is something you can google and not important, but this is an example of just showing the one style attached inline.
<View style={{ border-bottom-style: "dashed"}}>
<LocationText>BORDERBOTTOMSTYLE</LocationText>
</View>

How to customize Pull-To-Refresh indicator style in NativeScript/Vue?

I am trying to customize the style of Pull-To-Refresh indicator in NativeScript/Vue app. There seems to be no example code for Vue. I tried to place the following code adapted from Angular into , got errors when running the app.
<RadListView.pullToRefreshStyle>
<PullToRefreshStyle indicatorColor="white" indicatorBackgroundColor="blue"/>
</RadListView.pullToRefreshStyle>
Can anybody offer a working example or update the following page?
https://docs.nativescript.org/vuejs/ns-ui/ListView/pull-to-refresh
On a side note, according to doc here:
https://docs.nativescript.org/ns-ui-api-reference/classes/pulltorefreshstyle
Only color and background color can be customized. Is there anyway to get around this change size of indicator?
The only way I can think of is to set both foreground and background of indicator to transparent then use page level activityIndicator.
Just set the attributes on pullToRefreshStyle property
HTML
<RadListView :pullToRefreshStyle="pullToRefreshStyle">
Script
import * as colorModule from "tns-core-modules/color";
data() {
return {
pullToRefreshStyle: {
indicatorColor: new colorModule.Color("red"),
indicatorBackgroundColor: new colorModule.Color("green")
}
};
}

How to customize drop-down menu

I'm interested in determining if its possible for me to completely customize the drop-down that appears in response to a user typing text into a select2 text field (using the react-select component).
I want the text to generate output similar to what appears in Apple's Spotlight OS feature (see screenshot - in which I typed the text 'mini').
Is this possible using react-select and if so - how ? Are there samples ?
I found this repo ( https://github.com/bvaughn/react-virtualized-select/ ) which seems like it supports what I want to do - but its no longer supported.
Thanks
Dave
Of course you can customize the contents of the dropdown with the components framework implemented into react-select. You have to overwrite the Menu component to add new content to the dropdown. You might also have to set some styles with the styles api.
const Menu = ({ children , ...props }) => {
return <components.Menu>
<div> My custom content </div>
{children} // This contains the `MenuList` component with the options
</components.Menu>
}
<Select
{ ... }
components={{
Menu
}}
/>
To achieve something like Apples Spotlight feature you have to do some more advanced customisation. This example shows a basic implementation of how you could do it.

Titanium: How to remove background of Search bar?

How can I remove the background of search bar ? I tried by changing background color but it also changes cancel button's color !!!
Thanks...
The best alternative to this is creating a custom search bar with Ti.UI.textField and Ti.UI.button. Add them both to a view and customize it as you please. Finally, just add an event listener to the button click, and voila!
Take a look at this Module: https://github.com/viezel/NappUI
It extends the properties for several UI Elements, including SearchBar, here is the list.
SearchField BackgroundImage
Custom Cancel button
barColor - background gradient of the button. (similar to navbar)
color - color of the button title
title - change the default Cancel text
font - set the font of the button
Appearance of the keyboard
Disable the search icon
To install it, I recommend you to use the new gitTio command line, this will automatically download the module, install it on the modules folder on Application Support folder and add the proper config line on tiapp.xml.
gittio install -g dk.napp.ui
And here is an example of a SearchBar using the new properties enabled by this Module
var searchBar = Ti.UI.createSearchBar({
searchFieldBackgroundImage:"searchbg.png",
showsScopeBar:true,
scopeButtonTitles:["hello", "yes"],
customCancel:{
barColor:"#333",
color:"#ddd",
title:"Hit me",
font:{
fontSize:16,
fontWeight:"bold",
fontFamily:"Georgia"
}
},
appearance:Titanium.UI.KEYBOARD_APPEARANCE_ALERT,
barColor:"transparent",
disableSearchIcon:true //disables the search icon in the left side
});
If you are talking about the gradient blue, I removed it on my app with:
var searchBox = Ti.UI.createSearchBar({
barColor: '#eee'
});
Hope this helps.
Unfortunately 'barColor' doesn't work. Ti seems to change the color by changing the opacity or hue or something. DannyM's workaround is the best.
I must have wasted a zillion hours making sense of Titanium's background colors, background images, bar colors and their active/inactive cousins.
Conclusion: "Free" software is costly if you count the time you waste on silly bugs and lack of useful documentation.