How to use sentry-expo - 10 common examples

To help you get started, we’ve selected a few sentry-expo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckiely91 / acrofever / native / src / timesync.js View on Github external
});
      const end = Date.now();
      const json = await res.json();
      const timestamp = json.result;
      const roundtrip = start - end;
      const thisOffset = timestamp - end + roundtrip / 2;

      if (offset === 0) {
        // Apply first offset immediately
        offset = thisOffset;
      }

      results.push({ roundtrip, offset: thisOffset });
    } catch(e) {
      console.log(e);
      Sentry.captureException(new Error("error fetching time: " + e.message));
    }

    await sleep;
  }

  // calculate the limit for outliers
  const roundtrips = results.map(result => result.roundtrip);
  const limit = median(roundtrips) + std(roundtrips);

  // filter all results which have a roundtrip smaller than the mean+std
  const filtered = results.filter(result => result.roundtrip < limit);
  var offsets = filtered.map(result => result.offset);

  // Now if we have any offsets left, set the main offset to that.
  if (offsets.length > 0) {
    offset = mean(offsets);
github expo / harvard-cs50-app / utils / DownloadManager.js View on Github external
async _startDownloadForId(id) {
    const data = this._getDataWithId(id);
    const videoUri = data.videos['240p'];
    const fileUri = FileSystem.documentDirectory + id + '.mp4';

    // TODO: Catch errors
    try {
      const { exists } = await FileSystem.getInfoAsync(fileUri);
      if (exists) {
        await FileSystem.deleteAsync(fileUri);
      }
    } catch (e) {
      console.log('File overwrite error', e);
      Sentry.captureException(e);
      Sentry.captureMessage('File overwrite error');
      this._updateStore(id, ERROR({ message: 'Error downloading file' }));
      return;
    }

    try {
      const downloadResumable = FileSystem.createDownloadResumable(
        videoUri,
        fileUri,
        {},
        _.throttle(this._createDownloadProgressHandler(id), 200)
      );
      this._downloadResumables[id] = downloadResumable;
      const uri = await downloadResumable.downloadAsync();
      if (uri) {
        this._updateStore(id, DOWNLOADED({ uri }));
      }
github Flaque / quirk / src / sentry / index.ts View on Github external
import * as Sentry from "sentry-expo";

Sentry.init({
  dsn: "https://a9115f37287d4db39106d77e73aefa03@sentry.io/1443374",
  // @ts-ignore
  enableInExpoDevelopment: true,
  debug: true,
});

export default Sentry;
github withspectrum / spectrum / mobile / App.js View on Github external
import { Provider } from 'react-redux';
import { ApolloProvider } from 'react-apollo';
import { ThemeProvider } from 'styled-components';
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
import { type ApolloClient } from 'apollo-client';
import { initStore } from './reducers/store';

import Toasts from './components/Toasts';
import { CurrentUser } from './components/WithCurrentUser';
import theme from '../shared/theme';
import { createClient } from '../shared/graphql';
import Login from './components/Login';
import TabBar from './views/TabBar';
import { authenticate } from './actions/authentication';

let sentry = Sentry.config(
  'https://3bd8523edd5d43d7998f9b85562d6924@sentry.io/154812'
);

// Need to guard this for HMR to work
if (sentry && sentry.install) sentry.install();

export const store = initStore();

type State = {
  authLoaded: ?boolean,
  token: ?string,
  client: ApolloClient,
};

class App extends React.Component<{}, State> {
  state = {
github overthq / Auxilium / packages / app / App.tsx View on Github external
import React from 'react';
import { Provider } from 'react-redux';
import Sentry from 'sentry-expo';
import { useScreens } from 'react-native-screens';
import { PersistGate } from 'redux-persist/integration/react';
import { store, persistor } from './store';
import Root from './src/Root';

// persistor.purge();
Sentry.config(
	'https://018ed01c2b844dc1bab9fa5a84517b24@sentry.io/1409956'
).install();
useScreens();

const App = () => (
	
		
			
		
	
);

export default App;
github FiberJW / pul / main.js View on Github external
import { Provider as MobXProvider } from "mobx-react/native";
import authStore from "./stores/AuthStore";
import eventStore from "./stores/EventStore";
import trexStore from "./stores/TrexStore";
import uiStore from "./stores/UIStore";
import App from "./components/App";

if (!global.__DEV__) {
  // this guards against console usage in production builds since
  // babel transform of remove console won't work with react-native preset
  Object.keys(console).forEach(methodName => {
    console[methodName] = () => {
      /* noop */
    };
  });
  Sentry.config(sentryURL).install();
}

class Main extends Component {
  render() {
    return (
      
        
          
            
          
        
      
    );
  }
}
github letsdoitworld / World-Cleanup-Day / mobile-app / src / index.js View on Github external
import store from './config/store';
import Navigator from './config/routes';
import { images, fonts } from './config/assets';
import { operations as appOperations } from './reducers/app';
import { handleSentryError } from './shared/helpers';
import './config/styles';

import i18n from './config/i18n';

import { Api } from './services';
import { API_URL, SENTRY_URL } from '../env';

// Remove this once Sentry is correctly setup.
// Sentry.enableInExpoDevelopment = true;

Sentry.config(SENTRY_URL).install();

const WrappedNavigator = () => {
  return ;
};
// AsyncStorage.clear()
const AppNavigator = compose(
  translate('common', {
    bindI18n: 'languageChanged',
    bindStore: false,
  }),
  withNetworkGuard(),
  withLocationGuard(),
  withErrorModal(),
  withCameraService(),
)(WrappedNavigator);
github nickbclifford / Cronch / expo / App.tsx View on Github external
import { combineLatest, Subject} from 'rxjs';
import { debounceTime, switchMap, tap } from 'rxjs/operators';
import Sentry from 'sentry-expo';

import { AssignmentContext, AssignmentContextType } from './common/AssignmentContext';
import { saveBattlePlanTasks } from './common/BattlePlanTask';
import MyMICDS from './common/MyMICDS';
import { OnLoginContext, OnLoginContextType } from './common/OnLoginContext';
import Task, { createCustomTask } from './common/Task';
import { getUserBattlePlanTasks } from './common/User';
import { pickProps } from './common/Utils';
import AppContainer from './Navigation';

// Sentry error tracking
// Sentry.enableInExpoDevelopment = true;
Sentry.config('https://cfb0dd6414524ac39d87a8fac2bd55af@sentry.io/1396954').install();

export default class App extends React.Component<{}, AssignmentContextType & OnLoginContextType> {

	savePlan = new Subject();

	constructor(props: {}) {
		super(props);

		this.state = {
			loggedIn: () => {
				this.state.onLoggedIn.next();
			},
			onLoggedIn: new Subject(),
			assignments: [],
			onAssignmentsChange: new Subject(),
			updateAssignments: this.updateNewAssignments,
github expo / harvard-cs50-app / App.js View on Github external
import Store from './state/Store';
import fonts from './styles/fonts';
import config from './utils/config';
import DownloadManager from './utils/DownloadManager';
import Data from './data/Data';

import {
  EvilIcons,
  FontAwesome,
  MaterialIcons,
  Ionicons,
  Foundation,
} from '@expo/vector-icons';

// Setup Sentry
Sentry.enableInExpoDevelopment = config.sentryEnabledInDev;
Sentry.config(config.SENTRY_PUBLIC_DSN).install();

class AppContainer extends React.Component {
  state = {
    appIsReady: false,
    firstLoad: config.firstLoad,
  };

  componentWillMount() {
    this._loadAssetsAsync();
  }

  componentWillUnmount() {
    this._downloadManager && this._downloadManager.teardown();
  }
github SKempin / Lyrics-King-React-Native / App.js View on Github external
import React from 'react';
import Sentry from 'sentry-expo';
import { createAppContainer } from 'react-navigation';
import { RootStack } from './config/router';

// Remove this once Sentry is correctly setup.
Sentry.enableInExpoDevelopment = false;

Sentry.config(
  'https://705f92b0edb44599b814955f3219c1cd@sentry.io/1367138',
).install();

// App Containers
const AppContainer = createAppContainer(RootStack);

export default class App extends React.Component {
  render() {
    return ;
  }
}

sentry-expo

Catch your Javascript errors for your production Expo apps!

MIT
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis