UNPKG

react-native-autoscroll-flatlist

Version:

An enhanced React Native FlatList component to provide auto-scrolling functionality

42 lines 1.16 kB
import React from "react"; import { StyleSheet, View } from "react-native"; export class Triangle extends React.PureComponent { render() { const { size, color, direction } = this.props; const directionMapper = { up: "0deg", down: "180deg", left: "270deg", right: "90deg", }; const borderStyle = { borderLeftWidth: size, borderRightWidth: size, borderBottomWidth: size * 1.5, borderBottomColor: color, transform: [ { rotate: directionMapper[direction], }, ], }; return <View style={[styles.triangle, borderStyle]}/>; } } Triangle.displayName = "Triangle"; Triangle.defaultProps = { size: 8, color: "#000000", direction: "down", }; const styles = StyleSheet.create({ triangle: { width: 0, height: 0, backgroundColor: "transparent", borderStyle: "solid", borderLeftColor: "transparent", borderRightColor: "transparent", }, }); //# sourceMappingURL=Triangle.js.map