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: Example
:six: 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
manged 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.
You can also add your components.
Check out the working examples:
import React, { useState } from 'react';
import { Button, Modal, 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={() => setShowModal1(true)} />
<Modal visible={showModal}>
<ColorPicker value='red' onComplete={onSelectColor}>
<Preview />
<Panel1 />
<HueSlider />
<OpacitySlider />
<Swatches />
</ColorPicker>
<Button title='Ok' onPress={() => setShowModal(false)} />
</Modal>
</View>
);
}
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
width
property.type: StyleProp<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 | StyleProp<ViewStyle> | / | preview container style |
textStyle | StyleProp<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 | StyleProp<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) |
style | StyleProp<ViewStyle> | / | panel's container style |
Note some style properties will be overwritten.
<Panel2 />
Note you need to add
<BrightnessSlider />
alongside with it.
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | panel's handle (thumb) size (height*width) |
style | StyleProp<ViewStyle> | / | panel's container style |
Note some style properties will be overwritten.
<HueSlider />
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | hue slider handle (thumb) size (height*width) |
ringColor | string | #fff | the color of the ring around the slider handle |
reverse | boolean | false | reverse slider direction |
vertical | boolean | false | change slider orientation |
style | StyleProp<ViewStyle> | / | hue slider container style |
Note some style properties will be overwritten.
<SaturationSlider />
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | saturation slider handle (thumb) size (height*width) |
ringColor | string | #fff | the color of the ring around the slider handle |
reverse | boolean | false | reverse slider direction |
vertical | boolean | false | change slider orientation |
style | StyleProp<ViewStyle> | / | saturation slider container style |
Note some style properties will be overwritten.
<BrightnessSlider />
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | brightness slider handle (thumb) size (height*width) |
ringColor | string | #fff | the color of the ring around the slider handle |
reverse | boolean | false | reverse slider direction |
vertical | boolean | false | change slider orientation |
style | StyleProp<ViewStyle> | / | brightness slider container style |
Note some style properties will be overwritten.
<OpacitySlider />
Property | Type | Default | Description |
---|---|---|---|
thumbSize | number | 35 | opacity slider handle (thumb) size (height*width) |
ringColor | string | #fff | the color of the ring around the slider handle |
reverse | boolean | false | reverse slider direction |
vertical | boolean | false | change slider orientation |
style | StyleProp<ViewStyle> | / | opacity slider container style |
Note some style properties will be overwritten.
<Swatches />
Property | Type | Default | Description |
---|---|---|---|
colors | string[] | material colors | custom swatches colors |
style | StyleProp<ViewStyle> | / | swatches container style |
swatchStyle | StyleProp<ViewStyle> | / | swatch style |
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.