Code Monkey home page Code Monkey logo

react-native-material-switch's People

Contributors

agmcleod avatar genki avatar jakerawr avatar jbrodriguez avatar randycoulman avatar recr0ns avatar skv-headless 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-material-switch's Issues

toggle problem

HI, I switched the switch 40 times, but it trigger ‘onchange’ events about 29 times. Yes, I mean sometimes the toggle did not work. run on android / 3.5RN. Maybe I click too fast

NPM publish

Hi, is there an expected timeline as to when the latest changes are going to be published on NPM?

Thanks,
Phil

switch access issue

Hello,

I am using this package to add a switch to my native app. I am attaching the error image
screen shot 2017-06-09 at 3 30 04 pm

to solve this error, I had to make declaration changes to the index file. The changes I made are:
import React,{Component} from 'react';
import {PanResponder,
View,
TouchableHighlight,
Animated} from 'react-native';

Please solve the issue with the package so that others don't face the similar problem.

Thanks!

Switch looks cut

screenshot_2015-12-31-18-26-45

var NotificationSettings = React.createClass({
  render(){
    return (
      <ScrollView
        pointerEvents="box-none"
        style={styles.scrollView}
        scrollEventThrottle={200}
        contentInset={{top: 0}}
        >
        <View style={styles.container}>
          <Text style={styles.welcome}>
            הגדרות
          </Text>
          <Text style={styles.categoryLabel}>Drawer Type</Text>
          <View style={styles.row}>
            <Text style={styles.rowLabel}>Overlay</Text>
              <Switch style={styles.rowInput}
              />
          </View>
        </View>
      </ScrollView>
    )
  }
});

var styles = {
    scrollView: {
      backgroundColor: '#ffffff',
    },
    container: {
      flex: 1,
      backgroundColor: '#ffffff',
    },
    welcome: {
      fontSize: 20,
      textAlign: 'center',
      margin: 25,
    },
    categoryLabel: {
      fontSize: 15,
      textAlign: 'right',
      right: 10,
      padding:10,
      fontWeight:'bold',
    },
    row: {
      padding: 10,
      flexDirection: 'row',
      backgroundColor:'white',
    },
    lastRow: {
      flexDirection: 'row',
      backgroundColor:'white',
      borderRadius: 0,
      borderWidth: 0,
      borderTopWidth: 1 / PixelRatio.get(),
      borderBottomWidth: 1 / PixelRatio.get(),
      borderColor: '#d6d7da',
      padding:10,
      alignItems: 'center'
    },
    rowLabel: {
      fontSize:15,
      flex:1,
    },
    rowInput: {
      flex:1,
    },
};

Bug of cannot get the switch state

Hi,

I found a bug that I cannot get switch state. you should annotate the "if" statement, or you cannot get the state when switch to true.

image

Enable slide

Is enableSlide working properly on iOS? Even though I've set it to false, I still can slide both ways.

<Switch onChangeState={(value)=>{this.setValue(value)}} active={false} enableSlide={false} inactiveButtonColor='#27ae60' inactiveButtonPressedColor='#009e54' activeButtonColor='#009e54' activeButtonPressedColor='#27ae60' activeBackgroundColor='rgba(0,0,0,.5)' />

Thanks

when i try to used this Switch component i got this error.

this is how i used it

import React, { Component } from 'react';
import { Image,TouchableOpacity ,Text , Alert} from 'react-native';
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import { Container, Content, InputGroup, Input, Button, Icon, View ,Header, Title} from 'native-base';
import { Grid, Row } from 'react-native-easy-grid';
import { setUser,fetchRecipes } from '../../actions/user';
import styles from './style';
import globle from './../../globle_style/globle';
import myTheme from '../../themes/base-theme';
import Switch from 'react-native-material-switch';

Unhandled JS Exception: Seems you're trying to access 'ReactNative.createClass' from the 'react-native' package. Perhaps you meant to access 'React.createClass' from the 'react' package instead?

For example, instead of:

import React, { Component, View } from 'react-native';

You should now do:

import React, { Component } from 'react';
import { View } from 'react-native';

Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1

reactConsoleErrorHandler @ ExceptionsManager.js:71

Publish new npm version

Hi @recr0ns

Could you update the npm package?
We're currently using the git repo in our package.json (because of that: #29 (comment)). However it would be cool to use the npm package in our app.

Thanks for the component! It looks awesome.
Regards,
Nicolas.

onActiavte and onDeactivate need to be independent of onChangeState and active

          <Switch
            active ={this.state.active}
            style={{borderWidth:1.3, borderColor:'#cfcfcf', padding:0, margin:0}}
            switchWidth ={48}
            switchHeight={20}
            buttonRadius={14}
            inactiveButtonColor={"#cfcfcf"}
            activeButtonColor={"#fc973d"}
            activeButtonPressedColor={"#fc973d"}
            inactiveButtonPressedColor={'#cfcfcf'}
            inactiveBackgroundColor={"#FFFFFF"}
            activeBackgroundColor={"#ffe0b2"}
            inactiveBackgroundColor={"#e0e0e0"}
            onChangeState={(state)=>{this.setState({active:state})}}
             onActivate={() => {console.log("onActive"}}
             onDeactivate={() => {console.log("onDeactive"}/>

I conclude that onChangeState must depends on onActivate and onDeactivate, but not viceversa. I mean it is totally strange that onActivate or deactivate is called upon changing state from somewhere else too

Toggling doesn't correctly trigger onChangeState

Sliding appears to work

I was able to fix by removing line 165
var callHandlers = this.start.state != state;
and replacing it with
var callHandlers = false; if (this.start.stateChanged) { callHandlers = this.start.state != state; } else { callHandlers = this.state.state != state; }

How to show text (YES/NO) inside a switch in react-native

I am new to react-native. In my app, I'm using a switch and changing the tint color to differentiate ON and OFF, but my actual requirement is to show "YES" or "NO" text inside the switch like below.

image

Here is my Code:


Please give me suggestions to solve this issue, Any help much appreciated.

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.