UNPKG

react-native-ajora

Version:

The most complete AI agent UI for React Native

315 lines (230 loc) โ€ข 7.06 kB
# ๐Ÿšง This library is under construction! ๐Ÿ› ๏ธ # ๐Ÿ“… It will be ready by October 15, 2025 ๐Ÿš€ # ๐Ÿค– React Native Ajora <div align="center"> **The most complete AI agent UI for React Native** [![npm version](https://badge.fury.io/js/react-native-ajora.svg)](https://badge.fury.io/js/react-native-ajora) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![React Native](https://img.shields.io/badge/React_Native-20232A?logo=react&logoColor=61DAFB)](https://reactnative.dev/) _Build beautiful, intelligent chat interfaces with AI agents in React Native_ </div> --- ## โœจ Features - ๐ŸŽจ **Beautiful UI Components** - Pre-built, customizable chat components - ๐Ÿง  **AI Agent Ready** - Built specifically for AI agent interactions - ๐Ÿ“ฑ **Cross-Platform** - Works on iOS, Android, and Web - ๐ŸŽฏ **TypeScript Support** - Full TypeScript definitions included - ๐Ÿ”ง **Highly Customizable** - Extensive theming and customization options - ๐Ÿ’ฌ **Rich Media Support** - Images, audio, files, and more - ๐Ÿงต **Thread Management** - Multi-conversation support - โŒจ๏ธ **Smart Keyboard** - Intelligent keyboard handling - ๐ŸŽญ **Animations** - Smooth, native animations - ๐Ÿ”Œ **Tool Integration** - Easy integration with AI tools and functions - ๐Ÿ“Š **Thinking Indicators** - Visual feedback for AI processing - ๐ŸŽจ **Markdown Support** - Rich text rendering with LaTeX support ## ๐Ÿš€ Quick Start ### Installation ```bash npm install react-native-ajora # or yarn add react-native-ajora ``` ### Peer Dependencies Make sure you have these peer dependencies installed: ```bash npm install @expo/vector-icons @gorhom/bottom-sheet react-native-keyboard-controller react-native-reanimated ``` ### Basic Usage ```tsx import React from "react"; import { SafeAreaView } from "react-native-safe-area-context"; import { Ajora } from "react-native-ajora"; const App = () => { return ( <SafeAreaView style={{ flex: 1 }}> <Ajora isScrollToBottomEnabled keyboardShouldPersistTaps="never" infiniteScroll onSend={(messages) => { console.log("New messages:", messages); }} /> </SafeAreaView> ); }; export default App; ``` ## ๐Ÿ“– Documentation ### Core Components #### Ajora The main chat component that orchestrates all other components. ```tsx <Ajora messages={messages} onSend={handleSend} isThinking={isThinking} showHeader={true} showThreads={true} renderTools={() => [TimeTool, WeatherTool]} /> ``` #### Message Types ```tsx interface IMessage { _id: string | number; role: "user" | "model"; parts: Part[]; feedback?: "like" | "dislike"; createdAt: Date | number; pending?: boolean; } interface Part { thought?: boolean; functionCall?: FunctionCall; functionResponse?: FunctionResponse; text?: string; audio?: AudioData; image?: string; file?: FileData; } ``` ### Advanced Features #### Thread Management ```tsx <Ajora showThreads={true} onThreadSelect={(thread) => { console.log("Selected thread:", thread); }} onNewThread={() => { console.log("Creating new thread"); }} /> ``` #### Custom Tools ```tsx const TimeTool = { name: "get_current_time", description: "Get the current time", parameters: { type: "object", properties: { timezone: { type: "string", description: "Timezone to get time for", }, }, }, }; <Ajora renderTools={() => [TimeTool]} />; ``` #### Custom Styling ```tsx <Ajora messagesContainerStyle={{ backgroundColor: "#f0f0f0", }} renderBubble={(props) => <CustomBubble {...props} />} renderInputToolbar={(props) => <CustomInputToolbar {...props} />} /> ``` ## ๐ŸŽจ Screenshots <div align="center"> ![Chat Interface](media/photo_2025-09-20_09-43-38.jpg) _Beautiful chat interface with AI agent_ ![Thread Management](media/photo_2025-09-20_09-43-42.jpg) _Multi-thread conversation management_ ![Advanced Features](media/photo_2025-09-20_09-43-49.jpg) _Advanced AI agent features and tools_ ![Custom Styling](media/photo_2025-09-20_09-43-54.jpg) _Customizable interface and theming_ </div> ## ๐Ÿ”ง Configuration ### Keyboard Handling ```tsx <Ajora keyboardShouldPersistTaps="never" focusOnInputWhenOpeningKeyboard={true} isKeyboardInternallyHandled={true} bottomOffset={0} /> ``` ### Message Container ```tsx <Ajora infiniteScroll={true} isScrollToBottomEnabled={true} loadEarlier={true} onLoadEarlier={loadEarlierMessages} /> ``` ### Input Customization ```tsx <Ajora maxInputLength={1000} minComposerHeight={40} maxComposerHeight={100} textInputProps={{ placeholder: "Type your message...", multiline: true, }} /> ``` ## ๐Ÿ› ๏ธ Development ### Prerequisites - Node.js >= 18 - React Native development environment - Expo CLI (for example app) ### Setup 1. Clone the repository: ```bash git clone https://github.com/habasefa/react-native-ajora.git cd react-native-ajora ``` 2. Install dependencies: ```bash npm install ``` 3. Start the example app: ```bash npm start ``` ### Building ```bash npm run build ``` ### Testing ```bash npm test npm run test:coverage ``` ## ๐Ÿ“š Examples Check out the `example/` directory for comprehensive examples: - **Basic Chat** - Simple chat implementation - **Tool Integration** - AI tools and function calls - **Custom Styling** - Themed chat interface - **Thread Management** - Multi-conversation support ## ๐Ÿค Contributing We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add some amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ™ Acknowledgments - Built with โค๏ธ for the React Native community - Inspired by modern chat interfaces and AI agent UIs - Special thanks to Farid and [react-native-giftedchat](https://github.com/FaridSafi/react-native-gifted-chat) contributors ## ๐Ÿ“ž Support - ๐Ÿ“ง Email: [nazrihabtish@gmail.com](mailto:nazrihabtish@gmail.com) - ๐Ÿ› Issues: [GitHub Issues](https://github.com/habasefa/react-native-ajora/issues) - ๐Ÿ’ฌ Discussions: [GitHub Discussions](https://github.com/habasefa/react-native-ajora/discussions) --- <div align="center"> **Made with โค๏ธ by [Habtamu Asefa](https://github.com/habasefa)** [โญ Star us on GitHub](https://github.com/habasefa/react-native-ajora) โ€ข [๐Ÿ“– Documentation](https://github.com/habasefa/react-native-ajora#readme) โ€ข [๐Ÿ› Report Bug](https://github.com/habasefa/react-native-ajora/issues) โ€ข [โœจ Request Feature](https://github.com/habasefa/react-native-ajora/issues) </div>