aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/GradientBackground.tsx
blob: c1247ca252e097ec225de85ba202d7e9f9849120 (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
import React from 'react';
import LinearGradient from 'react-native-linear-gradient';
import {
  StyleSheet,
  TouchableWithoutFeedback,
  Keyboard,
  ViewProps,
} from 'react-native';

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

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

export default GradientBackground;