@fluentui-react-native/radio-group 0.22.1 → 0.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/lib/Radio/useRadio.d.ts.map +1 -1
  3. package/lib/Radio/useRadio.js +13 -11
  4. package/lib/Radio/useRadio.js.map +1 -1
  5. package/lib/Radio/useRadio.win32.d.ts.map +1 -1
  6. package/lib/Radio/useRadio.win32.js +31 -26
  7. package/lib/Radio/useRadio.win32.js.map +1 -1
  8. package/lib/legacy/RadioButton.d.ts.map +1 -1
  9. package/lib/legacy/RadioButton.js +13 -11
  10. package/lib/legacy/RadioButton.js.map +1 -1
  11. package/lib/legacy/RadioButton.macos.d.ts.map +1 -1
  12. package/lib/legacy/RadioButton.macos.js +10 -8
  13. package/lib/legacy/RadioButton.macos.js.map +1 -1
  14. package/lib/legacy/RadioButton.win32.d.ts.map +1 -1
  15. package/lib/legacy/RadioButton.win32.js +34 -30
  16. package/lib/legacy/RadioButton.win32.js.map +1 -1
  17. package/lib/legacy/RadioGroup.d.ts.map +1 -1
  18. package/lib/legacy/RadioGroup.js +4 -8
  19. package/lib/legacy/RadioGroup.js.map +1 -1
  20. package/lib-commonjs/Radio/useRadio.d.ts.map +1 -1
  21. package/lib-commonjs/Radio/useRadio.js +13 -11
  22. package/lib-commonjs/Radio/useRadio.js.map +1 -1
  23. package/lib-commonjs/Radio/useRadio.win32.d.ts.map +1 -1
  24. package/lib-commonjs/Radio/useRadio.win32.js +31 -26
  25. package/lib-commonjs/Radio/useRadio.win32.js.map +1 -1
  26. package/lib-commonjs/legacy/RadioButton.d.ts.map +1 -1
  27. package/lib-commonjs/legacy/RadioButton.js +13 -11
  28. package/lib-commonjs/legacy/RadioButton.js.map +1 -1
  29. package/lib-commonjs/legacy/RadioButton.macos.d.ts.map +1 -1
  30. package/lib-commonjs/legacy/RadioButton.macos.js +10 -8
  31. package/lib-commonjs/legacy/RadioButton.macos.js.map +1 -1
  32. package/lib-commonjs/legacy/RadioButton.win32.d.ts.map +1 -1
  33. package/lib-commonjs/legacy/RadioButton.win32.js +34 -30
  34. package/lib-commonjs/legacy/RadioButton.win32.js.map +1 -1
  35. package/lib-commonjs/legacy/RadioGroup.d.ts.map +1 -1
  36. package/lib-commonjs/legacy/RadioGroup.js +4 -8
  37. package/lib-commonjs/legacy/RadioGroup.js.map +1 -1
  38. package/package.json +24 -24
  39. package/src/Radio/useRadio.ts +13 -11
  40. package/src/Radio/useRadio.win32.ts +45 -26
  41. package/src/legacy/RadioButton.macos.tsx +10 -8
  42. package/src/legacy/RadioButton.tsx +13 -11
  43. package/src/legacy/RadioButton.win32.tsx +46 -30
  44. package/src/legacy/RadioGroup.tsx +4 -8
  45. package/eslint.config.js +0 -3
@@ -72,21 +72,17 @@ exports.RadioGroup = (0, foundation_compose_1.compose)({
72
72
  }, [setInvoked]);
73
73
  const [buttonKeys, setButtonKeys] = React.useState([]);
74
74
  const onAddRadioButtonKey = React.useCallback((buttonKey) => {
75
- buttonKeys.push(buttonKey);
76
- setButtonKeys(buttonKeys);
75
+ setButtonKeys((prevButtonKeys) => [...prevButtonKeys, buttonKey]);
77
76
  }, [setButtonKeys]);
78
77
  const onRemoveRadioButtonKey = React.useCallback((buttonKey) => {
79
- buttonKeys.filter((item) => item !== buttonKey);
80
- setButtonKeys(buttonKeys);
78
+ setButtonKeys((prevButtonKeys) => prevButtonKeys.filter((item) => item !== buttonKey));
81
79
  }, [setButtonKeys]);
82
80
  const [enabledButtonKeys, setEnabledButtonKeys] = React.useState([]);
