Giter VIP home page Giter VIP logo

react-native-switch-toggle's People

Contributors

benevbright avatar dependabot[bot] avatar freakyfelt avatar gousta avatar greenkeeper[bot] avatar hyochan avatar rollsroyc3 avatar sajithneyo avatar slorber avatar tamzinselvi avatar ts-ign0re avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-switch-toggle's Issues

Color transition bug when using gray color tones

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:

Screenshot 2021-06-14 at 19 47 11
Screenshot 2021-06-14 at 19 47 09

I think the cause for this is the inputRange from background color interpolation. inputRange should be [0,1] instead of [0.5,1].

circleStyle and containerStyle throws an error

<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?

Doesn't support RTL

Screen Shot 2019-09-05 at 4 38 50 PM

For RTL the switch button goes outside view.
Is there any CSS that can be applied to container or circle to fix it ?

Package don't support import in typescript project ?

Describe the bug
Package don't support import in typescript project

To Reproduce

  1. Install npm install react-native-switch-toggle --save
  2. Add import SwitchToggle from "react-native-switch-toggle";
  3. Package don't support declaration file in project

Expected behavior
Add declaration file support for package

Screenshots
Demo: https://prnt.sc/15ybbgr

Desktop (please complete the following information):

  • OS: MacOS
  • React native (expo)
  • Version
"react-native": "~0.63.4",
"expo": "~41.0.1",

Adding new prop to disable toggle

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.

Toggle Animation not working for react native web

Describe the bug
The toggle inner circle is not moving to right at all in web

To Reproduce
Steps to reproduce the behavior:

  1. Run the react native app for web
  2. Click on toggle.
  3. The toggle inner circle is not moving from left to right. Just stays at left.

Expected behavior
Toggle needs to move from left to right.

Screenshots
Screenshot 2021-12-06 at 8 36 43 PM

Desktop (please complete the following information):

  • OS: [iOS]
  • Browser [safari]
  • Version [e.g. 14.1.2]

onPress doesn't work

I just try as a Example code

react-native:0.63.3
OS: masOS Big Sure 11.5

  • Device: Galaxy A50
  • OS: Samsung Android 11

Action required: Greenkeeper could not be activated 🚨

🚨 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.

Toggle Not Working

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?

Border Radius not working for circle

image

image

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.

Setting containerStyle to an object or StyleSheet that doesn't have padding property results in an error

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!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.