
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-native-ai-kit
Advanced tools
A React Native utility kit for AI-powered apps with chat, image generation, speech-to-text, and text-to-speech capabilities
A comprehensive React Native utility kit for AI-powered applications. Easily integrate chat, image generation, speech-to-text, and text-to-speech capabilities into your React Native apps.
npm install react-native-ai-kit
# or
yarn add react-native-ai-kit
npm install react react-native
# Optional: for enhanced audio features
npm install expo-av
import React, { useState } from 'react';
import { View, TextInput, Button, Text } from 'react-native';
import { useChatAI } from 'react-native-ai-kit';
const ChatExample = () => {
const [input, setInput] = useState('');
const { messages, sendMessage, isLoading } = useChatAI({
provider: 'openai',
apiKey: 'your-openai-api-key',
model: 'gpt-3.5-turbo',
});
const handleSend = async () => {
if (input.trim()) {
await sendMessage(input);
setInput('');
}
};
return (
<View>
{messages.map((msg) => (
<Text key={msg.id}>
{msg.role}: {msg.content}
</Text>
))}
<TextInput
value={input}
onChangeText={setInput}
placeholder="Type your message..."
/>
<Button title="Send" onPress={handleSend} disabled={isLoading} />
</View>
);
};
import React from 'react';
import { View } from 'react-native';
import { AIChat } from 'react-native-ai-kit';
const App = () => {
return (
<View style={{ flex: 1 }}>
<AIChat
config={{
provider: 'openai',
apiKey: 'your-openai-api-key',
}}
placeholder="Ask me anything..."
showTimestamp={true}
/>
</View>
);
};
import React, { useState } from 'react';
import { View, TextInput, Button, Image } from 'react-native';
import { useImageAI } from 'react-native-ai-kit';
const ImageGenerator = () => {
const [prompt, setPrompt] = useState('');
const { images, generateImage, isLoading } = useImageAI({
provider: 'openai',
apiKey: 'your-openai-api-key',
size: '1024x1024',
});
const handleGenerate = async () => {
if (prompt.trim()) {
await generateImage(prompt);
setPrompt('');
}
};
return (
<View>
<TextInput
value={prompt}
onChangeText={setPrompt}
placeholder="Describe the image you want..."
/>
<Button title="Generate" onPress={handleGenerate} disabled={isLoading} />
{images.map((img) => (
<Image key={img.id} source={{ uri: img.url }} style={{ width: 200, height: 200 }} />
))}
</View>
);
};
import React from 'react';
import { View, Button, Text } from 'react-native';
import { useSpeechToText } from 'react-native-ai-kit';
const VoiceRecorder = () => {
const { transcript, isListening, startListening, stopListening } = useSpeechToText({
language: 'en-US',
continuous: true,
});
return (
<View>
<Text>Transcript: {transcript}</Text>
<Button
title={isListening ? 'Stop Recording' : 'Start Recording'}
onPress={isListening ? stopListening : startListening}
/>
</View>
);
};
import React, { useState } from 'react';
import { View, TextInput, Button } from 'react-native';
import { useTextToSpeech } from 'react-native-ai-kit';
const TextReader = () => {
const [text, setText] = useState('');
const { speak, stop, isSpeaking } = useTextToSpeech({
rate: 1.0,
pitch: 1.0,
});
return (
<View>
<TextInput
value={text}
onChangeText={setText}
placeholder="Enter text to speak..."
multiline
/>
<Button
title={isSpeaking ? 'Stop' : 'Speak'}
onPress={() => (isSpeaking ? stop() : speak(text))}
/>
</View>
);
};
useChatAI(config: ChatAIConfig)Config Options:
provider: 'openai' | 'gemini'apiKey: Your API keymodel?: Model name (default: 'gpt-3.5-turbo' for OpenAI)maxTokens?: Maximum response tokens (default: 1000)temperature?: Response creativity (0-1, default: 0.7)Returns:
messages: Array of chat messagessendMessage(content: string): Send a messageisLoading: Loading stateerror: Error message if anyclearMessages(): Clear chat historyuseImageAI(config: ImageAIConfig)Config Options:
provider: 'openai'apiKey: Your API keymodel?: Model name (default: 'dall-e-3')size?: Image size (default: '1024x1024')quality?: 'standard' | 'hd'style?: 'vivid' | 'natural'Returns:
images: Array of generated imagesgenerateImage(prompt: string): Generate an imageisLoading: Loading stateerror: Error message if anyclearImages(): Clear image historyuseSpeechToText(config?: SpeechToTextConfig)Config Options:
language?: Language code (default: 'en-US')continuous?: Continuous recognition (default: true)interimResults?: Show interim results (default: true)Returns:
transcript: Current transcriptisListening: Recording statestartListening(): Start voice recognitionstopListening(): Stop voice recognitionerror: Error message if anyuseTextToSpeech(config?: TextToSpeechConfig)Config Options:
voice?: Voice namerate?: Speech rate (0.1-10, default: 1)pitch?: Voice pitch (0-2, default: 1)volume?: Volume (0-1, default: 1)Returns:
speak(text: string): Speak the textstop(): Stop speakingisSpeaking: Speaking stateerror: Error message if any<AIChat /> ComponentProps:
config: ChatAIConfig objectstyle?: Container stylemessageStyle?: Message bubble styleinputStyle?: Input field stylesendButtonStyle?: Send button styleplaceholder?: Input placeholdersendButtonText?: Send button textshowTimestamp?: Show message timestampsmaxHeight?: Maximum chat heightconst config = {
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY || 'your-api-key',
};
const config = {
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY || 'your-api-key',
model: 'gemini-pro',
};
git clone https://github.com/krixs3112/react-native-ai-kit.git
cd react-native-ai-kit
npm install
npm run build # Build the package
npm run test # Run tests
npm run lint # Lint code
npm run format # Format code
npm run test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm loginpackage.json# 1. Build the package
npm run build
# 2. Run tests
npm test
# 3. Publish to npm
npm publish --access public
The package includes GitHub Actions for automated publishing:
main branchgit tag v0.1.0 && git push origin v0.1.0Contributions are welcome! Please read our Contributing Guide for details.
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the React Native community
FAQs
A React Native utility kit for AI-powered apps with chat, image generation, speech-to-text, and text-to-speech capabilities
The npm package react-native-ai-kit receives a total of 1 weekly downloads. As such, react-native-ai-kit popularity was classified as not popular.
We found that react-native-ai-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.