0.2.42 • Published 4 days ago

@ray-js/components-ty-slider v0.2.42

Weekly downloads
-
License
MIT
Repository
-
Last release
4 days ago

English | 简体中文

@ray-js/components-ty-slider

latest download

涂鸦风格滑动条

Installation

$ npm install @ray-js/components-ty-slider
# or
$ yarn add @ray-js/components-ty-slider

Usage

NormalSlider

<Slider />

NormalSlider Custom Style & Props

<Slider
  step={25}
  isShowTicks
  maxTrackHeight="8px"
  maxTrackRadius="8px"
  minTrackHeight="8px"
  minTrackColor="linear-gradient(to right, #158CFB, orange)"
  maxTrackTickHeight="4px"
  maxTrackTickWidth="4px"
  maxTrackTickRadius="2px"
  minTrackTickHeight="4px"
  minTrackTickWidth="4px"
  minTrackTickRadius="2px"
/>

NormalSlider showValue

<View style={{ display: 'flex', alignItems: 'center' }}>
  <Slider value={value} onChange={onChange} maxTrackColor="orange" />
  <View style={{ marginLeft: '4px' }}>
    <Text>{value}</Text>
  </View>
</View>

PrettoSlider

<Slider
  maxTrackHeight="26px"
  maxTrackRadius="26px"
  minTrackHeight="22px"
  minTrackWidth="22px"
  thumbWidth="18px"
  thumbHeight="18px"
/>

PrettoSlider Custom Style & Props

<Slider
  maxTrackHeight="26px"
  maxTrackRadius="6px"
  minTrackHeight="22px"
  minTrackWidth="10px"
  thumbWidth="3px"
  thumbHeight="16px"
  thumbRadius="1.5px"
/>

ScaleSlider

<Slider
  isShowTicks
  step={25}
  maxTrackHeight="40px"
  maxTrackRadius="16px"
  minTrackWidth="40px"
  minTrackHeight="40px"
  thumbWidth="0px"
/>

Vertical Slider

// NormalSlider
<Slider
  isVertical
  maxTrackWidth="4px"
  maxTrackHeight="200px"
  minTrackWidth="4px"
  minTrackHeight="28px"
  style={{ marginRight: '30px' }}
/>
// PrettoSlider
<Slider
  isVertical
  maxTrackWidth="26px"
  maxTrackHeight="200px"
  maxTrackRadius="26px"
  minTrackWidth="22px"
  minTrackHeight="22px"
  thumbWidth="18px"
  thumbHeight="18px"
  style={{ marginRight: '30px' }}
/>
// ScaleSlider
<Slider
  isVertical
  isShowTicks
  step={25}
  maxTrackWidth="40px"
  maxTrackHeight="200px"
  maxTrackRadius="16px"
  minTrackWidth="40px"
  minTrackHeight="40px"
  thumbWidth="0px"
  maxTrackTickWidth="12px"
  maxTrackTickHeight="4px"
  minTrackTickWidth="12px"
  minTrackTickHeight="4px"
/>

Prevent Page Scroll

If you need to prevent the page from scrolling, you can use ScrollView as the root node.

const [value, setValue] = React.useState(0);
const [isScrollY, setIsScrollY] = React.useState(true);

const onChange = (event: number) => {
  setValue(event);
};
const onBeforeChange = () => {
  setIsScrollY(false);
};
const onAfterChange = () => {
  setIsScrollY(true);
};
<ScrollView className={{ width: '100%', height: '100vh' }} scrollY={isScrollY}>
  <Slider
    value={value}
    onChange={onChange}
    onBeforeChange={onBeforeChange}
    onAfterChange={onAfterChange}
  />
</ScrollView>;

Sjs Slider

import SjsSlider from '@ray-js/components-ty-slider/lib/slider';

<SjsSlider
  reverse
  direction="vertical"
  barPad={-4}
  step={1}
  end={value}
  bind:onChange={event => {
    setValue(event.detail.end);
    console.log('onChange', event.detail);
  }}
  bind:onEnd={event => {
    setValue(event.detail.end);
    console.log('onEnd', event.detail);
  }}
  bind:onStart={event => {
    setValue(event.detail.end);
    console.log('onStart', event.detail);
  }}
/>
0.2.41-beta-3

4 days ago

0.2.41

4 days ago

0.2.42

4 days ago

0.2.41-beta-2

2 months ago

0.2.41-beta-1

2 months ago

0.2.40

2 months ago

0.2.39

2 months ago

0.2.38

4 months ago

0.2.37

4 months ago

0.2.37-beta-1

4 months ago

0.2.36

5 months ago

0.2.36-beta-7

5 months ago

0.2.36-beta-6

5 months ago

0.2.36-beta-5

5 months ago

0.2.36-beta-4

5 months ago

0.2.36-beta-3

5 months ago

0.2.36-beta-2

5 months ago

0.2.36-beta-1

5 months ago

0.2.30-beta-1

8 months ago

0.2.35

6 months ago

0.2.34

6 months ago

0.2.33

7 months ago

0.2.32

7 months ago

0.2.31

7 months ago

0.2.29

10 months ago

0.2.28

11 months ago

0.2.27

1 year ago

0.2.26

1 year ago

0.2.25

1 year ago

0.2.24

1 year ago

0.2.23

1 year ago

0.2.22

1 year ago

0.2.21

1 year ago

0.2.20

1 year ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9-beta-8

2 years ago

0.2.5-beta-8

2 years ago

0.2.9-beta-7

2 years ago

0.2.5-beta-7

2 years ago

0.2.5-beta-9

2 years ago

0.2.5-beta-4

2 years ago

0.2.5-beta-3

2 years ago

0.2.5-beta-6

2 years ago

0.2.5-beta-5

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.2.9-beta-2

2 years ago

0.2.5-beta-2

2 years ago

0.2.9-beta-1

2 years ago

0.2.5-beta-1

2 years ago

0.1.9

2 years ago

0.2.9-beta-4

2 years ago

0.2.9-beta-3

2 years ago

0.2.9-beta-6

2 years ago

0.1.6

2 years ago

0.2.9-beta-5

2 years ago

0.1.5

2 years ago

0.2.5-beta-10

2 years ago

0.2.5-beta-11

2 years ago

0.1.5-beta-1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.4

2 years ago

0.1.4-beta-3

2 years ago

0.1.4-beta-2

2 years ago

0.1.4-beta-1

2 years ago

0.1.3-beta-1

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1-beta-1

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5-beta-1

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago