From ce3abfe9f4ea7d4c855638251148eb2ec74e6c93 Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Wed, 9 Jan 2019 09:50:00 +0100 Subject: [PATCH] fix: fix flow errors --- src/Slider/Slider.js | 17 ++++++++++++++++- src/index.js | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Slider/Slider.js b/src/Slider/Slider.js index 486c56f..959acba 100644 --- a/src/Slider/Slider.js +++ b/src/Slider/Slider.js @@ -25,6 +25,17 @@ type Props = {| +customMarker?: React.Node, |}; +type OnLayout = { + +nativeEvent: { + +layout: { + +x: number, + +y: number, + +width: number, + +height: number, + }, + }, +}; + type State = { multiSliderValues: Array, singleSliderValue: Array, @@ -35,7 +46,11 @@ export default class Slider extends React.Component { constructor(props: Props) { super(props); - const { startValue, endValue } = this.props; + const { maxValue, startValue, endValue = maxValue } = this.props; + + if (endValue > maxValue) { + console.error('End value cannot be equal or higher than maximum value'); + } this.state = { width: 0, diff --git a/src/index.js b/src/index.js index 3bbc700..424d0a3 100644 --- a/src/index.js +++ b/src/index.js @@ -20,6 +20,7 @@ export { Text } from './Text'; export { TextInput } from './TextInput'; export { Tooltip, TooltipBubble } from './Tooltip'; export { DatePicker } from './DatePicker'; +export { Slider } from './Slider'; /* Utils */ export { StyleSheet } from './PlatformStyleSheet';