Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
reanimated-color-picker
Advanced tools
:red_circle: :green_circle: :large_blue_circle:
:one: Prerequisites
:two: Installation
:three: Usage
:four: API
:five: Slider Props
:six: Examples
:seven: License
Use the links below to follow the installation instructions.
react-native-gesture-handler version 2.0.0
or higher.
react-native-reanimated version 2.0.0
or higher.
For Expo
managed workflow version 44
or higher is required.
Note First we need to install react-native-gesture-handler(>=2.0.0) and react-native-reanimated(>=2.0.0),
npm i reanimated-color-picker
You can add, remove, rearrange or style the color picker's built-in components.
Check out the working examples:
import React, { useState } from 'react';
import { Button, Modal, StyleSheet, View } from 'react-native';
import ColorPicker, { Panel1, Swatches, Preview, OpacitySlider, HueSlider } from 'reanimated-color-picker';
export default function App() {
const [showModal, setShowModal] = useState(false);
const onSelectColor = ({ hex }) => {
// do something with the selected color.
console.log(hex);
};
return (
<View style={styles.container}>
<Button title='Color Picker' onPress={() => setShowModal(true)} />
<Modal visible={showModal} animationType='slide'>
<ColorPicker style={{ width: '70%' }} value='red' onComplete={onSelectColor}>
<Preview />
<Panel1 />
<HueSlider />
<OpacitySlider />
<Swatches />
</ColorPicker>
<Button title='Ok' onPress={() => setShowModal(false)} />
</Modal>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
});
The ColorPicker
Wrapper is responsible for managing the built-in components.
It has the following props:
'hex'
, 'rgb'
, 'rgba'
, 'hsl'
, 'hsla'
and named color
formats.type: string
default: '#418181'
vertical
orientation and height in case of horizontal
orientation.type: number
default: 25
type: number
default: 35
type: string
default: 'ring'
values: 'ring' | 'solid' | 'hollow' | 'line' | 'plus' | 'pill' | 'triangleUp' | 'triangleDown' | 'doubleTriangle' | 'rect' | 'circle'
width
property.type: ViewStyle
Note some style properties will be overwritten.
hex
, rgb
, rgba
, hsl
, and hsla
type: (color: object) => void
default: null
hex
, rgb
, rgba
, hsl
, and hsla
type: (color: object) => void
default: null
<Preview />
Property | Type | Default | Description |
---|---|---|---|
colorFormat | string | 'hex' | preview color text format: 'hex' , 'rgb' , 'rgba' , 'hsl' , 'hsla' , 'hsv' or 'hsva' |
hideInitialColor | boolean | false | hide the initial color preview part |
hideText | boolean | false | hide preview color texts |
style | ViewStyle | / | preview container style |
textStyle | TextStyle | / | preview text style |
Note some style properties will be overwritten.
<PreviewText />
<Text>
component that displays the preview color text.Property | Type | Default | Description |
---|---|---|---|
colorFormat | string | 'hex' | preview color text format: 'hex' , 'rgb' , 'rgba' , 'hsl' , 'hsla' , 'hsv' or 'hsva' |
style | TextStyle | / | preview text style |
<Panel1 />
Note you need to add
<HueSlider />
alongside with it.
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | panel's handle (thumb) size (height*width) |
thumbColor | string | interactive* | change thumb's color |
thumbShape | string | 'ring' | change thumb's shape: 'ring' , 'solid' , 'hollow' , 'line' , 'plus' , 'pill' , 'triangleUp' , 'triangleDown' , 'doubleTriangle' , 'rect' , 'circle' |
style | ViewStyle | / | panel's container style |
Note some style properties will be overwritten.
:asterisk: interactive: the thumb color will be changed depending on the contrast ratio if no color value is passed.
<Panel2 />
Note you need to add
<BrightnessSlider />
alongside with it.
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | panel's handle (thumb) size (height*width) |
thumbColor | string | interactive* | change thumb's color |
thumbShape | string | 'ring' | change thumb's shape: 'ring' , 'solid' , 'hollow' , 'line' , 'plus' , 'pill' , 'triangleUp' , 'triangleDown' , 'doubleTriangle' , 'rect' , 'circle' |
reverse | boolean | false | reverse (flip) hue direction |
style | ViewStyle | / | panel's container style |
Note some style properties will be overwritten.
:asterisk: interactive: the thumb color will be changed depending on the contrast ratio if no color value is passed.
<Panel3 />
Note you need to add
<BrightnessSlider />
alongside with it.
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | panel's handle (thumb) size (height*width) |
thumbColor | string | interactive* | change thumb's color |
thumbShape | string | 'ring' | change thumb's shape: 'ring' , 'solid' , 'hollow' , 'line' , 'plus' , 'pill' , 'triangleUp' , 'triangleDown' , 'doubleTriangle' , 'rect' , 'circle' |
style | ViewStyle | / | panel's container style |
Note some style properties will be overwritten.
:asterisk: interactive: the thumb color will be changed depending on the contrast ratio if no color value is passed.
<HueSlider />
A slider to change the color's hue.
Check out the Slider Props for more info.
<SaturationSlider />
A slider to change the color's saturation.
Check out the Slider Props for more info.
<BrightnessSlider />
A slider to change the color brightness.
Check out the Slider Props for more info.
<OpacitySlider />
A slider to change the color's opacity.
Check out the Slider Props for more info.
<Swatches />
Property | Type | Default | Description |
---|---|---|---|
colors | string[] | material colors | custom swatches colors |
style | ViewStyle | / | swatches container style |
swatchStyle | ViewStyle | / | swatch style |
Note some style properties will be overwritten.
HueSlider
, SaturationSlider
, BrightnessSlider
and OpacitySlider
sliders accept the following props:type: number
default: 35
type: string
default: interactive*
:asterisk: interactive: the thumb color will be changed depending on the contrast ratio if no color value is passed.
type: string
default: 'ring'
values: 'ring' | 'solid' | 'hollow' | 'line' | 'plus' | 'pill' | 'triangleUp' | 'triangleDown' | 'doubleTriangle' | 'rect' | 'circle'
type: boolean
default: false
type: boolean
default: false
type: ViewStyle
Note some style properties will be overwritten.
FAQs
A Pure JavaScript Color Picker for React Native
The npm package reanimated-color-picker receives a total of 17,101 weekly downloads. As such, reanimated-color-picker popularity was classified as popular.
We found that reanimated-color-picker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.