![New Socket Web Extension, Take Socket with You](https://cdn.sanity.io/images/cgdhsj6q/production/7c7e90f37af51d175eaf8b2ae56124aec35c57c8-874x566.png?w=400&fit=max&auto=format)
Product
New Socket Web Extension, Take Socket with You
Can you spot malicious malicious packages on the web at a glance? Socket can. Check out our updated Web Extension!
@logrocket/react-native
Advanced tools
Readme
$ npm install @logrocket/react-native --save
If you are using React Native < 0.60, link the package using react-native:
npx react-native link @logrocket/react-native
Add the maven repository to the repositories
block of build.gradle
:
maven { url "https://storage.googleapis.com/logrocket-maven/" }
This package cannot be used in the "Expo Go" app because it requires custom native code.
After installing this npm package, add the config plugin to the plugins
array of your app.json
or app.config.js
:
{
"expo": {
"plugins": ["@logrocket/react-native"]
}
}
Now you can build your app with EAS Build or npx expo run:
as described in the "Adding custom native code" guide.
Feature | Android | iOS |
---|---|---|
Screen Capture | :heavy_check_mark: | :heavy_check_mark: |
View Redaction | :heavy_check_mark: | :heavy_check_mark: |
Touch Events | :heavy_check_mark: | :heavy_check_mark: |
Identify and User Traits | :heavy_check_mark: | :heavy_check_mark: |
Network Requests & Responses | :heavy_check_mark: | :heavy_check_mark: |
Console Logs | :heavy_check_mark: | :heavy_check_mark: |
Exceptions | :heavy_check_mark: | :heavy_check_mark: |
Custom Events | :heavy_check_mark: | :heavy_check_mark: |
getSessionURL | :heavy_check_mark: | :heavy_check_mark: |
Redux middleware | :heavy_check_mark: | :heavy_check_mark: |
Connection quality config | :heavy_check_mark: | :x: |
LogRocket instruments the XmlHttpRequest and fetch APIs to capture network requests and responses. For network sanitization, visit our docs: https://docs.logrocket.com/reference/network
LogRocket also automatically captures all messages logged to the console. For configuration options see our docs: https://docs.logrocket.com/reference/console.
To use the redaction feature, first set the testID
prop on any element you want redacted, e.g., <Foo testID='RedactionString' />
Then, when you call init
, send the testID
value as part of the redactionTags
configuration option.
To enable only uploads when a wifi connection is active, use the connectionType
configuration option with the value WIFI
. Only supported on Android currently.
import LogRocket from '@logrocket/react-native';
LogRocket.init('YOUR_APP_ID', {
network: {
requestSanitizer: request => {
if (request.headers['x-auth-token']) {
request.headers['x-auth-token'] = '';
}
return request;
},
},
connectionType: 'WIFI',
console: {
isEnabled: {
info: false,
},
shouldAggregateConsoleErrors: true,
},
redactionTags: ['RedactionString'],
});
LogRocket.getSessionURL((url) => {
console.log("LogRocket session URL: " + url);
})
LogRocket.identify('12345', {
name: 'Rog Locket',
email: 'roglocket@logrocket.com',
});
LogRocket.captureException(new Error('error'));
LogRocket.captureMessage('a custom message', {
tags: { method: 'POST' },
extra: { couponApplied: false, total: 42.99 }
});
LogRocket.track('PurchaseComplete', {
revenue: 42.99,
productCategory: 'Clothing',
productSku: 4887369299,
couponApplied: true,
customerSegments: ['aef34b', '97cb20']
});
LogRocket.tagPage('Apparel/Sweaters');
To disable the Android SDK add the following to your project's react-native.config.js
:
module.exports {
dependencies: {
'@logrocket/react-native': {
platforms: {
android: null,
},
},
},
};
To disable the iOS SDK add the following to your project's react-native.config.js
:
module.exports {
dependencies: {
'@logrocket/react-native': {
platforms: {
ios: null,
},
},
},
};
Then run cd ios/ && pod update
to ensure the Native SDK is removed as a dependency.
FAQs
LogRocket SDK for react-native
The npm package @logrocket/react-native receives a total of 6,944 weekly downloads. As such, @logrocket/react-native popularity was classified as popular.
We found that @logrocket/react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Can you spot malicious malicious packages on the web at a glance? Socket can. Check out our updated Web Extension!
Product
Socket introduces three new customizable default security policies for users to choose from: Low Noise (traditional SCA), Default, and Higher Noise.
Security News
MITRE has just minted its 400th CNA, as the NVD struggles to tame its backlog of CVEs awaiting analysis, which has increased by 30% since June.