[英]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 ?
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.