Change the style of a component in kitten ui - react-native-ui-kitten

<Card style={{color:'black'}} >
I'm trying to change the color of the letter of the card and the truth is I can't, I tried placing the styles online and it can't, I don't want to modify the original mappin file, that's why I'm looking for another way out, I tried to do the mapping as it says the documentation but I really don't understand someone who can guide me please?
I made a mapping.js file and put this:
{
"components": {
"Card": {
"meta": {},
"appearances": {
"filled": {
"mapping": {},
"variantGroups": {
"status": {
"primary": {
"backgroundColor": "pink"
}
}
}
}
}
}
}
}
enter code here
in app.js I imported this:
import { default as mapping } from './mapping.json';
<ApplicationProvider {...eva} theme={{ ...eva.dark, ...theme}} customMapping={mapping}>
surcharge and does not make any change the truth is that I do not know what to do

Related

How to colorize specific React.Js syntax on vscode?

I'm trying to figure out how to get a specific color syntax with vscode in a declaration of a class in React.
These are the colors I want to get:
As you see, the name of the class StorePicker is a purple, and the React method .Component (including the dot) is a pale grey.
As far as I know, to play with color syntax on vscode, it needs to be with the TM Scope. So to make this, on my code file where I have the class declaration, I press Ctrl+Shift+p and search for Inspect TM Scopes, and click on the specific elements to get their respective scopes.
In my specific case, I got these scopes for the elements I need to colorize:
The class Name StorePicker (entity.name.class.js, source.js)
The React keyword (entity.name.class.js, source.js)
The . (keyword.operator.accessor.js, source.js)
The method Component (entity.name.class.js, source.js)
As you can see, the StorePicker (class name), the React keyword and the method Component share the same Scope: entity.name.class.js.
So let's say I want to colorize only the .Component. So I put this on my theme's config:
{
"name": "[JAVASCRIPT] - Operator Accesor + Method",
"scope": ["keyword.operator.accessor.js", "entity.name.class.js", "source.js"],
"settings": {
"foreground": "#c2cacf"
}
}
but StorePicker and React.Component are also colorized with the same color:
And I also want to colorize only the StorePicker (class name):
{
"name": "[JAVASCRIPT] - Only Class Name",
"scope": ["entity.name.class.js", "source.js"],
"settings": {
"foreground": "#d393e9"
}
}
Again not only is StorePicker colorized, but React and Component are colorized with the same color too:
My question:
How I can get them colorized separately like in the first image (taken from a Screencast), if they share the same Scope?
I have no idea how you got those scopes...
{
"scope": "entity.name.type.module.js",
"settings": { "foreground": "#e2b419" }
},
{
"scope": "entity.other.inherited-class.js",
"settings": { "foreground": "#c2cacf" }
},
{
"scope": "entity.name.type.class.js",
"settings": { "foreground": "#d393e9" }
},

How filter & format a json in node.js?

I want to format a JSON object in my Nodejs server. Delete some fields, rename some fields, and move some fields.
I have many different schemas need to apply to many different JSON, so I hope has a lib that can parse a configuration file and to it.
Maybe a configuration file like this:
DELETE request.logid
DELETE request.data.*.time
MOVE request.data.images data.images
And a JSON before applies an above schema:
{
"request": {
"data": {
"book": {
"name": "Hello World",
"time": 1546269044490
},
"images": [
"a-book.jpg"
]
},
"logid": "a514-afe1f0a2ac02_DCSix"
}
}
After applied:
{
"request": {
"data": {
"book": {
"name": "Hello World"
}
}
},
"data": {
"images": [
"a-book.jpg"
]
}
}
Where is the lib it is?
I know that write a function can do the same thing directly, but the problem is I have too many different schemas and too many different JSON, so I wanna manage them by configuration file rather than a js function.
Yes you could do something like this...
// Note: psuedocode
// Read the configuration file;
const commands = (await readFile('config')).split('\r\n').split(' ');
// your original JSON;
const obj = {...};
// Modify the JSON given the commands
commands.forEach( row=>{
if(row[0]==="DELETE"){
delete obj[row[1]];
}else if(row[0]==="MOVE"){
// use lodash to make your life easier.
_.set(obj,`${row[2]}`,_.get(obj,`${row[1]}`));
delete obj[row[1]];
}else if(...){
...
}
})

Function highlighting with monokai in VS Code / Atom and Sublime

While running Sublime Text 3 and VS Code (or Atom) with the Monokai color theme, the Sublime Text syntax highlighting uses blue for function calls, such as in the example below
However, when I open the same code in VS Code using the monokai theme, functions are not painted blue
I would really like to change that, the code looks much better with function calls highlighted. However, I looked around the web and couldn't find how to change this behavior. Does anyone have any tips for that?
Thanks!
SEE UPDATE BELOW!
Seems like I've found a temporary solution. Go to this folder (if you are on Mac) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/theme-monokai/themes and put this code in monokai-color-theme.json file:
{
"name": "Function call",
"scope": "meta.function-call.generic",
"settings": {
"foreground": "#66d9efff"
}
},
Here is an example how it can look like:
screenshot
But keep in mind, that after theme update this changes may disappear!
UPDATE:
After having a couple more troubles with highlighting, I decided to upload the file with theme to GitHub and keep it up to date. So, if you don't want to dive into the code, just look in my repository: https://github.com/spyker77/monokai-theme-extended
UPDATE (April 2021)
It turns out that the previous solution is not sustainable. Therefore at the moment a better one could be:
In you Visual Studio Code go to "Code" => "Preferences" => "Color Theme" and pick Monokai;
Open settings.json file (how-to);
There will probably already be a bunch of settings in there, so all you need to do is just add the following customisations at the end and before the closing brace (don't forget a trailing comma after the last setting you continue):
"editor.tokenColorCustomizations": {
"[Monokai]": {
"textMateRules": [
{
"name": "Decorator definition decorator",
"scope": "punctuation.definition.decorator.python",
"settings": {
"foreground": "#F92672"
}
},
{
"name": "Meta function-call",
"scope": "meta.function-call.generic.python",
"settings": {
"foreground": "#66D9EF"
}
},
{
"name": "Storage type function async",
"scope": "storage.type.function.async.python",
"settings": {
"foreground": "#F92672",
}
},
{
"name": "Punctuation separator period",
"scope": "punctuation.separator.period.python",
"settings": {
"foreground": "#F8F8F2",
}
},
{
"name": "Entity name function decorator",
"scope": "entity.name.function.decorator.python",
"settings": {
"foreground": "#66D9EF",
}
},
{
"name": "Entity name type class",
"scope": "entity.name.type.class.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "Entity other inherited-class",
"scope": "entity.other.inherited-class.python",
"settings": {
"fontStyle": "italic"
}
},
{
"name": "Support type python",
"scope": "support.type.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "String quoted docstring multi python",
"scope": "string.quoted.docstring.multi.python",
"settings": {
"foreground": "#88846F",
}
}
]
}
}
after trying for server hours finally found a solution and I came back to you to share the solution since I tried the answer above and couldn't make it work.
it turns out that the problem I with VScode extensions (python for Vscode), so disable that first,extension
then go to your setting.json file like that how to open setting
add this to the top of your file
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.function-call.generic",
"settings": {
"foreground":"#19D1E5"
}
}
]
},
and restart VScode and this should work, btw I am using monokai vibrent, and I am sure it will work in any theme you like.
setting.json
like this here
In settings.json:
"editor.tokenColorCustomizations": {
"[Monokai]": {
{
"scope": "entity.name.function",
"settings": {
"foreground": "#fdc306d0", // use your desired color
"fontStyle": "underline" // I like this, foreground color has some reduced opacity
}
}
}
}
might do the trick.

Display specific data from a collections in mongodb

