SDK & Integrations

React Native & Expo Integration

Use official @baziapi/sdk directly inside iOS and Android React Native apps.

Mobile App SDKs
Build native iOS and Android React Native apps with Expo and @baziapi/sdk for mobile astrological features.

Installation

Bash
npm install @baziapi/sdk

Quick Start

React Native Screen Component
TypeScript
import React, { useState } from 'react';
import { View, Text, Button } from 'react-native';
import { BaziClient } from '@baziapi/sdk';

const client = new BaziClient({ apiKey: 'bazi_live_xxxx' });

export default function BaziScreen() {
  const [dayMaster, setDayMaster] = useState('');

  const calculate = async () => {
    const chart = await client.bazi.calculate({ birthDate: '1998-08-12', birthTime: '10:30', gender: 'male' });
    setDayMaster(chart.heavenlyStems.dayStem);
  };

  return (
    <View style={{ padding: 20 }}>
      <Button title="Calculate BaZi" onPress={calculate} />
      {dayMaster ? <Text>Day Master: {dayMaster}</Text> : null}
    </View>
  );
}

Something unclear? Contact developer support.