{"size": 1242, "ext": "js", "max_stars_repo_path": "demo/src/screens/componentScreens/ConnectionStatusBarScreen.js", "max_stars_repo_name": "imajeet/react-native-ui-lib", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "demo/src/screens/componentScreens/ConnectionStatusBarScreen.js", "max_issues_repo_name": "imajeet/react-native-ui-lib", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "demo/src/screens/componentScreens/ConnectionStatusBarScreen.js", "max_forks_repo_name": "imajeet/react-native-ui-lib", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3469387755, "max_line_length": 98, "alphanum_fraction": 0.5942028986}
import React, {Component} from 'react';
import {View, Text, StyleSheet} from 'react-native';
import {ConnectionStatusBar, Typography, Colors} from 'react-native-ui-lib'; //eslint-disable-line

ConnectionStatusBar.registerGlobalOnConnectionLost(() => {
  console.warn('what what?!? connection has been lost');
});

export default class ConnectionStatusBarScreen extends Component {
  constructor(props) {
    super(props);
    this.state = {
      isConnected: true,
    };
  }

  render() {
    return (
      <View style={styles.container}>
        <ConnectionStatusBar
          onConnectionChange={isConnected => this.setState({isConnected})}
        />
        <Text
          style={{
            textAlign: 'center',
            marginBottom: 10,
            ...Typography.text60,
            color: Colors.dark40,
          }}
        >
          Turn your wifi on/off to see the component in action
        </Text>
        <Text style={{...Typography.text40}}>
          {this.state.isConnected ? 'Connected! :)' : 'No connection :('}
        </Text>
      </View>
    );
  }
}

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