From c4f593f930bbedeb5bae4554d06d12fe4d1a522c Mon Sep 17 00:00:00 2001 From: landandan <383326809@qq.com> Date: Wed, 30 May 2018 12:04:41 +0800 Subject: [PATCH] delete useless code --- README.md | 1 - lib/Switch.js | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dc7c800..d29c6d1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ export const App = () => ( backgroundInactive={'gray'} circleActiveColor={'#30a566'} circleInActiveColor={'#000000'} - changeValueImmediately={true} renderInsideCircle={() => } // custom component to render inside the Switch circle (Text, Image, etc.) changeValueImmediately={true} // if rendering inside circle, change state immediately or wait for animation to complete innerCircleStyle={{ alignItems: "center", justifyContent: "center" }} // style for inner animated circle for what you (may) be rendering inside the circle diff --git a/lib/Switch.js b/lib/Switch.js index 9f24d07..a72eb38 100644 --- a/lib/Switch.js +++ b/lib/Switch.js @@ -1,14 +1,12 @@ -import React, { Component } from "react"; +import React, { Component } from "react" import { - View, Text, StyleSheet, Animated, - PanResponder, TouchableWithoutFeedback, ViewPropTypes -} from "react-native"; -import PropTypes from "prop-types"; +} from "react-native" +import PropTypes from "prop-types" export class Switch extends Component { static propTypes = { @@ -32,7 +30,6 @@ export class Switch extends Component { innerCircleStyle: ViewPropTypes.style, renderInsideCircle: PropTypes.func, changeValueImmediately: PropTypes.bool, - innerCircleStyle: ViewPropTypes.style, outerCircleStyle: ViewPropTypes.style, renderActiveText: PropTypes.bool, renderInActiveText: PropTypes.bool, @@ -45,7 +42,6 @@ export class Switch extends Component { value: false, onValueChange: () => null, renderInsideCircle: () => null, - innerCircleStyle: {}, disabled: false, activeText: "On", inActiveText: "Off", @@ -180,7 +176,7 @@ export class Switch extends Component { inputRange: [-75, 75], outputRange: [circleInActiveColor, circleActiveColor] }); - + const interpolatedCircleBorderColor = circleBorderColor.interpolate({ inputRange: [-75, 75], outputRange: [circleInactiveBorderColor, circleActiveBorderColor]