0.1.9 • Published 2 years ago

react-native-internet-connection-alert v0.1.9

Weekly downloads
82
License
MIT
Repository
github
Last release
2 years ago

Battle Tested ✅

Fully customizable internet connection connection with built-in alert for React Native

npm version npm Platform - Android and iOS License: MIT styled with prettier

Installation

Add the dependency:

npm i react-native-internet-connection-alert

Peer Dependencies

"react-native-dropdownalert": "=> 4.5.1",
"@react-native-community/netinfo": "=> 8.3.0"

Usage

Import

import InternetConnectionAlert from "react-native-internet-connection-alert";

Fundamental Usage

I strongly suggest that cover whole application with InternetConnectionAlert component it will handle itself and be able to shows the built-in alert on your whole application. Otherwise, just cover the screen where you need to use this library.

<InternetConnectionAlert
  onChange={(connectionState) => {
    console.log("Connection State: ", connectionState);
  }}
>
  {/* {... Your whole application should be here ... } */}
</InternetConnectionAlert>

Configuration - Props

PropertyTypeDefaultDescription
onChangefunctionundefinedif you need the connection state when it is changed, you can use this function
typeDropdownAlertTypeerrorUse some of the prepared dropdown types or if you want to use your own customization set 'custom'
titlestringInternet Connection Problemto change the title of built-in alert
messagestringPlease check your network connectionto change the message of built-in alert
useInternetReachabilitybooleanfalseto change the check for connection state to use internet reachability

Everything is customizable on built-in dropdownalert. Simply please look at the React Native Dropdown Alert

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Author

FreakyCoder, kurayogun@gmail.com

License

React Native Internet Connection Alert is available under the MIT license. See the LICENSE file for more info.