openreplay/tracker/tracker-reactnative/README.md

1,018 B

@openreplay/react-native

Openreplay React-native connector for mobile applications.

Installation

npm install @openreplay/react-native

Please see the documentation for more information about usage.

React Native and GraphQL

You can use @openreplay/tracker-graphql to handle graphql events in react-native applications as well, via

import { createRelayMiddleware } from '@openreplay/tracker-graphql';

const appWrapper = {
  active: () => true,
  send: (gqlMsg) => {
    const type = 'gql';
    const msg = JSON.stringify({
      operationKind: gqlMsg[1],
      operationName: gqlMsg[2],
      variables: gqlMsg[3],
      response: gqlMsg[4],
      duration: gqlMsg[5],
    });
    Openreplay.sendCustomMessage(type, msg);
  },
};

// @ts-ignore - emulating web tracker here for middleware
const middleware = createRelayMiddleware(appWrapper);

// .. connect to relay network layer