ColorPalette
A component for displaying a color palette
(code example)
This is a screen width component
Usageβ
<ColorPalette colors={['transparent', Colors.green30, Colors.yellow30, Colors.red30]} value={selectedColor} onValueChange={() => console.log('value changed')} />
APIβ
animatedIndexβ
Default is lastβ
The index of the item to animate at first render
number
backgroundColorβ
The ColorPalette's background color
string
colorsβ
Array of colors to render in the palette
string[]
containerStyleβ
Component's container style
ViewStyle
containerWidthβ
The container margins
number
loopβ
Whether the colors pagination scrolls in a loop
boolean
numberOfRowsβ
The number of color rows from 2 to 5
number
onValueChangeβ
Invoked once when value changes by selecting one of the swatches in the palette
(value: string, colorInfo: ColorInfo) => void
styleβ
Component's style
ViewStyle
swatchStyleβ
Style to pass all the ColorSwatches in the palette
ViewStyle
testIDβ
The test id for e2e tests
string
usePaginationβ
Whether to use pagination when number of colors exceeds the number of rows
boolean
valueβ
The value of the selected swatch
string