npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stock42-react-native-lib

v1.0.4

Published

Stock42 React Native Lib. Report all logs, actions and more from your backend and server applications.

Downloads

182

Readme

Stock42 logo

Stock42 React Native

Platform NPM Badge

PRs Welcome

Official library for integrating Stock42 Services into your React Native applications, beginning with our powerful analytics tools.

Installation

To install the Stock42 React Native library, run the following command:

$ npm install stock42-react-native-lib --save

Stock42 React Native lib Analytics

Initializing

To get started, obtain a valid application token by registering a new tenant and creating an application at Stock42.

import { Stock42 } from 'stock42-react-native-lib'

try {
	const { track, screenshot } = await Stock42({
			appVersion: '1.0', // your mobile app version
			appName: 'Stock42Test', // your mobile app name
			userAgent: 'stock42agent', // your app userAgent
			applicationToken: 'bd23a6fb-02e6-4ac6-8e5c-2aa28bd83db2-FV2AH3', //get this using Stock42 Mobile Apps
			deviceId: '1', //important: generate your own deviceId for each device
		})
} catch (err) {
	console.info('Fatal Hit Errors: ', err)
}

Additional Dependency for Screenshots

To enable the screenshot functionality, you must also install react-native-view-shot:

npm install react-native-view-shot --save

This library allows you to capture fully rendered screenshots of your app. For more details, visit the react-native-view-shot GitHub page.

Sending hits

To send analytics hits to Stock42, use the track.do method as shown below:

	track.do({
		eventName: 'custom',
		screenName: 'home',
		functionName: `functionForSomeOne`,
		data: {
			msg: 'random msg',
		},
	})

Sending screenshot

Ensure you have installed react-native-view-shot and then use the screenshot.do method:

screenshot.do({
    screenName: 'screentesting',
    base64: 'base64-encoded-image-string'
});

import { captureScreen } from 'react-native-view-shot';

captureScreen({
  format: "jpg",
  quality: 0.8
}).then(
  uri => console.log("Image saved to", uri),
  error => console.error("Oops, snapshot failed", error)
);


screenshot.do({
			screenName: 'screentesting',
			base64:
				'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACClBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKDgUBAgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAtEQcFFx4HAwEAAAArEAcCCAsAAAAiDQUBBQYAAAAEAgEBBAYnNxI2TBktPxQTGwkcJw1qlTCEuzx1ozJxnjBxnjFKaCENEgYMEAVrlzGJwT4/XykYQkgYR08lSTZKaydObSEAAAAyRxeNx0BdgikJICYce6UnpdwknNEab5UlTT8fLA4RBgNVdiaOyUE2TRgIBwkWHyMNPlMgh7QqreYkmc0SRloBAwMTBwNVIw5kjC2Jwj8hMA1paGrNzcxlY2ISHiQTV3Uno9kno9gPPVE8Fgl5MRRijS6Hvz4bJwuFhIb////6+vq6ubkuLy8NQVcijLoEEBZWIA6NNhZYfSiHwD4cKQuEg4Xn5+dHR0cPBQEdY4Iop90LLTxQHg2uQBtDVRx7enz29vaipKU3NTRSIA6lPBYmPUgmotgMMEDOTSBLKxB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