{"id":15458123,"url":"https://github.com/dmotz/natal-shell","last_synced_at":"2025-04-19T13:49:44.040Z","repository":{"id":62433765,"uuid":"46252981","full_name":"dmotz/natal-shell","owner":"dmotz","description":"A thin ClojureScript wrapper around the React Native API","archived":false,"fork":false,"pushed_at":"2019-03-26T01:33:07.000Z","size":41,"stargazers_count":39,"open_issues_count":1,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T08:23:33.021Z","etag":null,"topics":["clojure","clojurescript","react","react-native"],"latest_commit_sha":null,"homepage":"","language":"Clojure","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/dmotz.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":"2015-11-16T04:59:12.000Z","updated_at":"2024-05-31T07:55:51.000Z","dependencies_parsed_at":"2022-11-01T21:01:38.184Z","dependency_job_id":null,"html_url":"https://github.com/dmotz/natal-shell","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotz%2Fnatal-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotz%2Fnatal-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotz%2Fnatal-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotz%2Fnatal-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmotz","download_url":"https://codeload.github.com/dmotz/natal-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249707362,"owners_count":21313825,"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":["clojure","clojurescript","react","react-native"],"created_at":"2024-10-01T22:59:17.547Z","updated_at":"2025-04-19T13:49:44.012Z","avatar_url":"https://github.com/dmotz.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Natal Shell\n### A thin ClojureScript wrapper around the React Native API\n[Dan Motzenbecker](http://oxism.com), MIT License\n[@dcmotz](https://twitter.com/dcmotz)\n\n[![Clojars Project](http://clojars.org/natal-shell/latest-version.svg)](http://clojars.org/natal-shell)\n\n---\n\nNatal Shell is a simple convenience wrapper around the React Native API,\noffering a simple Clojure-ready interface out of the box.\n\nIt is designed as a companion library to [Natal](https://github.com/dmotz/natal)\n(a command line utility for quickly bootstrapping React Native projects in\nClojureScript), but can be used completely independently.\n\n\n## Usage\n\nNatal Shell exposes React components as macros which you can require like so:\n\n```clojure\n(ns future-app.core\n  (:require [om.core :as om])\n  (:require-macros [natal-shell.components :refer [view text switch image slider-ios]]))\n```\n\nUse them like this:\n\n```clojure\n(text {:style {:color \"teal\"}} \"Well isn't this nice.\")\n```\n\nYou can pass children as the trailing arguments or as a collection:\n\n```clojure\n(view\n  nil\n  (interleave\n    (map #(text nil %) [\"un\" \"deux\" \"trois\"])\n    (repeat (switch {:style {:margin 20}})))))\n```\n\nAll component names are normalized in Clojure's snake-case, for example:\n\n```clojure\n;; Using SegmentedControlIOS\n(segmented-control-ios {:values [\"Emerald\" \"Sapphire\" \"Gold\"]})\n```\n\nThe same rule applies to API methods.\n\nAPIs are divided into separate Clojure namespaces like so:\n\n```clojure\n(ns future-app.actions\n  (:require-macros [natal-shell.components :refer [text]]\n                   [natal-shell.alert-ios :refer [alert prompt]]\n                   [natal-shell.push-notification-ios :refer [present-local-notification]]))\n\n(text {:onPress #(alert \"Hello from CLJS\")} \"press me\")\n```\n\n#### `ListView.DataSource`\nOne deviation from the React Native docs is that the `DataSource` constructor\nis not a property of the `ListView` component constructor and exists in its own\nmodule:\n\n```clojure\n[natal-shell.data-source :refer [data-source clone-with-rows]]\n```\n\n\n## Error Feedback\n\nNatal Shell provides a simple macro called `with-error-view` that you can wrap around\nthe body of your component's `render` to get visible feedback when an error is thrown:\n\n```clojure\n(defui HomeView\n  Object\n  (render [_]\n    (with-error-view\n      (view\n        nil\n        (this-non-existent-function-will-throw \"and render the error screen\")))))\n```\n\nA red screen with a stack trace will be shown, making it easier to realize where\nsomething's gone awry.\n\n\n## Coda\n\nNatal Shell is automatically generated from scraping the React Native docs via\nthe script in `scripts/scraper.clj`.\n\nFuture areas of improvement may include optionally omitted prop arguments and\nautomatic conversion of snake-case keys in maps.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmotz%2Fnatal-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmotz%2Fnatal-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmotz%2Fnatal-shell/lists"}