Installation
Install the FeedbackKit React Native SDK along with its peer dependency feedbackkit-js using npm or yarn.
# Using npm
npm install feedbackkit-react-native feedbackkit-js
# Using yarn
yarn add feedbackkit-react-native feedbackkit-js
Note: feedbackkit-js is a peer dependency and must be installed separately. The React Native SDK is built on top of the JavaScript SDK and provides native components and hooks.
Quick Start
Wrap your app with FeedbackProvider and start using the components and hooks.
import React from 'react';
import { FeedbackProvider, FeedbackList } from 'feedbackkit-react-native';
export default function App() {
return (
<FeedbackProvider
apiKey="your-api-key"
userId="user_12345"
>
<FeedbackList
onFeedbackPress={(feedback) => console.log(feedback.title)}
/>
</FeedbackProvider>
);
}
FeedbackProvider
The FeedbackProvider component wraps your app and provides the FeedbackKit context to all child components.
Props
| Prop | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your project API key |
| userId | string | No | Default user identifier |
| theme | FeedbackKitTheme | No | Custom theme configuration |
| children | ReactNode | Yes | Your app components |
Context Value
The provider exposes the following context value accessible via useFeedbackKit():
| Property | Type | Description |
|---|---|---|
| client | FeedbackKit | The underlying FeedbackKit client |
| userId | string | undefined | Current user ID |
| setUserId | (id?: string) => void | Update user ID |
| theme | FeedbackKitTheme | Current theme |
| isInitialized | boolean | Whether client is ready |
Hooks
The React Native SDK provides custom hooks for managing feedback, votes, and comments with built-in state management.
useFeedbackKit()
Returns the FeedbackKit context with the client instance and current state.
const { client, userId, setUserId } = useFeedbackKit();
useFeedbackList(initialFilter?)
Fetches and manages a list of feedback items with optional filtering.
const {
feedbacks,
isLoading,
error,
refetch,
filter,
setFilter
} = useFeedbackList({ status: FeedbackStatus.Pending });
useFeedback(feedbackId)
Fetches a single feedback item by ID with automatic refetching.
const { feedback, isLoading, error, refetch } = useFeedback('feedback-id');
useVote()
Manages voting and unvoting for feedback items.
const { vote, unvote, isVoting, error } = useVote();
// Vote for feedback
await vote('feedback-id', { userId: 'user_12345' });
// Remove vote
await unvote('feedback-id', { userId: 'user_12345' });
useComments(feedbackId)
Fetches and manages comments for a feedback item.
const {
comments,
isLoading,
error,
refetch,
addComment
} = useComments('feedback-id');
// Add a comment
await addComment({
content: 'Great idea!',
userId: 'user_12345'
});
useSubmitFeedback()
Submits new feedback with loading and error states.
const { submit, isSubmitting, error, clearError } = useSubmitFeedback();
const created = await submit({
title: 'Dark mode',
description: 'Please add dark mode',
category: FeedbackCategory.FeatureRequest,
userId: 'user_12345'
});
Components
Pre-built React Native components for common feedback UI patterns.
FeedbackList
Displays a scrollable list of feedback items with filtering and pull-to-refresh.
| Prop | Type | Required |
|---|---|---|
| onFeedbackPress | (feedback: Feedback) => void | No |
| filter | ListFeedbackOptions | No |
| style | ViewStyle | No |
FeedbackCard
Displays a single feedback item with vote button, status badge, and category.
| Prop | Type | Required |
|---|---|---|
| feedback | Feedback | Yes |
| onPress | () => void | No |
| style | ViewStyle | No |
VoteButton
Interactive vote button with optimistic updates and vote count.
| Prop | Type | Required |
|---|---|---|
| feedbackId | string | Yes |
| hasVoted | boolean | Yes |
| voteCount | number | Yes |
StatusBadge
Displays feedback status with color-coded badge.
| Prop | Type | Required |
|---|---|---|
| status | FeedbackStatus | Yes |
CategoryBadge
Displays feedback category with icon and color.
| Prop | Type | Required |
|---|---|---|
| category | FeedbackCategory | Yes |
Theming
Customize the appearance of FeedbackKit components by providing a custom theme to the FeedbackProvider.
FeedbackKitTheme Interface
| Property | Type | Description |
|---|---|---|
| primaryColor | string | Primary brand color |
| backgroundColor | string | Main background color |
| cardBackgroundColor | string | Card/surface color |
| textColor | string | Primary text color |
| secondaryTextColor | string | Secondary text color |
| borderColor | string | Border color |
| errorColor | string | Error state color |
| successColor | string | Success state color |
| statusColors | Record<FeedbackStatus, string> | Status badge colors |
| categoryColors | Record<FeedbackCategory, string> | Category badge colors |
| borderRadius | number | Default border radius |
| spacing | number | Base spacing unit |
Custom Theme Example
import { FeedbackKitTheme } from 'feedbackkit-react-native';
const darkTheme: FeedbackKitTheme = {
primaryColor: '#F59E0B',
backgroundColor: '#1F2937',
cardBackgroundColor: '#374151',
textColor: '#F9FAFB',
secondaryTextColor: '#9CA3AF',
borderColor: '#4B5563',
errorColor: '#EF4444',
successColor: '#10B981',
borderRadius: 12,
spacing: 16
};
<FeedbackProvider apiKey="..." theme={darkTheme}>
{...}
</FeedbackProvider>
Models & Types
The React Native SDK re-exports all models and types from feedbackkit-js. See the JavaScript SDK documentation for the complete type reference.
Core Types
-
•
Feedback- Complete feedback object with metadata -
•
FeedbackStatus- Enum: pending, approved, in_progress, testflight, completed, rejected -
•
FeedbackCategory- Enum: bug_report, feature_request, improvement, question, other -
•
Comment- Comment object with user info -
•
VoteResponse- Vote result with updated counts
Error Handling
The React Native SDK uses the same error hierarchy as the JavaScript SDK. All errors extend the base FeedbackKitError class.
| Error Class | Status Code | Description |
|---|---|---|
| FeedbackKitError | — | Base error class |
| AuthenticationError | 401 | Invalid API key |
| PaymentRequiredError | 402 | Subscription limit exceeded |
| ForbiddenError | 403 | Action not allowed |
| NotFoundError | 404 | Resource not found |
| ConflictError | 409 | Duplicate action |
| ValidationError | 400 | Request validation failed |
| NetworkError | 0 | Network connectivity issue |
import {
AuthenticationError,
PaymentRequiredError,
NetworkError
} from 'feedbackkit-react-native';
const { submit, error } = useSubmitFeedback();
if (error instanceof AuthenticationError) {
// Invalid API key
} else if (error instanceof PaymentRequiredError) {
// Upgrade plan required
} else if (error instanceof NetworkError) {
// Check internet connection
}