@vedika-io/react-native-widgets
v0.1.0
Published
Embeddable Vedika astrology widgets for React Native — themed, data-driven, one theme.json recolors everything.
Downloads
37
Readme
@vedika-io/react-native-widgets
Vedika astrology widgets for React Native (iOS and Android). The widget data,
theming and view-models match the web package @vedika-io/widgets. One small
theme (seed + mode) recolors every widget, and every colour pick is clamped
to stay readable (WCAG AA).
Install
npm install @vedika-io/react-native-widgetsPeer dependencies: react >= 18 and react-native >= 0.72. With TypeScript, the
shipped declarations need @types/react 18.2.6 or later.
import { VedikaWidget, VedikaThemePicker, createDataProvider } from '@vedika-io/react-native-widgets';
<VedikaWidget type="daily-horoscope" params={{ sign: 'leo' }} theme={{ seed: '#d97706', mode: 'light' }} />
<VedikaWidget type="numerology" input={{ birthDate: '1990-05-15' }} />Widgets
| type | Shows | API operation (production) | Required input |
|---|---|---|---|
| daily-horoscope | card | GET /v2/astrology/horoscope/{sign} | none; pass params={{ sign }} |
| panchang | list | GET /v2/astrology/panchang/today | none |
| choghadiya | timing bands | GET /v2/astrology/choghadiya | none |
| rahu-kaal | glance | GET /v2/astrology/rahu-kaal | none |
| moon-phase | glance | GET /v2/daily/moon-phase | none |
| numerology | grid | POST /v2/astrology/numerology/life-path | birthDate (or dateOfBirth, date, datetime) |
| tarot-draw | cards | POST /v2/tarot/draw/three-card | none; question is optional |
| birth-chart | chart | POST /v2/astrology/birth-chart | birth details (see below) |
| compatibility | score | POST /v2/astrology/ashtakoot-match | male and female, each with birth details |
Birth details. Supply all four:
datetime, ordatewith an optionaltime;latitude;longitude;timezone, such as"+05:30".
You can leave out timezone only when datetime carries its own offset, for example
1990-05-15T10:30:00+05:30. The API reads a datetime with no offset and no timezone
as UTC, so the widget refuses to send one. The API's aliases also count: lat,
lon/lng, tz, dob, dateOfBirth.
A birth chart sent with a date and no time is cast for 12:00 local time. The widget then shows the API's precision note under the title.
Rahu Kaal after dark. Late in the day the API can return an empty Rahu Kaal
window. The widget shows — for it.
<VedikaWidget> props
paramsfills path placeholders, for example{ sign }.inputis the request body for POST widgets and the query for GET widgets.panchang,choghadiyaandrahu-kaaltakelatitude,longitudeandtimezone. Without them, the API uses New Delhi.- When you give a location but no
datetime, the widget sends the current time itself, so the reading is for now. daily-horoscopetakesdateandtimezone.moon-phasetakesdate.- If required input is missing, the widget shows a message and does not call the API.
widgets[type].inputExampleholds a working example for the widgets that take input:numerology,tarot-draw,birth-chartandcompatibility.
providercontrols where requests go. The default is the keyless sandbox.
Sandbox and production
const sandbox = createDataProvider(); // keyless sample data
const direct = createDataProvider({ mode: 'prod', apiKey }); // billed to the key
const proxied = createDataProvider({ mode: 'prod', baseUrl: 'https://your-api.example/vedika' }); // your backend adds the key- Sandbox: it ignores the request input and returns one fixed demo reading. Only
the horoscope
signin the path is used. - Keys in apps: do not ship a production key inside an app binary. Route calls
through your own backend with
baseUrl. - What that backend forwards: only the operations in the table above, with a capped body size and a per-user rate limit. A backend that forwards any path lets anyone use your key for any API operation.
- Keys and
baseUrl: whenapiKeyandbaseUrlare both set, the key is sent to thebaseUrlhost, so that host must behttps://. The only exceptions are a relative path andhttp://localhost, for development.
Other exports
Theme picker:
VedikaThemePicker(value,onThemeChange,presets).Watch-style glance:
WatchGlance(vm,theme,size).Primitives:
Card,List,Grid,Cards,Chart,Timing,GlanceandScore, plusresolveRoles.Headless helpers:
widgets,missingInput,requestInput,deriveandcontrast. These also load in plain Node withoutreactorreact-native, from these files:@vedika-io/react-native-widgets/lib/derive.js/lib/glyphs.js/lib/viewModels.js/lib/dataProvider.js/lib/theme.js
Keep the
.jsextension: native ESMimportand TypeScript'snode16resolution need it.
How it is built
| Consumer | Loads |
|---|---|
| Metro | the TypeScript source through the react-native field (src/index.ts) |
| Node, Jest and other bundlers | CommonJS from lib/ |
| TypeScript | the declarations in lib/*.d.ts |
npm pack and npm publish rebuild lib/ through prepack. Never pack or
publish with --ignore-scripts: that skips prepack and ships no lib/.
Checks
npm run typecheck and npm test. The tests are not part of the published package.
License
Proprietary. Use requires a Vedika API subscription or a written agreement with
XALEN Technology Pvt Ltd; see LICENSE.