83
81
  const onAddRadioButtonEnabledKey = React.useCallback((buttonKey) => {
84
- enabledButtonKeys.push(buttonKey);
85
- setEnabledButtonKeys(enabledButtonKeys);
82
+ setEnabledButtonKeys((prevEnabledButtonKeys) => [...prevEnabledButtonKeys, buttonKey]);
86
83
  }, [setEnabledButtonKeys]);
87
84
  const onRemoveRadioButtonEnabledKey = React.useCallback((buttonKey) => {
88
- enabledButtonKeys.filter((item) => item !== buttonKey);
89
- setEnabledButtonKeys(enabledButtonKeys);
85
+ setEnabledButtonKeys((prevEnabledButtonKeys) => prevEnabledButtonKeys.filter((item) => item !== buttonKey));
90
86
  }, [setEnabledButtonKeys]);
91
87
  const state = {
92
88
  context: {
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../src/legacy/RadioGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,MAAY,KAAK,kCAAc;AAC/B,+CAAoC;AAEpC,kEAA8D;AAC9D,gFAA0E;AAC1E,sDAAmD;AACnD,0DAAkF;AAGlF,2EAA6D;AAC7D,6EAAoE;AAEpE,+DAAiD;AASjD,yDAAoD;AAEvC,QAAA,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAqB;IACvE,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,EAAC,iBAAiB,CAAjB,iBAAiB,EAAE,EAAE,CAAC;QAC/B,OAAO;IAAA,CACR;IACD,uBAAuB,EAAE,EAAC,8BAA8B,CAA9B,8BAA8B,EAAE,EAAE,CAAC;QAC3D,OAAO;IAAA,CACR;IACD,UAAU,EAAE,EAAE;CACf,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,IAAA,4BAAO,EAAkB;IACjD,WAAW,EAAE,iCAAc;IAE3B,eAAe,EAAE,CAAC,SAA2B,EAAE,UAA+C,EAAE,EAAE,CAAC;QACjG,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC;QAErG,+HAA+H;QAC/H,MAAM,IAAI,GAAG,IAAA,kCAAc,EAAC,WAAW,IAAI,kBAAkB,IAAI,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE3F,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CA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,EACf,kBAAC,KAAK,CAAC,SAAS,cAAE,QAAQ,GAAmB;oBAClC,GACc,CAC9B,CAAC;IAAA,CACH;IAED,QAAQ,EAAR,8BAAQ;IACR,KAAK,EAAE;QACL,IAAI,EAAE,mBAAI;QACV,KAAK,EAAE,WAAI;QACX,SAAS,EAAE,sBAAS;KACrB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,CAAC,8BAAqB,EAAE,mBAAU,CAAC;QAC1C,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC;kBAEY,QAAA,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/radio-group",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "description": "A cross-platform Radio Group component using the Fluent Design System",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -27,33 +27,33 @@
27
27
  "build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
28
28
  "clean": "fluentui-scripts clean",
29
29
  "depcheck": "fluentui-scripts depcheck",
30
- "lint": "fluentui-scripts eslint",
31
- "lint-package": "fluentui-scripts lint-package",
32
30
  "format": "fluentui-scripts format",
31
+ "lint": "fluentui-scripts lint",
32
+ "lint-package": "fluentui-scripts lint-package",
33
33
  "test": "fluentui-scripts jest",
34
34
  "update-snapshots": "fluentui-scripts jest -u"
35
35
  },
36
36
  "dependencies": {
37
- "@fluentui-react-native/adapters": "0.14.1",
38
- "@fluentui-react-native/focus-zone": "0.22.1",
39
- "@fluentui-react-native/framework": "0.15.1",
40
- "@fluentui-react-native/interactive-hooks": "0.28.1",
41
- "@fluentui-react-native/pressable": "0.13.1",
42
- "@fluentui-react-native/text": "0.25.1",
43
- "@fluentui-react-native/theme-tokens": "0.28.1",
44
- "@fluentui-react-native/tokens": "0.24.1",
45
- "@fluentui-react-native/use-styling": "0.14.1",
46
- "@uifabricshared/foundation-composable": "0.14.1",
47
- "@uifabricshared/foundation-compose": "1.16.1",
48
- "@uifabricshared/foundation-settings": "0.16.1"
37
+ "@fluentui-react-native/adapters": "0.14.3",
38
+ "@fluentui-react-native/focus-zone": "0.22.3",
39
+ "@fluentui-react-native/framework": "0.15.3",
40
+ "@fluentui-react-native/interactive-hooks": "0.28.3",
41
+ "@fluentui-react-native/pressable": "0.13.3",
42
+ "@fluentui-react-native/text": "0.25.3",
43
+ "@fluentui-react-native/theme-tokens": "0.28.3",
44
+ "@fluentui-react-native/tokens": "0.24.3",
45
+ "@fluentui-react-native/use-styling": "0.14.3",
46
+ "@uifabricshared/foundation-composable": "0.14.3",
47
+ "@uifabricshared/foundation-compose": "1.16.3",
48
+ "@uifabricshared/foundation-settings": "0.16.3"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@babel/core": "^7.20.0",
52
52
  "@fluentui-react-native/babel-config": "0.1.1",
53
- "@fluentui-react-native/eslint-config-rules": "0.1.2",
54
- "@fluentui-react-native/framework-base": "0.3.1",
53
+ "@fluentui-react-native/framework-base": "0.3.3",
55
54
  "@fluentui-react-native/jest-config": "0.1.0",
56
55
  "@fluentui-react-native/kit-config": "0.1.2",
56
+ "@fluentui-react-native/lint-config-rules": "0.1.3",
57
57
  "@fluentui-react-native/scripts": "0.1.0",
58
58
  "@fluentui-react-native/test-tools": "0.1.0",
59
59
  "@office-iss/react-native-win32": "^0.74.0",
@@ -62,20 +62,20 @@
62
62
  "@react-native-community/cli-platform-ios": "^20.0.0",
63
63
  "@react-native/babel-preset": "^0.81.0",
64
64
  "@react-native/metro-config": "^0.81.0",
65
- "@types/react": "~19.1.0",
65
+ "@types/react": "~19.1.4",
66
66
  "@types/react-test-renderer": "^19.1.0",
67
- "react": "19.1.0",
68
- "react-native": "^0.81.0",
67
+ "react": "19.1.4",
68
+ "react-native": "^0.81.6",
69
69
  "react-native-macos": "^0.81.0",
70
70
  "react-native-svg": "^15.12.1",
71
71
  "react-native-windows": "^0.81.0",
72
- "react-test-renderer": "19.1.0"
72
+ "react-test-renderer": "19.1.4"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@office-iss/react-native-win32": "^0.74.0",
76
- "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
77
- "react": "18.2.0 || 19.0.0 || 19.1.0",
78
- "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
76
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
77
+ "react": "18.2.0 || 19.0.0 || 19.1.4",
78
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
79
79
  "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
80
80
  "react-native-svg": ">=15.0.0 <15.13.0 || >=15.4.0 <15.13.0 || ^15.11.2 || ^15.12.1",
81
81
  "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
@@ -14,13 +14,14 @@ export const useRadio = (props: RadioProps): RadioInfo => {
14
14
 
15
15
  // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
16
16
  const radioGroupContext = useRadioGroupContext();
17
+ const { disabled: groupDisabled, layout, onChange, updateSelectedButtonRef, value: selectedValue, values } = radioGroupContext;
17
18
 
18
19
  const {
19
20
  label,
20
21
  subtext,
21
22
  value,
22
23
  disabled,
23
- labelPosition = radioGroupContext.layout === 'horizontal-stacked' ? 'below' : 'after',
24
+ labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',
24
25
  accessibilityActions,
25
26
  accessibilityLabel,
26
27
  accessibilityHint,
@@ -32,25 +33,26 @@ export const useRadio = (props: RadioProps): RadioInfo => {
32
33
  ...rest
33
34
  } = props;
34
35
 
35
- const isDisabled = radioGroupContext.disabled || disabled;
36
+ const isDisabled = groupDisabled || disabled;
36
37
 
37
38
  const buttonRef = useViewCommandFocus(componentRef);
38
39
 
39
40
  /* We don't want to call the user's onChange multiple times on the same selection. */
40
41
  const changeSelection = React.useCallback(() => {
41
- if (value !== radioGroupContext.value) {
42
- radioGroupContext.onChange && radioGroupContext.onChange(value);
43
- radioGroupContext.updateSelectedButtonRef && componentRef && radioGroupContext.updateSelectedButtonRef(componentRef);
42
+ if (value !== selectedValue) {
43
+ onChange && onChange(value);
44
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
44
45
  }
45
- }, [radioGroupContext, value, componentRef]);
46
+ }, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
46
47
 
47
48
  /* We use the componentRef of the currently selected button to maintain the default tabbable
48
49
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
49
50
  we must update it once here. */
50
51
  React.useEffect(() => {
51
- if (value === radioGroupContext.value && !isDisabled) {
52
- radioGroupContext.updateSelectedButtonRef && componentRef && radioGroupContext.updateSelectedButtonRef(componentRef);
52
+ if (value === selectedValue && !isDisabled) {
53
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
53
54
  }
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
54
56
  }, []);
55
57
 
56
58
  // Ensure focus is placed on button after click
@@ -82,7 +84,7 @@ export const useRadio = (props: RadioProps): RadioInfo => {
82
84
 
83
85
  const state = {
84
86
  ...pressable.state,
85
- selected: radioGroupContext.value === props.value && !isDisabled,
87
+ selected: selectedValue === props.value && !isDisabled,
86
88
  disabled: isDisabled || false,
87
89
  labelPositionBelow: labelPosition === 'below',
88
90
  };
@@ -101,8 +103,8 @@ export const useRadio = (props: RadioProps): RadioInfo => {
101
103
  accessibilityHint: accessibilityHint ?? subtext,
102
104
  accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
103
105
  accessibilityActions: accessibilityActionsProp,
104
- accessibilityPosInSet: accessibilityPosInSet ?? radioGroupContext.values.findIndex((x) => x == value) + 1,
105
- accessibilitySetSize: accessibilitySetSize ?? radioGroupContext.values.length,
106
+ accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
107
+ accessibilitySetSize: accessibilitySetSize ?? values.length,
106
108
  focusable: !state.disabled,
107
109
  disabled: isDisabled,
108
110
  enableFocusRing: enableFocusRing ?? true,
@@ -23,6 +23,21 @@ export const useRadio = (props: RadioProps): RadioInfo => {
23
23
 
24
24
  // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
25
25
  const radioGroupContext = useRadioGroupContext();
26
+ const {
27
+ addRadioEnabledValue,
28
+ addRadioValue,
29
+ disabled: groupDisabled,
30
+ enabledValues,
31
+ invoked,
32
+ layout,
33
+ onChange,
34
+ removeRadioEnabledValue,
35
+ removeRadioValue,
36
+ updateInvoked,
37
+ updateSelectedButtonRef,
38
+ value: selectedValue,
39
+ values,
40
+ } = radioGroupContext;
26
41
 
27
42
  const {
28
43
  label,
@@ -39,44 +54,47 @@ export const useRadio = (props: RadioProps): RadioInfo => {
39
54
  ...rest
40
55
  } = props;
41
56
 
42
- const labelPosition = radioGroupContext.layout === 'horizontal-stacked' ? 'below' : 'after';
57
+ const labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after';
43
58
 
44
- const isDisabled = radioGroupContext.disabled || disabled;
59
+ const isDisabled = groupDisabled || disabled;
45
60
 
46
61
  const buttonRef = useViewCommandFocus(componentRef);
47
62
 
48
63
  /* We don't want to call the user's onChange multiple times on the same selection. */
49
64
  const changeSelection = React.useCallback(() => {
50
- if (value !== radioGroupContext.value) {
51
- radioGroupContext.onChange && radioGroupContext.onChange(value);
52
- radioGroupContext.updateSelectedButtonRef && componentRef && radioGroupContext.updateSelectedButtonRef(componentRef);
65
+ if (value !== selectedValue) {
66
+ onChange && onChange(value);
67
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
53
68
  }
54
- }, [radioGroupContext, value, componentRef]);
69
+ }, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
55
70
 
56
71
  /* We use the componentRef of the currently selected button to maintain the default tabbable
57
72
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
58
73
  we must update it once here. */
59
74
  React.useEffect(() => {
60
- if (value === radioGroupContext.value && !isDisabled) {
61
- radioGroupContext.updateSelectedButtonRef && componentRef && radioGroupContext.updateSelectedButtonRef(componentRef);
75
+ if (value === selectedValue && !isDisabled) {
76
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
62
77
  }
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
63
79
  }, []);
64
80
 
65
81
  // Explicitly only run on mount and unmount
66
82
  React.useEffect(() => {
67
- radioGroupContext.addRadioValue(value);
83
+ addRadioValue(value);
68
84
 
69
85
  return () => {
70
- radioGroupContext.removeRadioValue(value);
86
+ removeRadioValue(value);
71
87
  };
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
72
89
  }, []);
73
90
 
74
91
  React.useEffect(() => {
75
92
  if (isDisabled) {
76
- radioGroupContext.removeRadioEnabledValue(value);
93
+ removeRadioEnabledValue(value);
77
94
  } else {
78
- radioGroupContext.addRadioEnabledValue(value);
95
+ addRadioEnabledValue(value);
79
96
  }
97
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when isDisabled changes
80
98
  }, [isDisabled]);
81
99
 
82
100
  const isRTL = I18nManager.isRTL;
@@ -84,37 +102,38 @@ export const useRadio = (props: RadioProps): RadioInfo => {
84
102
  const onInvoke = React.useCallback(
85
103
  (e: KeyPressEvent) => {
86
104
  if (e.nativeEvent.key in DirectionalArrowKeys) {
87
- const length = radioGroupContext.enabledValues.length;
105
+ const length = enabledValues.length;
88
106
  const previous =
89
107
  e.nativeEvent.key === DirectionalArrowKeys.ArrowUp ||
90
108
  (isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowRight : e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft);
91
109
  const next =
92
110
  e.nativeEvent.key === DirectionalArrowKeys.ArrowDown ||
93
111
  (isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft : e.nativeEvent.key === DirectionalArrowKeys.ArrowRight);
94
- const currRadioIndex = radioGroupContext.enabledValues.indexOf(radioGroupContext.value);
112
+ const currRadioIndex = enabledValues.indexOf(selectedValue);
95
113
  let newCurrRadioIndex;
96
114
  if (next) {
97
115
  newCurrRadioIndex = (currRadioIndex + 1) % length;
98
- radioGroupContext.onChange && radioGroupContext.onChange(radioGroupContext.enabledValues[newCurrRadioIndex]);
99
- radioGroupContext.updateInvoked && radioGroupContext.updateInvoked(true);
116
+ onChange && onChange(enabledValues[newCurrRadioIndex]);
117
+ updateInvoked && updateInvoked(true);
100
118
  } else if (previous) {
101
119
  newCurrRadioIndex = (currRadioIndex - 1 + length) % length;
102
- radioGroupContext.onChange && radioGroupContext.onChange(radioGroupContext.enabledValues[newCurrRadioIndex]);
103
- radioGroupContext.updateInvoked && radioGroupContext.updateInvoked(true);
120
+ onChange && onChange(enabledValues[newCurrRadioIndex]);
121
+ updateInvoked && updateInvoked(true);
104
122
  }
105
123
  }
106
124
  },
107
- [radioGroupContext],
125
+ [enabledValues, isRTL, onChange, selectedValue, updateInvoked],
108
126
  );
109
127
 
110
128
  // Sets the updated selected button ref and focus if this Radio is selected via arrow key.
111
129
  React.useEffect(() => {
112
- if (radioGroupContext.invoked && value === radioGroupContext.value && !isDisabled) {
113
- radioGroupContext.updateSelectedButtonRef && componentRef && radioGroupContext.updateSelectedButtonRef(componentRef);
130
+ if (invoked && value === selectedValue && !isDisabled) {
131
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
114
132
  componentRef?.current?.focus();
115
- radioGroupContext.updateInvoked && radioGroupContext.updateInvoked(false);
133
+ updateInvoked && updateInvoked(false);
116
134
  }
117
- }, [radioGroupContext.invoked]);
135
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when invoked changes
136
+ }, [invoked]);
118
137
 
119
138
  const keys = ['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'];
120
139
 
@@ -150,7 +169,7 @@ export const useRadio = (props: RadioProps): RadioInfo => {
150
169
 
151
170
  const state = {
152
171
  ...pressable.state,
153
- selected: radioGroupContext.value === props.value && !isDisabled,
172
+ selected: selectedValue === props.value && !isDisabled,
154
173
  disabled: isDisabled || false,
155
174
  };
156
175
 
@@ -168,8 +187,8 @@ export const useRadio = (props: RadioProps): RadioInfo => {
168
187
  accessibilityHint: accessibilityHint ?? subtext,
169
188
  accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
170
189
  accessibilityActions: accessibilityActionsProp,
171
- accessibilityPosInSet: accessibilityPosInSet ?? radioGroupContext.values.findIndex((x) => x == value) + 1,
172
- accessibilitySetSize: accessibilitySetSize ?? radioGroupContext.values.length,
190
+ accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
191
+ accessibilitySetSize: accessibilitySetSize ?? values.length,
173
192
  focusable: !state.disabled,
174
193
  disabled: isDisabled,
175
194
  onAccessibilityAction: onAccessibilityAction,
@@ -22,27 +22,29 @@ export const RadioButton = compose<IRadioButtonType>({
22
22
  const defaultComponentRef = React.useRef(null);
23
23
  const { content, buttonKey, disabled, componentRef = defaultComponentRef } = userProps;
24
24
  const info = React.useContext(RadioGroupContext);
25
+ const { onChange, selectedKey, updateSelectedButtonRef } = info;
25
26
 
26
27
  // Reroute the native component's onPress event to RadioGroup's onChange
27
- const onPressRerouted = () => {
28
+ const onPressRerouted = React.useCallback(() => {
28
29
  // Prevent calls to RadioGroup's onChange on the currently selected button
29
- if (buttonKey != info.selectedKey) {
30
- info.onChange && info.onChange(buttonKey);
31
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
30
+ if (buttonKey != selectedKey) {
31
+ onChange && onChange(buttonKey);
32
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
32
33
  }
33
- };
34
+ }, [buttonKey, componentRef, onChange, selectedKey, updateSelectedButtonRef]);
34
35
 
35
36
  /* We use the componentRef of the currently selected button to maintain the default tabbable
36
37
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
37
38
  we must update it once here. */
38
39
  React.useEffect(() => {
39
- if (buttonKey === info.selectedKey) {
40
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
40
+ if (buttonKey === selectedKey) {
41
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
41
42
  }
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
42
44
  }, []);
43
45
 
44
46
  const styleProps = useStyling(userProps);
45
- const isSelected = info.selectedKey === buttonKey;
47
+ const isSelected = selectedKey === buttonKey;
46
48
  const slotProps = mergeSettings<IRadioButtonSlotProps>(styleProps, {
47
49
  root: {
48
50
  ref: componentRef,
@@ -38,24 +38,26 @@ export const RadioButton = compose<IRadioButtonType>({
38
38
 
39
39
  // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
40
40
  const info = React.useContext(RadioGroupContext);
41
+ const { selectedKey, onChange, updateSelectedButtonRef, buttonKeys } = info;
41
42
 
42
43
  const buttonRef = useViewCommandFocus(componentRef);
43
44
 
44
45
  /* We don't want to call the user's onChange multiple times on the same selection. */
45
- const changeSelection = () => {
46
- if (buttonKey != info.selectedKey) {
47
- info.onChange && info.onChange(buttonKey);
48
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
46
+ const changeSelection = React.useCallback(() => {
47
+ if (buttonKey != selectedKey) {
48
+ onChange && onChange(buttonKey);
49
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
49
50
  }
50
- };
51
+ }, [buttonKey, componentRef, onChange, selectedKey, updateSelectedButtonRef]);
51
52
 
52
53
  /* We use the componentRef of the currently selected button to maintain the default tabbable
53
54
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
54
55
  we must update it once here. */
55
56
  React.useEffect(() => {
56
- if (buttonKey == info.selectedKey) {
57
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
57
+ if (buttonKey == selectedKey) {
58
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
58
59
  }
60
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
59
61
  }, []);
60
62
 
61
63
  // Ensure focus is placed on button after click
@@ -77,12 +79,12 @@ export const RadioButton = compose<IRadioButtonType>({
77
79
  break;
78
80
  }
79
81
  },
80
- [info, buttonKey],
82
+ [changeSelection],
81
83
  );
82
84
 
83
85
  const state = {
84
86
  ...pressable.state,
85
- selected: info.selectedKey === userProps.buttonKey,
87
+ selected: selectedKey === userProps.buttonKey,
86
88
  disabled: disabled || false,
87
89
  };
88
90
 
@@ -98,8 +100,8 @@ export const RadioButton = compose<IRadioButtonType>({
98
100
  accessibilityLabel: accessibilityLabel ?? ariaLabel ?? content,
99
101
  accessibilityState: { disabled: state.disabled, selected: state.selected },
100
102
  accessibilityActions: [{ name: 'Select', label: radioButtonSelectActionLabel }],
101
- accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? info.buttonKeys.findIndex((x) => x == buttonKey) + 1,
102
- accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? info.buttonKeys.length,
103
+ accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? buttonKeys.findIndex((x) => x == buttonKey) + 1,
104
+ accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? buttonKeys.length,
103
105
  focusable: !state.disabled,
104
106
  onAccessibilityAction: onAccessibilityAction,
105
107
  },
@@ -46,38 +46,53 @@ export const RadioButton = compose<IRadioButtonType>({
46
46
 
47
47
  // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
48
48
  const info = React.useContext(RadioGroupContext);
49
+ const {
50
+ addRadioButtonEnabledKey,
51
+ addRadioButtonKey,
52
+ buttonKeys,
53
+ enabledButtonKeys,
54
+ invoked,
55
+ onChange,
56
+ removeRadioButtonEnabledKey,
57
+ removeRadioButtonKey,
58
+ selectedKey,
59
+ updateInvoked,
60
+ updateSelectedButtonRef,
61
+ } = info;
49
62
 
50
63
  const buttonRef = useViewCommandFocus(componentRef);
51
64
 
52
65
  /* We don't want to call the user's onChange multiple times on the same selection. */
53
- const changeSelection = () => {
54
- if (buttonKey != info.selectedKey) {
55
- info.onChange && info.onChange(buttonKey);
56
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
66
+ const changeSelection = React.useCallback(() => {
67
+ if (buttonKey != selectedKey) {
68
+ onChange && onChange(buttonKey);
69
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
57
70
  }
58
- };
71
+ }, [buttonKey, componentRef, onChange, selectedKey, updateSelectedButtonRef]);
59
72
 
60
73
  /* We use the componentRef of the currently selected button to maintain the default tabbable
61
74
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
62
75
  we must update it once here. */
63
76
  React.useEffect(() => {
64
- if (buttonKey == info.selectedKey) {
65
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
77
+ if (buttonKey == selectedKey) {
78
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
66
79
  }
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
67
81
  }, []);
68
82
 
69
83
  // Explicitly only run on mount and unmount
70
84
  React.useEffect(() => {
71
- info.addRadioButtonKey(buttonKey);
85
+ addRadioButtonKey(buttonKey);
72
86
 
73
87
  if (!disabled) {
74
- info.addRadioButtonEnabledKey(buttonKey);
88
+ addRadioButtonEnabledKey(buttonKey);
75
89
  }
76
90
 
77
91
  return () => {
78
- info.removeRadioButtonKey(buttonKey);
79
- info.removeRadioButtonEnabledKey(buttonKey);
92
+ removeRadioButtonKey(buttonKey);
93
+ removeRadioButtonEnabledKey(buttonKey);
80
94
  };
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
81
96
  }, []);
82
97
 
83
98
  const isRTL = I18nManager.isRTL;
@@ -85,11 +100,11 @@ export const RadioButton = compose<IRadioButtonType>({
85
100
  const onInvoke = React.useCallback(
86
101
  (e: KeyPressEvent) => {
87
102
  if (e.nativeEvent.key in DirectionalArrowKeys) {
88
- const length = info.enabledButtonKeys.length;
103
+ const length = enabledButtonKeys.length;
89
104
  const next =
90
105
  e.nativeEvent.key === DirectionalArrowKeys.ArrowDown ||
91
106
  (isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft : e.nativeEvent.key === DirectionalArrowKeys.ArrowRight);
92
- const currRadioButtonIndex = info.enabledButtonKeys.indexOf(info.selectedKey);
107
+ const currRadioButtonIndex = enabledButtonKeys.indexOf(selectedKey);
93
108
  let newCurrRadioButtonIndex;
94
109
  if (next) {
95
110
  newCurrRadioButtonIndex = (currRadioButtonIndex + 1) % length;
@@ -97,21 +112,22 @@ export const RadioButton = compose<IRadioButtonType>({
97
112
  // previous
98
113
  newCurrRadioButtonIndex = (currRadioButtonIndex - 1 + length) % length;
99
114
  }
100
- info.onChange && info.onChange(info.enabledButtonKeys[newCurrRadioButtonIndex]);
101
- info.updateInvoked && info.updateInvoked(true);
115
+ onChange && onChange(enabledButtonKeys[newCurrRadioButtonIndex]);
116
+ updateInvoked && updateInvoked(true);
102
117
  }
103
118
  },
104
- [info],
119
+ [enabledButtonKeys, isRTL, onChange, selectedKey, updateInvoked],
105
120
  );
106
121
 
107
122
  // Sets the updated selected button ref and focus if this Radio is selected via arrow key.
108
123
  React.useEffect(() => {
109
- if (info.invoked && buttonKey === info.selectedKey && !disabled) {
110
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
124
+ if (invoked && buttonKey === selectedKey && !disabled) {
125
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
111
126
  componentRef?.current?.focus();
112
- info.updateInvoked && info.updateInvoked(false);
127
+ updateInvoked && updateInvoked(false);
113
128
  }
114
- }, [info.invoked]);
129
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when invoked changes
130
+ }, [invoked]);
115
131
 
116
132
  const keys = ['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'];
117
133
 
@@ -119,13 +135,13 @@ export const RadioButton = compose<IRadioButtonType>({
119
135
  const onKeyDownProps = useKeyDownProps(onInvoke, ...keys);
120
136
 
121
137
  // Ensure focus is placed on button after click
122
- const changeSelectionWithFocus = () => {
123
- if (buttonKey != info.selectedKey) {
124
- info.onChange && info.onChange(buttonKey);
125
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
126
- info.updateInvoked && info.updateInvoked(true);
138
+ const changeSelectionWithFocus = React.useCallback(() => {
139
+ if (buttonKey != selectedKey) {
140
+ onChange && onChange(buttonKey);
141
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
142
+ updateInvoked && updateInvoked(true);
127
143
  }
128
- };
144
+ }, [buttonKey, componentRef, onChange, selectedKey, updateInvoked, updateSelectedButtonRef]);
129
145
 
130
146
  /* RadioButton changes selection when focus is moved between each RadioButton and on a click */
131
147
  const pressable = useAsPressable({
@@ -143,12 +159,12 @@ export const RadioButton = compose<IRadioButtonType>({
143
159
  break;
144
160
  }
145
161
  },
146
- [info, buttonKey],
162
+ [changeSelection],
147
163
  );
148
164
 
149
165
  const state = {
150
166
  ...pressable.state,
151
- selected: info.selectedKey === userProps.buttonKey && !disabled,
167
+ selected: selectedKey === userProps.buttonKey && !disabled,
152
168
  disabled: disabled || false,
153
169
  };
154
170
 
@@ -164,8 +180,8 @@ export const RadioButton = compose<IRadioButtonType>({
164
180
  accessibilityLabel: accessibilityLabel ?? ariaLabel ?? content,
165
181
  accessibilityState: { disabled: state.disabled, selected: state.selected },
166
182
  accessibilityActions: [{ name: 'Select', label: radioButtonSelectActionLabel }],
167
- accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? info.buttonKeys.findIndex((x) => x == buttonKey) + 1,
168
- accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? info.buttonKeys.length,
183
+ accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? buttonKeys.findIndex((x) => x == buttonKey) + 1,
184
+ accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? buttonKeys.length,
169
185
  focusable: !state.disabled,
170
186
  onAccessibilityAction: onAccessibilityAction,
171
187
  ...onKeyDownProps,
@@ -64,16 +64,14 @@ export const RadioGroup = compose<IRadioGroupType>({
64
64
 
65
65
  const onAddRadioButtonKey = React.useCallback(
66
66
  (buttonKey: string) => {
67
- buttonKeys.push(buttonKey);
68
- setButtonKeys(buttonKeys);
67
+ setButtonKeys((prevButtonKeys) => [...prevButtonKeys, buttonKey]);
69
68
  },
70
69
  [setButtonKeys],
71
70
  );
72
71
 
73
72
  const onRemoveRadioButtonKey = React.useCallback(
74
73
  (buttonKey: string) => {
75
- buttonKeys.filter((item) => item !== buttonKey);
76
- setButtonKeys(buttonKeys);
74
+ setButtonKeys((prevButtonKeys) => prevButtonKeys.filter((item) => item !== buttonKey));
77
75
  },
78
76
  [setButtonKeys],
79
77
  );
@@ -82,16 +80,14 @@ export const RadioGroup = compose<IRadioGroupType>({
82
80
 
83
81
  const onAddRadioButtonEnabledKey = React.useCallback(
84
82
  (buttonKey: string) => {
85
- enabledButtonKeys.push(buttonKey);
86
- setEnabledButtonKeys(enabledButtonKeys);
83
+ setEnabledButtonKeys((prevEnabledButtonKeys) => [...prevEnabledButtonKeys, buttonKey]);
87
84
  },
88
85
  [setEnabledButtonKeys],
89
86
  );
90
87
 
91
88
  const onRemoveRadioButtonEnabledKey = React.useCallback(
92
89
  (buttonKey: string) => {
93
- enabledButtonKeys.filter((item) => item !== buttonKey);
94
- setEnabledButtonKeys(enabledButtonKeys);
90
+ setEnabledButtonKeys((prevEnabledButtonKeys) => prevEnabledButtonKeys.filter((item) => item !== buttonKey));
95
91
  },
96
92
  [setEnabledButtonKeys],
97
93
  );