ThakurBallary / react-native-radio-buttons-group

Simple, best and easy to use radio buttons for react native apps.
MIT License
263 stars 71 forks source link

No support for testID on button #57

Closed buuhvprojects closed 1 year ago

buuhvprojects commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-radio-buttons-group@2.3.2 for the project I'm working on.

Here is the diff that solved my problem:

I added button support because I am applying e2e Test with BDD and I saw that the component was not supported.

diff --git a/node_modules/react-native-radio-buttons-group/lib/RadioButton.tsx b/node_modules/react-native-radio-buttons-group/lib/RadioButton.tsx
index db1dcac..ee598ad 100644
--- a/node_modules/react-native-radio-buttons-group/lib/RadioButton.tsx
+++ b/node_modules/react-native-radio-buttons-group/lib/RadioButton.tsx
@@ -18,6 +18,7 @@ export default function RadioButton({
   selected = false,
   size = 24,
   borderSize = 2,
+  testID,
 }: RadioButtonProps) {

   const borderWidth = PixelRatio.roundToNearestPixel(borderSize);
@@ -45,6 +46,8 @@ export default function RadioButton({
     <>
       <Pressable
         onPress={handlePress}
+        testID={testID}
+        accessibilityLabel={testID}
         style={[
           styles.container,
           orientation,
diff --git a/node_modules/react-native-radio-buttons-group/lib/types.ts b/node_modules/react-native-radio-buttons-group/lib/types.ts
index 511f431..9d1e46d 100644
--- a/node_modules/react-native-radio-buttons-group/lib/types.ts
+++ b/node_modules/react-native-radio-buttons-group/lib/types.ts
@@ -14,6 +14,7 @@ export type RadioButtonProps = {
   size?: number;
   value?: string;
   borderSize?: number;
+  testID?: string;
 };

 export type RadioGroupProps = {

This issue body was partially generated by patch-package.

ThakurBallary commented 1 year ago

Thank you! Added accessibilityLabel prop to radio button in v3.0.3 Accessibility