var React = require('react-native');
var {
Switch,
Text,
View
} = React;
var BasicSwitchExample = React.createClass({
getInitialState() {
return {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
};
},
render() {
return (
<View>
<Switch
onValueChange={(value) => this.setState({falseSwitchIsOn: value})}
style={{marginBottom: 10}}
value={this.state.falseSwitchIsOn} />
<Switch
onValueChange={(value) => this.setState({trueSwitchIsOn: value})}
value={this.state.trueSwitchIsOn} />
</View>
);
}
});
BasicSwitchExample doesn't work in Android.
error screenshot:
compile ('com.facebook.react:react-native:0.20.1'){
exclude group: 'com.nineoldandroids', module: 'library' }
I know that this is pretty old, but if anyone ends up here...
I had the exact same problem, after little bit of digging into source I found out that it was caused by android theme i was using.
So the solution for me was to switch android theme in andorid/app/src/main/res/styles.xml from android:Theme.Material.Light.NoActionBar to Theme.AppCompat.Light.NoActionBar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With