@react-native-gpui/slider 0.0.0-stage → 5.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/desktop/Cargo.toml +14 -0
- package/desktop/build.rs +19 -0
- package/desktop/src/lib.rs +298 -0
- package/package.json +35 -4
- package/react-native.config.js +10 -0
- package/src/RNCSliderNativeComponent.ts +40 -0
- package/src/index.ts +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@react-native-gpui/slider` are listed here. Each version's section becomes the notes of its GitHub release.
|
|
4
|
+
|
|
5
|
+
## 5.2.0-alpha.1 - 2026-11-27
|
|
6
|
+
|
|
7
|
+
- First release, for `@react-native-community/slider` 5.2.x: draws the slider with the desktop renderer: the track, the filled part, and the thumb, with pointer dragging.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Streetwriters
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @react-native-gpui/slider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adapter for [`@react-native-community/slider`](https://github.com/callstack/react-native-slider) (MIT): draws the slider with the desktop renderer: the track, the filled part, and the thumb, with pointer dragging.
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
This package is the desktop adapter for [`@react-native-community/slider`](https://github.com/callstack/react-native-slider) 5.2. Install the original library next to it; its JavaScript runs unchanged on desktop, and this package provides the native side. The upstream library is licensed under the MIT license.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @react-native-community/slider @react-native-gpui/slider
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The module is autolinked on desktop.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import Slider from '@react-native-community/slider';
|
|
21
|
+
|
|
22
|
+
<Slider
|
|
23
|
+
minimumValue={0}
|
|
24
|
+
maximumValue={100}
|
|
25
|
+
value={value}
|
|
26
|
+
onValueChange={setValue}
|
|
27
|
+
/>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Platforms
|
|
31
|
+
|
|
32
|
+
macOS is tested. Windows and Linux are not tested yet.
|
|
33
|
+
|
|
34
|
+
## Limitations
|
|
35
|
+
|
|
36
|
+
Dragging with the pointer and pressing the track set the value, and fire `onSlidingStart`, `onValueChange` and `onSlidingComplete`. `disabled`, `inverted`, `step`, the track and thumb colors and `thumbSize` are honored. The slider is in the tab order and takes focus when pressed; the arrow keys move it by one `step` (a hundredth of the range without one), Home and End move it to the ends, and each press fires `onValueChange` and `onSlidingComplete`. `vertical` and the image props are ignored.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT. See [LICENSE](LICENSE). The upstream library, [`@react-native-community/slider`](https://github.com/callstack/react-native-slider), is MIT licensed.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "rn-gpui-slider"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
react-native-gpui = "0.1"
|
|
8
|
+
# Only for DEP_RN_GPUI_CORE_RPATHS, which build.rs puts on the test binary rpath.
|
|
9
|
+
rn-gpui-sys = "0.1"
|
|
10
|
+
rn-gpui-module = "0.1"
|
|
11
|
+
gpui = "0.2"
|
|
12
|
+
|
|
13
|
+
[build-dependencies]
|
|
14
|
+
rn-gpui-module-build = "0.1"
|
package/desktop/build.rs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
fn main() {
|
|
2
|
+
rn_gpui_module_build::generate(&["../src/RNCSliderNativeComponent.ts"]);
|
|
3
|
+
test_rpaths();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/// Core's runtime is shared libraries (`libjsi.dylib`, ...). Core puts their
|
|
7
|
+
/// directories on the app's rpath only, so this crate's test binary gets them here.
|
|
8
|
+
fn test_rpaths() {
|
|
9
|
+
println!("cargo:rerun-if-env-changed=DEP_RN_GPUI_CORE_RPATHS");
|
|
10
|
+
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let Ok(dirs) = std::env::var("DEP_RN_GPUI_CORE_RPATHS") else {
|
|
14
|
+
return;
|
|
15
|
+
};
|
|
16
|
+
for dir in dirs.split('|').filter(|dir| !dir.is_empty()) {
|
|
17
|
+
println!("cargo:rustc-link-arg=-Wl,-rpath,{dir}");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
rn_gpui_module::include_specs!();
|
|
2
|
+
|
|
3
|
+
use std::cell::Cell;
|
|
4
|
+
use std::rc::Rc;
|
|
5
|
+
|
|
6
|
+
use gpui::{
|
|
7
|
+
canvas, div, prelude::*, px, rgba, AnyElement, Bounds, FocusHandle, MouseButton, Pixels, Window,
|
|
8
|
+
};
|
|
9
|
+
use react_native_gpui::host_component::{MeasureConstraint, MeasuredSize};
|
|
10
|
+
|
|
11
|
+
const TRACK_HEIGHT: f32 = 4.0;
|
|
12
|
+
const DEFAULT_THUMB: f32 = 20.0;
|
|
13
|
+
const MINIMUM_TRACK: u32 = 0x1d4ed8ff;
|
|
14
|
+
const MAXIMUM_TRACK: u32 = 0xd4d4d8ff;
|
|
15
|
+
const THUMB: u32 = 0xffffffff;
|
|
16
|
+
|
|
17
|
+
/// A React Native color, `0xAARRGGBB`, as GPUI's `0xRRGGBBAA`.
|
|
18
|
+
fn color(argb: Option<u32>, fallback: u32) -> u32 {
|
|
19
|
+
argb.map_or(fallback, |argb| argb.rotate_left(8))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// Where a value sits on the track, from 0 to 1.
|
|
23
|
+
fn fraction_of(props: &RNCSliderProps, value: f64) -> f32 {
|
|
24
|
+
let (min, max) = (props.minimum_value(), props.maximum_value());
|
|
25
|
+
let span = max - min;
|
|
26
|
+
let fraction = if span > 0.0 {
|
|
27
|
+
((value - min) / span).clamp(0.0, 1.0)
|
|
28
|
+
} else {
|
|
29
|
+
0.0
|
|
30
|
+
};
|
|
31
|
+
(if props.inverted() {
|
|
32
|
+
1.0 - fraction
|
|
33
|
+
} else {
|
|
34
|
+
fraction
|
|
35
|
+
}) as f32
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pub struct Slider {
|
|
39
|
+
value: Rc<Cell<f64>>,
|
|
40
|
+
track: Rc<Cell<Bounds<Pixels>>>,
|
|
41
|
+
dragging: Rc<Cell<bool>>,
|
|
42
|
+
sender: Rc<RNCSliderEventSender>,
|
|
43
|
+
focus: Option<FocusHandle>,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// The value one arrow key press moves to: one step, or a hundredth of the range without a step.
|
|
47
|
+
fn stepped(props: (f64, f64, f64), value: f64, direction: f64) -> f64 {
|
|
48
|
+
let (min, max, step) = props;
|
|
49
|
+
let max = max.max(min);
|
|
50
|
+
let increment = if step > 0.0 {
|
|
51
|
+
step
|
|
52
|
+
} else {
|
|
53
|
+
(max - min) / 100.0
|
|
54
|
+
};
|
|
55
|
+
(value + direction * increment).clamp(min, max)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
impl RNCSliderSpec for Slider {
|
|
59
|
+
fn measure(props: &RNCSliderProps, constraint: &MeasureConstraint) -> Option<MeasuredSize> {
|
|
60
|
+
let height = if props.thumb_size() > 0.0 {
|
|
61
|
+
props.thumb_size()
|
|
62
|
+
} else {
|
|
63
|
+
DEFAULT_THUMB
|
|
64
|
+
};
|
|
65
|
+
let width = if constraint.max_width.is_finite() {
|
|
66
|
+
constraint.max_width
|
|
67
|
+
} else {
|
|
68
|
+
200.0
|
|
69
|
+
};
|
|
70
|
+
Some(MeasuredSize { width, height })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fn create(props: &RNCSliderProps, cx: &mut RNCSliderContext) -> Self {
|
|
74
|
+
Self {
|
|
75
|
+
value: Rc::new(Cell::new(props.value() as f64)),
|
|
76
|
+
track: Rc::new(Cell::new(Bounds::default())),
|
|
77
|
+
dragging: Rc::new(Cell::new(false)),
|
|
78
|
+
sender: Rc::new(cx.event_sender()),
|
|
79
|
+
focus: cx.app().map(|app| app.focus_handle().tab_stop(true)),
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fn update(
|
|
84
|
+
&mut self,
|
|
85
|
+
props: &RNCSliderProps,
|
|
86
|
+
changed: RNCSliderChanged,
|
|
87
|
+
_cx: &mut RNCSliderContext,
|
|
88
|
+
) {
|
|
89
|
+
if changed.value() && !self.dragging.get() {
|
|
90
|
+
self.value.set(props.value() as f64);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
fn render(
|
|
95
|
+
&mut self,
|
|
96
|
+
props: &RNCSliderProps,
|
|
97
|
+
_window: &mut Window,
|
|
98
|
+
cx: &mut RNCSliderContext,
|
|
99
|
+
) -> AnyElement {
|
|
100
|
+
let fill = fraction_of(props, self.value.get());
|
|
101
|
+
let thumb_size = if props.thumb_size() > 0.0 {
|
|
102
|
+
props.thumb_size()
|
|
103
|
+
} else {
|
|
104
|
+
DEFAULT_THUMB
|
|
105
|
+
};
|
|
106
|
+
let minimum = rgba(color(props.minimum_track_tint_color(), MINIMUM_TRACK));
|
|
107
|
+
let maximum = rgba(color(props.maximum_track_tint_color(), MAXIMUM_TRACK));
|
|
108
|
+
let thumb = rgba(color(props.thumb_tint_color(), THUMB));
|
|
109
|
+
let disabled = props.disabled();
|
|
110
|
+
let track = self.track.clone();
|
|
111
|
+
|
|
112
|
+
let mut root = div()
|
|
113
|
+
.id("slider")
|
|
114
|
+
.relative()
|
|
115
|
+
.size_full()
|
|
116
|
+
.flex()
|
|
117
|
+
.items_center()
|
|
118
|
+
.opacity(if disabled { 0.5 } else { 1.0 })
|
|
119
|
+
.child(
|
|
120
|
+
canvas(move |bounds, _, _| track.set(bounds), |_, _, _, _| {})
|
|
121
|
+
.absolute()
|
|
122
|
+
.size_full(),
|
|
123
|
+
)
|
|
124
|
+
.child(
|
|
125
|
+
div()
|
|
126
|
+
.absolute()
|
|
127
|
+
.left_0()
|
|
128
|
+
.w(gpui::relative(fill))
|
|
129
|
+
.h(px(TRACK_HEIGHT))
|
|
130
|
+
.rounded_full()
|
|
131
|
+
.bg(minimum),
|
|
132
|
+
)
|
|
133
|
+
.child(
|
|
134
|
+
div()
|
|
135
|
+
.absolute()
|
|
136
|
+
.right_0()
|
|
137
|
+
.w(gpui::relative(1.0 - fill))
|
|
138
|
+
.h(px(TRACK_HEIGHT))
|
|
139
|
+
.rounded_full()
|
|
140
|
+
.bg(maximum),
|
|
141
|
+
)
|
|
142
|
+
.child(
|
|
143
|
+
div()
|
|
144
|
+
.absolute()
|
|
145
|
+
.top_0()
|
|
146
|
+
.bottom_0()
|
|
147
|
+
.my_auto()
|
|
148
|
+
.left(gpui::relative(fill))
|
|
149
|
+
.ml(px(-thumb_size / 2.0))
|
|
150
|
+
.size(px(thumb_size))
|
|
151
|
+
.rounded_full()
|
|
152
|
+
.bg(thumb)
|
|
153
|
+
.border_1()
|
|
154
|
+
.border_color(rgba(0x00000033)),
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
if disabled {
|
|
158
|
+
return root.into_any_element();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if self.focus.is_none() {
|
|
162
|
+
self.focus = cx.app().map(|app| app.focus_handle().tab_stop(true));
|
|
163
|
+
}
|
|
164
|
+
if let Some(focus) = &self.focus {
|
|
165
|
+
let (key_value, key_sender) = (self.value.clone(), self.sender.clone());
|
|
166
|
+
let range = (props.minimum_value(), props.maximum_value(), props.step());
|
|
167
|
+
let inverted = props.inverted();
|
|
168
|
+
root = root
|
|
169
|
+
.track_focus(focus)
|
|
170
|
+
.tab_stop(true)
|
|
171
|
+
.on_key_down(move |event, window, cx| {
|
|
172
|
+
let (min, max, _) = range;
|
|
173
|
+
let current = key_value.get();
|
|
174
|
+
let value = match event.keystroke.key.as_str() {
|
|
175
|
+
"left" | "down" => {
|
|
176
|
+
stepped(range, current, if inverted { 1.0 } else { -1.0 })
|
|
177
|
+
}
|
|
178
|
+
"right" | "up" => {
|
|
179
|
+
stepped(range, current, if inverted { -1.0 } else { 1.0 })
|
|
180
|
+
}
|
|
181
|
+
"home" => min,
|
|
182
|
+
"end" => max.max(min),
|
|
183
|
+
_ => return,
|
|
184
|
+
};
|
|
185
|
+
cx.stop_propagation();
|
|
186
|
+
if (value - current).abs() <= f64::EPSILON {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
key_value.set(value);
|
|
190
|
+
key_sender.rnc_slider_value_change(OnRNCSliderValueChange {
|
|
191
|
+
value: value as f32,
|
|
192
|
+
from_user: true,
|
|
193
|
+
});
|
|
194
|
+
key_sender.rnc_slider_sliding_complete(OnRNCSliderSlidingComplete {
|
|
195
|
+
value: value as f32,
|
|
196
|
+
from_user: true,
|
|
197
|
+
});
|
|
198
|
+
window.refresh();
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let locate = {
|
|
203
|
+
let track = self.track.clone();
|
|
204
|
+
let props = (
|
|
205
|
+
props.minimum_value(),
|
|
206
|
+
props.maximum_value(),
|
|
207
|
+
props.step(),
|
|
208
|
+
props.inverted(),
|
|
209
|
+
);
|
|
210
|
+
let props = Rc::new(props);
|
|
211
|
+
move |x: f32| {
|
|
212
|
+
let bounds = track.get();
|
|
213
|
+
let left = f32::from(bounds.origin.x);
|
|
214
|
+
let width = f32::from(bounds.size.width).max(1.0);
|
|
215
|
+
let fraction = f64::from((x - left) / width);
|
|
216
|
+
let (min, max, step, inverted) = *props;
|
|
217
|
+
let fraction = if inverted { 1.0 - fraction } else { fraction };
|
|
218
|
+
let mut value =
|
|
219
|
+
(min + fraction.clamp(0.0, 1.0) * (max - min)).clamp(min, max.max(min));
|
|
220
|
+
if step > 0.0 {
|
|
221
|
+
value = (min + ((value - min) / step).round() * step).clamp(min, max.max(min));
|
|
222
|
+
}
|
|
223
|
+
value
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
let (down_locate, down_value, down_dragging, down_sender) = (
|
|
228
|
+
locate.clone(),
|
|
229
|
+
self.value.clone(),
|
|
230
|
+
self.dragging.clone(),
|
|
231
|
+
self.sender.clone(),
|
|
232
|
+
);
|
|
233
|
+
let down_focus = self.focus.clone();
|
|
234
|
+
let (move_locate, move_value, move_dragging, move_sender) = (
|
|
235
|
+
locate.clone(),
|
|
236
|
+
self.value.clone(),
|
|
237
|
+
self.dragging.clone(),
|
|
238
|
+
self.sender.clone(),
|
|
239
|
+
);
|
|
240
|
+
let (up_value, up_dragging, up_sender) = (
|
|
241
|
+
self.value.clone(),
|
|
242
|
+
self.dragging.clone(),
|
|
243
|
+
self.sender.clone(),
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
root = root
|
|
247
|
+
.on_mouse_down(MouseButton::Left, move |event, window, cx| {
|
|
248
|
+
if let Some(focus) = &down_focus {
|
|
249
|
+
window.focus(focus, cx);
|
|
250
|
+
}
|
|
251
|
+
let value = down_locate(f32::from(event.position.x));
|
|
252
|
+
down_value.set(value);
|
|
253
|
+
down_dragging.set(true);
|
|
254
|
+
down_sender.rnc_slider_sliding_start(OnRNCSliderSlidingStart {
|
|
255
|
+
value: value as f32,
|
|
256
|
+
from_user: true,
|
|
257
|
+
});
|
|
258
|
+
down_sender.rnc_slider_value_change(OnRNCSliderValueChange {
|
|
259
|
+
value: value as f32,
|
|
260
|
+
from_user: true,
|
|
261
|
+
});
|
|
262
|
+
window.refresh();
|
|
263
|
+
})
|
|
264
|
+
.on_mouse_move(move |event, window, _| {
|
|
265
|
+
if !move_dragging.get() {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
let value = move_locate(f32::from(event.position.x));
|
|
269
|
+
if (value - move_value.get()).abs() > f64::EPSILON {
|
|
270
|
+
move_value.set(value);
|
|
271
|
+
move_sender.rnc_slider_value_change(OnRNCSliderValueChange {
|
|
272
|
+
value: value as f32,
|
|
273
|
+
from_user: true,
|
|
274
|
+
});
|
|
275
|
+
window.refresh();
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
.on_mouse_up(MouseButton::Left, move |event, window, _| {
|
|
279
|
+
if !up_dragging.get() {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
up_dragging.set(false);
|
|
283
|
+
let value = locate(f32::from(event.position.x));
|
|
284
|
+
up_value.set(value);
|
|
285
|
+
up_sender.rnc_slider_sliding_complete(OnRNCSliderSlidingComplete {
|
|
286
|
+
value: value as f32,
|
|
287
|
+
from_user: true,
|
|
288
|
+
});
|
|
289
|
+
window.refresh();
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
root.into_any_element()
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
pub fn rn_gpui_register() {
|
|
297
|
+
react_native_gpui::host_component::register_component(rnc_slider_component::<Slider>());
|
|
298
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-gpui/slider",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "5.2.0-alpha.1",
|
|
4
|
+
"description": "Adapter for @react-native-community/slider (MIT): draws the slider with the desktop renderer",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"desktop",
|
|
10
|
+
"react-native.config.js",
|
|
11
|
+
"README.md",
|
|
12
|
+
"CHANGELOG.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"codegenConfig": {
|
|
16
|
+
"name": "RNGpuiSliderSpec",
|
|
17
|
+
"type": "all",
|
|
18
|
+
"jsSrcsDir": "src"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react-native": "0.87.x",
|
|
22
|
+
"@react-native-community/slider": "5.2.x"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/streetwriters/react-native-gpui-modules.git",
|
|
27
|
+
"directory": "modules/slider"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/streetwriters/react-native-gpui-modules/tree/main/modules/slider#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/streetwriters/react-native-gpui-modules/issues"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"tag": "latest"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import { ImageSource, codegenNativeComponent } from 'react-native';
|
|
3
|
+
import type { CodegenTypes } from 'react-native';
|
|
4
|
+
|
|
5
|
+
type Event = Readonly<{
|
|
6
|
+
value: CodegenTypes.Float;
|
|
7
|
+
fromUser?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export interface NativeProps extends ViewProps {
|
|
11
|
+
accessibilityUnits?: string;
|
|
12
|
+
accessibilityIncrements?: ReadonlyArray<string>;
|
|
13
|
+
disabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
14
|
+
inverted?: CodegenTypes.WithDefault<boolean, false>;
|
|
15
|
+
vertical?: CodegenTypes.WithDefault<boolean, false>;
|
|
16
|
+
tapToSeek?: CodegenTypes.WithDefault<boolean, false>;
|
|
17
|
+
maximumTrackImage?: ImageSource;
|
|
18
|
+
maximumTrackTintColor?: ColorValue;
|
|
19
|
+
maximumValue?: CodegenTypes.WithDefault<CodegenTypes.Double, 1>;
|
|
20
|
+
minimumTrackImage?: ImageSource;
|
|
21
|
+
minimumTrackTintColor?: ColorValue;
|
|
22
|
+
minimumValue?: CodegenTypes.Double;
|
|
23
|
+
onChange?: CodegenTypes.BubblingEventHandler<Event>;
|
|
24
|
+
onRNCSliderSlidingStart?: CodegenTypes.DirectEventHandler<Event>;
|
|
25
|
+
onRNCSliderSlidingComplete?: CodegenTypes.DirectEventHandler<Event>;
|
|
26
|
+
onRNCSliderValueChange?: CodegenTypes.BubblingEventHandler<Event>;
|
|
27
|
+
step?: CodegenTypes.Double;
|
|
28
|
+
testID?: string;
|
|
29
|
+
thumbImage?: ImageSource;
|
|
30
|
+
thumbTintColor?: ColorValue;
|
|
31
|
+
thumbSize?: CodegenTypes.Float;
|
|
32
|
+
trackImage?: ImageSource;
|
|
33
|
+
value?: CodegenTypes.Float;
|
|
34
|
+
lowerLimit?: CodegenTypes.Float;
|
|
35
|
+
upperLimit?: CodegenTypes.Float;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default codegenNativeComponent<NativeProps>('RNCSlider', {
|
|
39
|
+
interfaceOnly: true,
|
|
40
|
+
}) as HostComponent<NativeProps>;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|