1
1
import type { ReactNode } from 'react' ;
2
- import React , { useEffect , useMemo } from 'react' ;
2
+ import React , { useMemo } from 'react' ;
3
3
import { View } from 'react-native' ;
4
4
import type { StyleProp , TextStyle , ViewStyle } from 'react-native' ;
5
- import { useSharedValue } from 'react-native-reanimated' ;
6
- import Accordion from '@components/Accordion' ;
7
5
import Icon from '@components/Icon' ;
8
6
import OfflineWithFeedback from '@components/OfflineWithFeedback' ;
9
7
import RenderHTML from '@components/RenderHTML' ;
@@ -48,9 +46,6 @@ type ToggleSettingOptionRowProps = {
48
46
/** Used to apply styles to the Subtitle */
49
47
subtitleStyle ?: StyleProp < TextStyle > ;
50
48
51
- /** Used to apply styles to the Accordion */
52
- accordionStyle ?: StyleProp < ViewStyle > ;
53
-
54
49
/** Whether the option is enabled or not */
55
50
isActive : boolean ;
56
51
@@ -86,7 +81,6 @@ function ToggleSettingOptionRow({
86
81
customTitle,
87
82
subtitle,
88
83
subtitleStyle,
89
- accordionStyle,
90
84
switchAccessibilityLabel,
91
85
shouldPlaceSubtitleBelowSwitch,
92
86
shouldEscapeText = undefined ,
@@ -104,12 +98,6 @@ function ToggleSettingOptionRow({
104
98
showLockIcon = false ,
105
99
} : ToggleSettingOptionRowProps ) {
106
100
const styles = useThemeStyles ( ) ;
107
- const isExpanded = useSharedValue ( isActive ) ;
108
- const isToggleTriggered = useSharedValue ( false ) ;
109
-
110
- useEffect ( ( ) => {
111
- isExpanded . set ( isActive ) ;
112
- } , [ isExpanded , isActive ] ) ;
113
101
114
102
const subtitleHtml = useMemo ( ( ) => {
115
103
if ( ! subtitle || ! shouldParseSubtitle || typeof subtitle !== 'string' ) {
@@ -183,23 +171,14 @@ function ToggleSettingOptionRow({
183
171
< Switch
184
172
disabledAction = { disabledAction }
185
173
accessibilityLabel = { switchAccessibilityLabel }
186
- onToggle = { ( isOn ) => {
187
- isToggleTriggered . set ( true ) ;
188
- onToggle ( isOn ) ;
189
- } }
174
+ onToggle = { onToggle }
190
175
isOn = { isActive }
191
176
disabled = { disabled }
192
177
showLockIcon = { showLockIcon }
193
178
/>
194
179
</ View >
195
180
{ shouldPlaceSubtitleBelowSwitch && subtitle && subTitleView }
196
- < Accordion
197
- isExpanded = { isExpanded }
198
- style = { accordionStyle }
199
- isToggleTriggered = { isToggleTriggered }
200
- >
201
- { subMenuItems }
202
- </ Accordion >
181
+ { isActive && subMenuItems }
203
182
</ View >
204
183
</ OfflineWithFeedback >
205
184
) ;
0 commit comments