aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/GradientBackground.tsx
blob: f363bd617342a425f0880055682a229c4a5271c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from 'react';
import LinearGradient from 'react-native-linear-gradient';
import {
  StyleSheet,
  TouchableWithoutFeedback,
  Keyboard,
  ViewProps,
  SafeAreaView,
} from 'react-native';

interface GradientBackgroundProps extends ViewProps {}
const GradientBackground: React.FC<GradientBackgroundProps> = (props) => {
  return (
    <LinearGradient
      locations={[0.89, 1]}
      colors={['transparent', 'rgba(0, 0, 0, 0.6)']}
      style={styles.container}>
      <TouchableWithoutFeedback accessible={false} onPress={Keyboard.dismiss}>
        <SafeAreaView {...props}>{props.children}</SafeAreaView>
      </TouchableWithoutFeedback>
    </LinearGradient>
  );
};

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

export default GradientBackground;