admin管理员组文章数量:1315831
I am trying to implement a "riddle effect" where pressing an outer TouchableNativeFeedback
will also trigger an inner Switch
that is attached to it. However, the current implementation does not behave as expected. I would like to achieve a behavior similar to what is demonstrated in the video linked.
Here is the code for context:
<TouchableNativeFeedback
key={setting}
onPress={() =>
handleSwitchToggle()
}
background={TouchableNativeFeedback.Ripple(
"rgba(0, 0, 0, .32)",
false
)}
useForeground={true}
>
<View style={styles.touchableItem}>
<List.Item
title={title}
right={() => (
<View pointerEvents="none">
<Switch
value={switchValue}
onValueChange={(newActiveValue) =>
handleSwitchChange(newActiveValue)
}
color="#a08eb9"
/>
</View>
)}
/>
</View>
</TouchableNativeFeedback>
What changes would you suggest to ensure that pressing the outer TouchableNativeFeedback
also triggers the inner switch, creating a good looking interaction similar to the effect shown in the video?
Video:
本文标签: Achieving a Ripple Switch Interaction in React Native AndroidStack Overflow
版权声明:本文标题:Achieving a Ripple Switch Interaction in React Native Android - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741988024a2408799.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论