yujonglee / react-native-switch-toggle Goto Github PK
View Code? Open in Web Editor NEWreact-native switch toggle button component.
License: MIT License
react-native switch toggle button component.
License: MIT License
Hello,
i use this library for a while and dont have any issues so far so all the credits for it. Recently i came across a bug regarding color transition when togling on-off.
When using gray color tones the color always transitions to a pinkish tone :).
Steps to reproduce:
circleColorOff="gray"
circleColorOn="green"
outcome:
I think the cause for this is the inputRange from background color interpolation. inputRange should be [0,1] instead of [0.5,1].
<SwitchToggle
switchOn={this.state.switchOn}
onPress={this.onPress}
backgroundColorOn='#faa519'
backgroundColorOff='#e5e1e0'
circleColorOn={'white'}
circleColorOff={'white'}
circleStyle={{ width: 25, height: 25, borderRadius: 15, padding: 1 }}
containerStyle={{ width: 60, height: 20, borderRadius: 20, padding: 1}}
/>
When I load the screen I get an error:
Error while updating property 'transform' of a view managed by: RCTView
null
translateX
.
.
.
If I change the default props from library on index.js everything works fine. Any suggestions?
Describe the bug
The component doesn't support accessibility props such as accessibilityLabel
and accessibilityState
.
Describe the bug
Package don't support import in typescript project
To Reproduce
npm install react-native-switch-toggle --save
import SwitchToggle from "react-native-switch-toggle";
Expected behavior
Add declaration file support for package
Screenshots
Demo: https://prnt.sc/15ybbgr
Desktop (please complete the following information):
"react-native": "~0.63.4",
"expo": "~41.0.1",
The original issue was that despite I don't change de value to switchOn the animation is performed at least one time, so that I've just add a custom prop to disable animation when we want to not change the toggle, I could push the code if the owner of this repo allow me.
Describe the bug
The toggle inner circle is not moving to right at all in web
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Toggle needs to move from left to right.
Desktop (please complete the following information):
I just try as a Example code
react-native:0.63.3
OS: masOS Big Sure 11.5
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
I am using this component just exactly thesame way it was used in the Usage Example. But for some unknown reason, the switch doesn't toggle when i click on it. Any Idea what is causing it?
can you tell me how get Props type?
It works great in most cases.
Except, turning on/off Switch by changing props, does work only first time.
I will make a PR when I have a chance to code.
Why import a completely unnecessary dependency?
The border radius at the top is not there.
<SwitchToggle
backgroundColorOn={'#fcc900'}
backgroundColorOff={'transparent'}
type={0}
circleColorOn={'rgba(255, 255, 255, 1)'}
circleColorOff={'rgba(255, 255, 255, 1)'}
onPress={() => {
console.log("Clicked");
this.setState({marginValue: !this.state.marginValue});
}}
switchOn={this.state.marginValue}
/>
This is using the default styles for everything.
This code results in an error:
<SwitchToggle
containerStyle={{ width: 48, height: 16, borderRadius: 8 }}
switchOn={true}
onPress={() => {}}
/>
Error message:
Exception thrown while executing UI block: -[NSNull floatValue]: unrecognized selector sent to instance 0x110525f28
While this code works fine:
<SwitchToggle
containerStyle={{
width: 48,
height: 16,
borderRadius: 8,
padding: 0, // < ------------ Added
}}
switchOn={true}
onPress={() => {}}
/>
(thanks for the lib!)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.