0.0.64 • Published 9 months ago

react-native-circular-slider-with-updates v0.0.64

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Circular Gauge

3 types Circular Slider Component for React Native.

Support type

  • Amount: amount of the total amount
  • Percent: percentages of total amount
  • Duration: start and end in total amount

Installation

npm install --save react-native-circular-slider-with-updates

or

yarn add react-native-circular-slider-with-updates

Peer Dependencies

  • react-natie-reanimated(v2)
  • react-native-gesture-handler

Example

Screen Shot 2022-07-28 at 04 25 07 AM

Anatomy

The name refers to Material UI.

Screen Shot 2022-07-28 at 04 19 56 AM

Usage

const [size, setSize] = useState(200);
const [amount, setAmount] = useState(25);
const [percents, setPercents] = useState([40, 30, 20, 10]);
const [duration, setDuration] = useState({
  start: 10,
  end: 50,
});
const [clockwise, setClockwise] = useState(true);

return (
  <>
    <AmountSlider
      size={size}
      amount={amount}
      onChange={setAmount}
      clockwise={clockwise}
    />
    <PercentSlider
      percents={percents}
      size={size}
      onChange={setPercents}
      clockwise={clockwise}
    />
    <DurationSlider
      size={size}
      duration={duration}
      onChange={setDuration}
      clockwise={clockwise}
    />
  </>
);

Properties

Amount

NameDescriptionTypeRequiredDefault
amountnumber
thumbColorcolor of thumbstring#FFA500
thumbIconIcon component to be displayed in the center of the thumbReactNode
filledColorcolor of filled gaugestring#FFE5B4
onChangecalled when the amount value is changedfunction(amount: number)

Percent

NameDescriptionTypeRequiredDefault
percentsnumber[]
thumbColorcolor of thumbstring[]#FFA500
thumbIconIcon component to be displayed in the center of the thumbReactNode[]
filledColorcolor of filled gaugestring[]#FFE5B4
onChangeCalled when the percents value is changedfunction(percents: number[])

Duration

NameDescriptionTypeRequiredDefault
duration{start: number; end: number;}
thumbColorcolor of thumbstring#FFA500
thumbIconIcon component to be displayed in the center of the thumb{start: ReactNode, end: ReactNode}
filledColorcolor of filled gaugestring#FFE5B4
onChangeCalled when the duration value is changedfunction(duration: {start: number; end: number;})

Common

NameDescriptionTypeRequiredDefault
sizesize of slidernumber
clockwiserotation directionbooleantrue

Track Options

NameDescriptionTypeRequiredDefault
widthwidth of tracknumber10% of size
colorcolor of trackstring#7F8487

Tick Mark Options

NameDescriptionTypeRequiredDefaultAmountPercentDuration
showIf you need to render Tick MarkBooleanfalse
totalmaximum value of sliderNumber100
unitTick Mark division unitNumber5
colorcolor of Tick MarkString#7F8487
lengthlegnth of Tick MarkNumber10
thicknessthickness of Tick MarkBoolean2
showTextIf you need to render Tick Mark unitsStringshow option value
textSizesize of textNumber10
textColorcolor of textNumber#191919

Reference

YouTuber William Candillon's "can-it-be-done-in-react-native" lecture was very helpful.

License

MIT

0.0.64

9 months ago

0.0.63

9 months ago

0.0.62

9 months ago

0.0.61

9 months ago

0.0.60

9 months ago

0.0.59

9 months ago

0.0.58

9 months ago

0.0.57

9 months ago

0.0.56

9 months ago

0.0.55

9 months ago

0.0.54

9 months ago

0.0.53

9 months ago

0.0.52

9 months ago

0.0.51

9 months ago

0.0.50

9 months ago

0.0.48

9 months ago

0.0.47

9 months ago

0.0.46

9 months ago

0.0.45

9 months ago

0.0.44

9 months ago

0.0.43

9 months ago

0.0.42

9 months ago

0.0.41

9 months ago

0.0.40

9 months ago

0.0.39

9 months ago

0.0.38

9 months ago

0.0.37

9 months ago

0.0.36

9 months ago

0.0.35

9 months ago

0.0.34

9 months ago

0.0.33

9 months ago

0.0.32

9 months ago

0.0.31

9 months ago

0.0.30

9 months ago

0.0.29

9 months ago

0.0.28

9 months ago

0.0.27

9 months ago

0.0.26

9 months ago

0.0.25

9 months ago

0.0.24

9 months ago

0.0.23

9 months ago

0.0.22

9 months ago

0.0.21

9 months ago

0.0.20

9 months ago

0.0.19

9 months ago

0.0.18

9 months ago

0.0.17

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago