简体   繁体   English

我将如何像这样在 react Native 中进行自定义开关和切换

[英]How would I make a Custom Switch and Toggle Like this In react Native

I am Trying to make a custom switch in react native expo but all the NPM's components don't seem to work, how would i come about creating a custom switch with animations and a custom toggle like the ones show in the image with react native expo?我正在尝试在反应原生 expo 中进行自定义开关,但所有 NPM 的组件似乎都不起作用,我将如何创建一个带有动画和自定义切换的自定义开关,就像图像中显示的那样,反应原生 expo ?

What I am trying to make我想要做什么

To achieve your first switch example you can look at react-native-switch and tweak it slightly to take a height and width (instead of circle size).要实现您的第一个开关示例,您可以查看 react-native-switch 并稍微调整它以获取高度和宽度(而不是圆形大小)。 I have a working example of this here .在这里有一个工作示例。

For your second example a simple TouchableOpacity with toggle icon should suffice.对于您的第二个示例,带有切换图标的简单 TouchableOpacity 就足够了。 You can get a little more elborate and add a color animation if you wanted.如果需要,您可以更详细一点并添加颜色 animation。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想知道如何进行自动刷新而不是在 Expo/React Native 中按下按钮 - I would like to know how to make automatic refresh instead of pressing a button in Expo/React Native 如何在React Native中为setState的Toggle创建通用处理程序 - How do I make a generic handler for Toggle for setState in React Native 当通过 map 呈现切换按钮列表时,如何使反应原生切换为 true? - How to make the react native switch to true when list of toggle button is rendered through a map? typescript 的拨动开关反应原生 - toggle-switch-react-native for typescript 如何创建简单的开关切换以在 React Native 中的深色主题和浅色主题之间切换 - How to create simple switch toggle to switch between dark theme and light theme in react native 我想在地图功能中创建一个单独的过程,比如点击切换 - i would like to make an individual process in a map function like toggle on click 如何在 React Native 中制作类似功能? - How to make like function in React Native? 反应:如何更改 map 内拨动开关的状态? - React: How can i change the status of toggle switch inside map? 如何在 React Native 中使用 Animated.View 制作切换按钮? - How to make Toggle Button with Animated.View in React Native? 我想在我的项目中使用 tab 来切换页面。 项目使用 react-redux 和 react-router - I would like to use tab to switch page in my project . project uses react-redux and react -router
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM