{"id":17677431,"url":"https://github.com/unadlib/react-native-css-tree","last_synced_at":"2025-05-12T13:46:31.533Z","repository":{"id":57336338,"uuid":"97574749","full_name":"unadlib/react-native-css-tree","owner":"unadlib","description":" Inheritable dynamic style tree.","archived":false,"fork":false,"pushed_at":"2018-03-03T08:31:32.000Z","size":147,"stargazers_count":26,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T05:51:29.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unadlib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-18T08:38:09.000Z","updated_at":"2022-06-20T10:46:45.000Z","dependencies_parsed_at":"2022-09-11T12:22:09.078Z","dependency_job_id":null,"html_url":"https://github.com/unadlib/react-native-css-tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Freact-native-css-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Freact-native-css-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Freact-native-css-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Freact-native-css-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unadlib","download_url":"https://codeload.github.com/unadlib/react-native-css-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253475726,"owners_count":21914452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T07:28:40.960Z","updated_at":"2025-05-12T13:46:31.499Z","avatar_url":"https://github.com/unadlib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-css-tree\n[![Travis](https://img.shields.io/travis/unadlib/react-native-css-tree.svg)](https://travis-ci.org/unadlib/react-native-css-tree)\n[![Coverage Status](https://coveralls.io/repos/github/unadlib/react-native-css-tree/badge.svg?branch=master)](https://coveralls.io/github/unadlib/react-native-css-tree?branch=master)\n[![npm](https://img.shields.io/npm/v/react-native-css-tree.svg)](https://www.npmjs.com/package/react-native-css-tree)\n[![npm](https://img.shields.io/npm/dt/react-native-css-tree.svg)](https://www.npmjs.com/package/react-native-css-tree)\n[![npm](https://img.shields.io/npm/l/react-native-css-tree.svg)](https://www.npmjs.com/package/react-native-css-tree)\n\nThis is a react-native style module plug-in that features a modular JSON object tree structure.\n\n### Features\n\n   * Customizable Inheritance Middleware.\n   * Style tree namespaces.\n   * Global variables.\n   * Priority inheritance.\n   * Functional CSS.\n\n### Installation\n```shell\nnpm install --save react-native-css-tree\n```\n### Usage\n```javascript\nimport cssTree from 'react-native-css-tree';\n\nconst styles = cssTree({ //globalStyle\n    grid:10,\n    base:{\n        size: 10,\n    }\n})((key, parent, sub)=\u003e{ //middleware\n    return sub;\n})({\n    container:{\n        flex: 1,\n        margin: \"$grid\",\n        padding: 5,\n        _box:{\n            height: 100,\n        },\n        text:(color)=\u003e({\n            color,\n            fontSize: \"$base.size\"\n        })\n    },\n});\n\n\u003cView style={styles.container}\u003e\n    \u003cView style={styles.container._box}\u003e\u003c/View\u003e\n\u003c/View\u003e\n```\n### Configuration\n\n    Styles = cssTree(GlobalStyle)(Middleware)(Style);\n\n* GlobalStyle is used to configure global theme styles.\n* Middleware supports multiple middleware functions.\n* Style is original style tree:\n    * `$` reference variable, and support the operation.\n    *  If use `_` As a key prefix , it inherits all of the style properties of the parent.\n\n### TODO\n- [ ] support combine `padding/margin/border/box-shadow/background`  \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funadlib%2Freact-native-css-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funadlib%2Freact-native-css-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funadlib%2Freact-native-css-tree/lists"}