import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { useFonts } from 'expo-font';
import AppLoading from 'expo-app-loading';
import { PxCheckBox } from '@proximus/react-native-common-ui/lib/inputs/v7/PxCheckBox';

export default function App() {
  const [selected, setSelected] = useState(false);
  const [loaded] = useFonts({
    'Proximus-Bold': require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Bold.ttf'),
    'Proximus-Regular': require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Regular.ttf'),
    Proximus: require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Regular.ttf'),
  });

  if (!loaded) {
    return <AppLoading />;
  }

  return (
    <View style={styles.container}>
      <View style={styles.viewRow}>
        <PxCheckBox
          checked={selected}
          onChange={(value) => setSelected(value)}
          label={'Default'}
        />
      </View>
      <View style={styles.viewRow}>
        <PxCheckBox
          checked={selected}
          onChange={(value) => setSelected(value)}
          label={'Error'}
          hasError
        />
      </View>
      <View style={styles.viewRow}>
        <PxCheckBox
          checked={selected}
          onChange={(value) => setSelected(value)}
          disabled
          label={'Disabled'}
        />
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    justifyContent: 'center',
    alignItems: 'center',
    padding: 20,
  },
  viewRow: {
    marginBottom: 10,
    width: 200,
  },
});
