From 1df2961ea6322ca025a490c935bbb40851ddec53 Mon Sep 17 00:00:00 2001 From: Chris Nekich Date: Sun, 3 Mar 2024 10:37:05 +1100 Subject: [PATCH 1/3] ['Swatches'] add accessibility values to swatches --- src/components/Swatches.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Swatches.tsx b/src/components/Swatches.tsx index 5bf462f1..3e79ad81 100644 --- a/src/components/Swatches.tsx +++ b/src/components/Swatches.tsx @@ -44,6 +44,8 @@ export function Swatches({ colors = SWATCHES_COLORS, style = {}, swatchStyle = { key={swatch + i} onPress={() => onPress(swatch)} style={[styles.swatch, swatchStyle, { backgroundColor: swatch }]} + accessibilityLabel={`Select color: ${swatch}`} + accessibilityRole='button' /> ))} From 1f4d2599b169642c95ef4cf6b271c0527e70857c Mon Sep 17 00:00:00 2001 From: alabsi91 Date: Tue, 28 May 2024 23:45:01 +0300 Subject: [PATCH 2/3] Fix worklets for commonjs --- src/colorKit/index.ts | 4 ++-- src/utils.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/colorKit/index.ts b/src/colorKit/index.ts index 93983a26..75acc4ab 100644 --- a/src/colorKit/index.ts +++ b/src/colorKit/index.ts @@ -21,7 +21,7 @@ import type { // this transformation can lead to a slow initial execution. // To address this issue, I consolidated them into a single worklet function. -export function colorKitUI() { +export const colorKitUI = () => { 'worklet'; const NAMED_COLORS = { @@ -2066,7 +2066,7 @@ export function colorKitUI() { randomHwbColor, adjustContrast, }; -} +}; type ColorKit = ReturnType & { /** - Initiates the asynchronous execution of a workletized colorKit function on the UI thread. */ diff --git a/src/utils.tsx b/src/utils.tsx index 32acf6d9..57bfdae8 100644 --- a/src/utils.tsx +++ b/src/utils.tsx @@ -13,13 +13,13 @@ export function getStyle(style: StyleProp, } /** - Clamp a number value between `0` and a max value */ -export function clamp(v: number, max: number) { +export const clamp = (v: number, max: number) => { 'worklet'; return Math.min(Math.max(v, 0), max); -} +}; /** - Convert `HSV` color to an `HSLA` string representation */ -export function HSVA2HSLA_string(h: number, s: number, v: number, a = 1) { +export const HSVA2HSLA_string = (h: number, s: number, v: number, a = 1) => { 'worklet'; s = s / 100; @@ -30,7 +30,7 @@ export function HSVA2HSLA_string(h: number, s: number, v: number, a = 1) { sln = l !== 0 && l !== 1 ? sl / (l < 0.5 ? l * 2 : 2 - l * 2) : sl; return `hsla(${h}, ${sln * 100}%, ${l * 100}%, ${a})`; -} +}; /** - Render children only if the `render` property is `true` */ export function ConditionalRendering(props: { children: React.ReactNode; if: boolean }) { From f92d1beeb693c019738f8504bbbad3da85337f83 Mon Sep 17 00:00:00 2001 From: alabsi91 Date: Tue, 28 May 2024 23:56:52 +0300 Subject: [PATCH 3/3] Publish version "3.0.4" to NPM --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f148688c..7a385475 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reanimated-color-picker", - "version": "3.0.3", + "version": "3.0.4", "description": "A Pure JavaScript Color Picker for React Native", "main": "lib/commonjs/index", "module": "lib/module/index",