recr0ns / react-native-material-switch Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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
Hi, is there an expected timeline as to when the latest changes are going to be published on NPM?
Thanks,
Phil
Hi,
I know this issue has been reported, we just want to know if you will fix it.
Thanks,
Not sure why... but this property is not working for me. The others like activeButtonColor do work.
Hello,
I am using this package to add a switch to my native app. I am attaching the error image
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!
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,
},
};
you bind only:
this.deactivate = this.deactivate.bind(this)
need to add:
this.activate = this.activate.bind(this)
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
Is this compatible with android ?
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
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.
<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
as title, can it cancel touch when playing animation.
there may be some situations that require a switch to grey out and to respond not to any action. what do you think ?
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; }
For one of the scene, when l trigger the onchangeState event, the state of active change to true, but l want control the state by myself...
I see a lot of issues building up and PR's not merging. If this one isn't active, does anyone know any good alternatives?
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.