Skip to content

Pass on slider props in GradientSlider #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions generatedTypes/src/components/slider/GradientSlider.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import tinycolor from 'tinycolor2';
import { SliderProps } from './index';
import { SliderContextProps } from './context/SliderContext';
declare type SliderOnValueChange = (value: string, alfa: number) => void;
export declare enum GradientSliderTypes {
Expand All @@ -9,7 +10,7 @@ export declare enum GradientSliderTypes {
LIGHTNESS = "lightness",
SATURATION = "saturation"
}
export declare type GradientSliderProps = {
export declare type GradientSliderProps = SliderProps & {
/**
* The gradient color
*/
Expand Down Expand Up @@ -92,7 +93,61 @@ declare const _default: React.ComponentClass<{
* Context of the slider group
*/
sliderContext: SliderContextProps;
} & GradientSliderProps & {
} & {
value?: number | undefined;
minimumValue?: number | undefined;
maximumValue?: number | undefined;
step?: number | undefined;
minimumTrackTintColor?: string | undefined;
maximumTrackTintColor?: string | undefined;
renderTrack?: (() => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[]) | undefined;
thumbTintColor?: string | undefined;
onValueChange?: import("./index").SliderOnValueChange | undefined;
onSeekStart?: (() => void) | undefined;
onSeekEnd?: (() => void) | undefined;
containerStyle?: StyleProp<ViewStyle>;
trackStyle?: StyleProp<ViewStyle>;
thumbStyle?: ViewStyle | undefined;
activeThumbStyle?: ViewStyle | undefined;
disableActiveStyling?: boolean | undefined;
disabled?: boolean | undefined;
accessible?: boolean | undefined;
testID?: string | undefined;
} & {
value: number;
minimumValue: number;
maximumValue: number;
step: number;
} & {
/**
* The gradient color
*/
color?: string | undefined;
/**
* The gradient type (default, hue, lightness, saturation)
*/
type?: GradientSliderTypes | undefined;
/**
* The gradient steps
*/
gradientSteps?: number | undefined;
/**
* Callback for onValueChange, returns the updated color
*/
onValueChange?: SliderOnValueChange | undefined;
/**
* If true the component will have accessibility features enabled
*/
accessible?: boolean | undefined;
/**
* The container style
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* If true the Slider will be disabled and will appear in disabled color
*/
disabled?: boolean | undefined;
} & {
type: GradientSliderTypes;
gradientSteps: number;
color: string;
Expand Down
7 changes: 4 additions & 3 deletions src/components/slider/GradientSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import tinycolor from 'tinycolor2';
import {HueGradient, LightnessGradient, SaturationGradient, Gradient} from 'react-native-color';
import {Colors} from '../../style';
import {asBaseComponent} from '../../commons/new';
import Slider from './index';
import Slider, {SliderProps} from './index';
import {SliderContextProps} from './context/SliderContext';
import asSliderGroupChild from './context/asSliderGroupChild';

Expand All @@ -18,7 +18,7 @@ export enum GradientSliderTypes {
SATURATION = 'saturation'
}

export type GradientSliderProps = {
export type GradientSliderProps = SliderProps & {
/**
* The gradient color
*/
Expand Down Expand Up @@ -187,7 +187,7 @@ class GradientSlider extends Component<GradientSliderComponentProps, GradientSli
};

render() {
const {type, containerStyle, disabled, accessible} = this.props;
const {type, containerStyle, disabled, accessible, ...others} = this.props;
const initialColor = this.state.initialColor;
const color = this.getColor();
const thumbTintColor = Colors.getHexString(color);
Expand Down Expand Up @@ -221,6 +221,7 @@ class GradientSlider extends Component<GradientSliderComponentProps, GradientSli

return (
<Slider
{...others}
renderTrack={renderTrack}
step={step}
maximumValue={maximumValue}
Expand Down