Ezi Comments

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

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

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>
  )
}

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:

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

  1. Add your app ids under Allowed apps and turn on Screenshots on the project's General page.
  2. Run a development build and open review mode.
  3. Turn on Comment, tap anywhere on the screen, type a comment and tap Post.
  4. Sign in with your email and the 6-digit code.
  5. Open the project's Threads in the dashboard: the comment is there with the screenshot and your device details.

Troubleshooting

Other messages reviewers may see are explained in the overview.