
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
react-native-connection-info
Advanced tools
Higher order component for React Native to detect network connection state.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Socket optimized override available and High CVE
Higher order component for React Native to detect network connection state.
Use withConnection
to inject the connection
object which currently has the isConnected
property.
This is a boolean value that indicates internet connectivity status (see the NetInfo
documentation on isConnected
).
npm install --save react-native-connection-info
Make sure to also include permissions on Android. Add the following line to your AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
import React from 'react';
import {
Text,
View,
} from 'react-native';
import { withConnection, connectionShape } from 'react-native-connection-info';
const MyComponent = ({ connection }) => (
<View>
<Text
style={{ color: connection.isConnected ? 'lightskyblue' : 'lightcoral' }}
>
{connection.isConnected ? 'Connected' : 'Offline'}
</Text>
</View>
)
MyComponent.propTypes = {
connection: connectionShape,
};
export default withConnection(MyComponent);
Usage with redux is supported by default.
This section is only used if you need to reference the wrapped instance using getWrappedInstance()
when using react-redux
's connect()
. This component uses { withRef: true }
.
// instead of importing from 'react-native-connection-info'
// import { withConnection, connectionShape } from 'react-native-connection-info';
// just add /redux
import { withConnection, connectionShape } from 'react-native-connection-info/redux';
The rest is the same as in the first example.
FAQs
Higher order component for React Native to detect network connection state.
We found that react-native-connection-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.