0.1.4 • Published 1 year ago

react-native-connectivity-checker v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-connectivity-checker

Simple module which checks location status on android and ios

Installation

yarn add react-native-connectivity-checker

Usage

import * as React from 'react';

import { StyleSheet, Text, View } from 'react-native';
import ConnectivityChecker from 'react-native-connectivity-checker';

export default function App() {
  const [result, setResult] = React.useState<boolean>();

  React.useEffect(() => {
    ConnectivityChecker.isLocationEnabled().then((res) => {
      setResult(res);
    });

    const listener = ConnectivityChecker.addListener((res) => {
      setResult(res.status);
    });

    return () => {
      listener.remove();
    };
  }, []);

  return (
    <View style={styles.container}>
      <Text>Result: {String(result)}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago