React Native Pepper Switch Button在Android上不起作用,但在浏览器和IOS上可以正常工作

时间:2020-03-08 15:14:13

标签: react-native-android

React Native Pepper Switch Button在Android上不起作用,但在Browser&IOS上可以正常工作。

不知道我在想什么。我也要添加屏幕截图

http://prntscr.com/rdczsw,请看一下,让我想念我的

import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { Switch } from "react-native-paper";
import { theme } from "../core/theme";

class Customswitch extends React.Component{
  constructor(){
    super();
    this.state = {
      isSwitchOn: false,
    };
  }
  render() {
    return (
      <View style={styles.container}>
        <View style={styles.containerLeft}>
          <Text style={styles.featureheader}>{this.props.contentText}</Text>
        </View>
        <View style={styles.containerRight}>
        <Switch value={this.state.isSwitchOn} onValueChange={() =>
          { console.log('data changed'); this.setState({ isSwitchOn: !this.state.isSwitchOn }); this.props.activateCallLog(this.state.isSwitchOn);  }}  />
        </View>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'row',
    padding: 50
  },
  containerLeft: {
    width: '50%'
  },
  containerRight: {
    width: '50%',
    fontSize: 19
  },
  featureheader: {
    fontSize: 19
  }
});

export default Customswitch;

0 个答案:

没有答案