react-native-ajora
Version:
The most complete AI agent UI for React Native
315 lines (230 loc) โข 7.06 kB
Markdown
# ๐ง 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**
[](https://badge.fury.io/js/react-native-ajora)
[](https://opensource.org/licenses/MIT)
[](https://www.typescriptlang.org/)
[](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">

_Beautiful chat interface with AI agent_

_Multi-thread conversation management_

_Advanced AI agent features and tools_

_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>