AuthLayout.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright (C) Click & Push Accessibility, Inc - All Rights Reserved
  2. * Unauthorized copying of this file, via any medium is strictly prohibited
  3. * Proprietary and confidential
  4. * Written and maintained by the Click & Push Development team
  5. * <dev@clicknpush.ca>, January 2022
  6. */
  7. import React from "react";
  8. import { ImageBackground, Keyboard, StyleSheet, TouchableWithoutFeedback, View } from "react-native";
  9. /**
  10. * Layout shared between all Unauthorized components (and the Profile screen)
  11. * @category Unauthorized
  12. * @component
  13. */
  14. const UnauthorizedLayout : React.FC<{noPadding?: boolean}> = ({children, noPadding}) => {
  15. /**
  16. * Dismisses keyboard.
  17. */
  18. const dismissKeyboard = () => {
  19. Keyboard.dismiss();
  20. }
  21. return (
  22. <View style={{height: '100%', width: '100%'}} >
  23. <ImageBackground style={[!noPadding ? {padding: 25} : null, styles.background]} source={require('../../../assets/cover.jpg')}>
  24. <TouchableWithoutFeedback style={{height: '100%', width: '100%'}} onPress={dismissKeyboard}>
  25. <View style={{height: '100%', width: '100%'}}>
  26. {children}
  27. </View>
  28. </TouchableWithoutFeedback>
  29. </ImageBackground>
  30. </View>
  31. )
  32. }
  33. const styles = StyleSheet.create({
  34. background: {
  35. flex: 1,
  36. resizeMode: 'cover',
  37. },
  38. })
  39. export default UnauthorizedLayout;