Ezi Comments for React Native
Add Ezi Comments to a React Native or Expo app so reviewers can comment on its screens, on iOS and Android. Read the overview first for how it works and what you need in the dashboard.
Requirements
- React Native 0.83 or later with the New Architecture, and React 19.1 or later.
- Expo apps: Expo SDK 55 or later, in a development build. Expo Go cannot load the native modules the SDK needs.
- Your project key (dashboard, Widget key).
- Your app on the project's Allowed apps page: the iOS bundle id with the platform set to iOS, and the Android application id with the platform set to Android.
Install
The SDK package is @ezi-comments/react-native. It is not on npm yet; email damianosdev@gmail.com for the package and add it to your app from the copy you receive, for example:
npm install path/to/ezi-comments-react-native
Then add the libraries it works with. They are on npm:
# Expo apps
npx expo install react-native-view-shot expo-secure-store expo-application
# Bare React Native apps
npm install react-native-view-shot react-native-keychain
cd ios && pod install
react-native-view-shottakes the screenshots.- One storage library keeps the reviewer's sign-in:
expo-secure-storeorreact-native-keychain. - Optional:
@react-navigation/native(screen names from your routes),react-native-safe-area-context(keeps the SDK's buttons clear of notches),react-native-shake(shake to open).
Rebuild the native app after adding these packages.
Set up
Wrap your app in EziReviewProvider. Turn it on only in development or internal builds:
import { EziReviewProvider } from '@ezi-comments/react-native'
import { createSecureStoreTokenStorage } from '@ezi-comments/react-native/secure-store'
import { createNavigationContainerRef, NavigationContainer } from '@react-navigation/native'
import * as Application from 'expo-application'
const navigationRef = createNavigationContainerRef()
const config = {
projectKey: 'pk_your-project-key',
endpoint: 'https://comments.example.com',
enabled: __DEV__, // or your own internal-build flag
tokenStorage: createSecureStoreTokenStorage(),
app: {
appId: Application.applicationId ?? 'com.example.app',
appVersion: Application.nativeApplicationVersion ?? '0.0.0',
build: Application.nativeBuildVersion ?? '0',
},
launcher: true, // floating button
shakeToOpen: true, // needs react-native-shake
}
export default function App() {
return (
<EziReviewProvider config={config} navigationRef={navigationRef}>
<NavigationContainer ref={navigationRef}>{/* your screens */}</NavigationContainer>
</EziReviewProvider>
)
}
projectKey: the key from Widget key.endpoint: the address of your Ezi Comments dashboard, without a path.tokenStorage: where the reviewer's sign-in is kept. UsecreateSecureStoreTokenStorage()from@ezi-comments/react-native/secure-store, orcreateKeychainTokenStorage()from@ezi-comments/react-native/keychain.app: your app id, version and build, sent with each comment.appIdmust match an entry on Allowed apps. In bare apps,react-native-device-infogives the same values.enabled: withfalse, the provider only renders your app: no button, no shake listener, no requests.
If the configuration is not valid, the SDK logs an error and turns itself off instead of crashing your app.
Open review mode
Pick one or more ways for reviewers to open it:
launcher: trueshows a floating button. Reviewers can drag it anywhere; it stays where they drop it. Off by default.shakeToOpen: trueopens review mode when the device is shaken (needsreact-native-shake). Off by default.- Call the SDK from your own code, for example a debug menu:
import { useEziReview } from '@ezi-comments/react-native'
function DebugMenu() {
const review = useEziReview()
return (
<>
<Button title="Review this screen" onPress={review.show} />
<Button title="Sign out of Ezi Comments" onPress={() => review.signOut().catch(() => {})} />
</>
)
}
show(), hide() and signOut() are also exported as plain functions.
Name your screens
Comments are grouped by screen. With navigationRef, the SDK uses the current route name. To choose a name yourself:
import { useEziScreen } from '@ezi-comments/react-native'
function CheckoutScreen() {
useEziScreen('checkout')
// ...
}
A name set on a screen applies only while its route is current. You can also pass getScreenId to the provider to compute names yourself. Names are 1 to 200 characters.
To tell developers which element a comment is about, wrap important elements in EziViewHint. A pin inside the element records its id:
import { EziViewHint } from '@ezi-comments/react-native'
;<EziViewHint id="checkout.pay">
<PayButton />
</EziViewHint>
Protect sensitive content
Wrap content that must not appear in screenshots in EziRedact. It is covered with a solid block while the screenshot is taken:
import { EziRedact } from '@ezi-comments/react-native'
;<EziRedact>
<Text>{balance}</Text>
</EziRedact>
For a view you cannot wrap, call redact(viewRef). To skip screenshots on whole screens, add shouldCapture to the configuration; reviewers can still comment there, and the comment posts without a screenshot:
shouldCapture: (screenId: string) => screenId !== 'payment',
On Android, windows with FLAG_SECURE are never captured. The screenshot is drawn from your app's own views, so it does not include system UI, the keyboard, Android dialogs and modals that open in their own window, video, or camera and GL views (these may show black).
Android backup
On Android, your app's automatic backup can copy the storage library's files. Exclude them so a restored device never carries a reviewer's sign-in: follow the backup guidance of expo-secure-store or react-native-keychain, or set android:allowBackup="false". With Expo, the expo-secure-store config plugin sets up these backup rules by default.
Check that it works
- Add your app ids under Allowed apps and turn on Screenshots on the project's General page.
- Run a development build and open review mode.
- Turn on Comment, tap anywhere on the screen, type a comment and tap Post.
- Sign in with your email and the 6-digit code.
- Open the project's Threads in the dashboard: the comment is there with the screenshot and your device details.
Troubleshooting
- "This app can't post comments": the
appIdthis build reports is not on Allowed apps for this platform. Add the iOS bundle id and the Android application id as separate entries. - Nothing appears: check that
enabledis true in this build, that the app is a development build (not Expo Go), and look for an Ezi Comments configuration error in the logs. - Shake does nothing: install
react-native-shakeand rebuild the native app. - Testing against a server on your own computer:
httpis accepted forlocalhost,127.0.0.1and[::1], and in development (__DEV__) also for private-network addresses (such as192.168.x.x) and.localnames. From an Android emulator, forward the port withadb reverse tcp:PORT tcp:PORTand usehttp://127.0.0.1:PORT.
Other messages reviewers may see are explained in the overview.