Hi all I am very new in mongodb and I have some problems when I try to do some find in a collections I hope so someone can help me.
Imagine I have the following collection:
{
columns:[
'Divisa',
'05/10/2015',
'02/10/2015',
'01/10/2015',
'30/09/2015',
'29/09/2015',
'28/09/2015',
'25/09/2015',
'24/09/2015',
],
data:[
{
'Divisa':'USD',
'05/10/2015':'11236',
'02/10/2015':'1116',
'01/10/2015':'11153',
'30/09/2015':'11203',
'29/09/2015':'11204',
'28/09/2015':'1117',
'25/09/2015':'11151',
'24/09/2015':'11241'
},
{
'Divisa':'BGD',
'05/10/2015':'19558',
'02/10/2015':'19558',
'01/10/2015':'19558',
'30/09/2015':'19558',
'29/09/2015':'19558',
'28/09/2015':'19558',
'25/09/2015':'19558',
'24/09/2015':'19558'
},
{
'Divisa':'CYP',
'05/10/2015':'0',
'02/10/2015':'0',
'01/10/2015':'0',
'30/09/2015':'0',
'29/09/2015':'0',
'28/09/2015':'0',
'25/09/2015':'0',
'24/09/2015':'0'
}
]
}
Now I want do some find inside the collections for exmample:
A-I want to bring me all currencies search by date range 05/10/2015 to 01/10/2015 then I need that return something like this:
{
columns:[
'Divisa',
'05/10/2015',
'02/10/2015',
'01/10/2015',
],
data:[
{
'Divisa':'USD',
'05/10/2015':'11236',
'02/10/2015':'1116',
'01/10/2015':'11153',
},
{
'Divisa':'BGD',
'05/10/2015':'19558',
'02/10/2015':'19558',
'01/10/2015':'19558',
},
{
'Divisa':'CYP',
'05/10/2015':'0',
'02/10/2015':'0',
'01/10/2015':'0',
}
]
}
I want to know what is the structure of the find that I need to use for have a result similar.
B-Also I need to know how do a find that return all the information related with a currency, for example I want searh all releated with the currency 'USD', I need return something similar to:
columns:[
'Divisa',
'05/10/2015',
'02/10/2015',
'01/10/2015',
'30/09/2015',
'29/09/2015',
'28/09/2015',
'25/09/2015',
'24/09/2015',
],
data:[
{
'Divisa':'USD',
'05/10/2015':'11236',
'02/10/2015':'1116',
'01/10/2015':'11153',
'30/09/2015':'11203',
'29/09/2015':'11204',
'28/09/2015':'1117',
'25/09/2015':'11151',
'24/09/2015':'11241'
}
]
}
I want to know what is the structure of the find that I need to use for have a result similar.
C-And finally I need to know how do a find that return all the information related with a value, for example I want search all the information with value of 0 between 12000, I need return something similar to:
{
columns:[
'Divisa',
'05/10/2015',
'02/10/2015',
'01/10/2015',
'30/09/2015',
'29/09/2015',
'28/09/2015',
'25/09/2015',
'24/09/2015',
],
data:[
{
'Divisa':'USD',
'05/10/2015':'11236',
'02/10/2015':'1116',
'01/10/2015':'11153',
'30/09/2015':'11203',
'29/09/2015':'11204',
'28/09/2015':'1117',
'25/09/2015':'11151',
'24/09/2015':'11241'
},
{
'Divisa':'CYP',
'05/10/2015':'0',
'02/10/2015':'0',
'01/10/2015':'0',
'30/09/2015':'0',
'29/09/2015':'0',
'28/09/2015':'0',
'25/09/2015':'0',
'24/09/2015':'0'
}
]
}
I want to know what is the structure of the find that I need to use for have a result similar.

Elasticsearch - MissingMethodException on running distanceInKm on geo_point array

I have an elasticsearch document which has an array of geo_points. I have created the mapping as:
{
"test": {
"properties": {
"locations": {
"type": "geo_point"
}
}
}
}
Now, I am trying to create a query in which I want to do some processing on the array of geo_points. I have created my query like this:
{
"query": {
"filtered": {
"filter": {
"script": {
"script": "sDistance = doc['locations'].values[0].distanceInKm(28.51818,77.096080);"
}
}
}
}
}
I want to calculate the distance of the point (28.51818,77.096080) from the first element in the locations array.
It is giving me this error:
GroovyScriptExecutionException[MissingMethodException[No signature of method: org.elasticsearch.common.geo.GeoPoint.distanceInKm() is applicable for argument types: (java.lang.Double, java.lang.Double) values: [28.51818, 77.09608]]
I tried using sDistance = doc['locations'][0].distanceInKm(28.51818,77.096080); but it also resulted in the same error.
What am I doing wrong here?
Thanks in advance.
Your script should not retrieve the first geo point by itself, but simply call distanceInKm on the locations field directly, like this:
{
"query": {
"filtered": {
"filter": {
"script": {
"script": "sDistance = doc['locations'].distanceInKm(28.51818,77.096080);"
}
}
}
}
}
Under the hood, the first geo point will be retrieved and the distance will be computed on it.

Resources