From 44e79093e33351404f743fd2ac03300621e9c923 Mon Sep 17 00:00:00 2001 From: Think Wu Date: Tue, 5 Jan 2016 21:16:14 +0800 Subject: [PATCH] fix lint alerts --- lib/internal/MKTouchable.js | 6 --- lib/mdl/IconToggle.js | 1 - lib/mdl/Slider.js | 10 ++--- lib/mdl/Textfield.js | 8 +--- lib/mdl/cards/action.js | 13 +++--- lib/mdl/cards/container.js | 21 +++++---- lib/mdl/cards/content.js | 17 ++++---- lib/mdl/cards/image.js | 13 +++--- lib/mdl/cards/menu.js | 15 ++----- lib/mdl/cards/styles.js | 86 +++++++++++++++++++------------------ lib/mdl/cards/title.js | 14 +++--- 11 files changed, 90 insertions(+), 114 deletions(-) diff --git a/lib/internal/MKTouchable.js b/lib/internal/MKTouchable.js index fd16d1ba..f6bc0a30 100644 --- a/lib/internal/MKTouchable.js +++ b/lib/internal/MKTouchable.js @@ -57,12 +57,6 @@ MKTouchable.propTypes = { // FIXME `no propType for native prop` error on Android nativeBackgroundAndroid: PropTypes.object, - needsOffscreenAlphaCompositing: PropTypes.bool, - scaleX: PropTypes.number, - scaleY: PropTypes.number, - translateX: PropTypes.number, - translateY: PropTypes.number, - rotation: PropTypes.number, }; const NativeTouchable = requireNativeComponent('MKTouchable', { diff --git a/lib/mdl/IconToggle.js b/lib/mdl/IconToggle.js index 7b262885..d6485815 100644 --- a/lib/mdl/IconToggle.js +++ b/lib/mdl/IconToggle.js @@ -16,7 +16,6 @@ const { TouchableWithoutFeedback, } = React; -const MKPropTypes = require('../MKPropTypes'); const MKColor = require('../MKColor'); const Ripple = require('./Ripple'); const utils = require('../utils'); diff --git a/lib/mdl/Slider.js b/lib/mdl/Slider.js index d4f1aa1f..5d72713e 100644 --- a/lib/mdl/Slider.js +++ b/lib/mdl/Slider.js @@ -187,10 +187,10 @@ class Slider extends Component { this._prevPointerX = 0; this._animatedTrackLength = new Animated.Value(0); this._panResponder = PanResponder.create({ - onStartShouldSetPanResponder: (evt, gestureState) => true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => true, - onMoveShouldSetPanResponder: (evt, gestureState) => true, - onMoveShouldSetPanResponderCapture: (evt, gestureState) => true, + onStartShouldSetPanResponder: () => true, + onStartShouldSetPanResponderCapture: () => true, + onMoveShouldSetPanResponder: () => true, + onMoveShouldSetPanResponderCapture: () => true, onPanResponderGrant: (evt) => { this._prevPointerX = evt.nativeEvent.locationX; this._onTouchEvent({ @@ -211,7 +211,7 @@ class Slider extends Component { onPanResponderTerminate: (evt, gestureState) => { this._onPanResponderEnd(gestureState, true); }, - onShouldBlockNativeResponder: (evt, gestureState) => true, + onShouldBlockNativeResponder: () => true, }); } diff --git a/lib/mdl/Textfield.js b/lib/mdl/Textfield.js index a9da81dc..d983b593 100644 --- a/lib/mdl/Textfield.js +++ b/lib/mdl/Textfield.js @@ -67,12 +67,8 @@ class FloatingLabel extends Component { } setColor(color) { - // FIXME color has to be wrapped into the style object since RN 0.13 + // color has to be wrapped into the style object since RN 0.13 this.refs.label.setNativeProps({style:{color: utils.parseColor(color)}}); - // color has to be an int since RN v0.12, https://github.com/facebook/react-native/issues/3300, use this with RN 0.12 - // this.refs.label.setNativeProps({color: utils.parseColor(color)}); - // use this with RN before 0.12 - // this.refs.label.setNativeProps({color}); } aniFloatLabel() { @@ -437,7 +433,7 @@ class Textfield extends Component { } render() { - let floatingLabel, defaultDim; + let floatingLabel; if (this.props.floatingLabelEnabled) { // the floating label floatingLabel = ( diff --git a/lib/mdl/cards/action.js b/lib/mdl/cards/action.js index be09ef1f..31f55ddd 100644 --- a/lib/mdl/cards/action.js +++ b/lib/mdl/cards/action.js @@ -1,17 +1,16 @@ const React = require('react-native'); -let styles = require('./styles'); +const styles = require('./styles'); const { - PropTypes, View, -} = React; + } = React; -var Action = React.createClass({ +const Action = React.createClass({ - render(){ - return {this.props.content} + render() { + return {this.props.content}; }, -}) +}); module.exports = Action; diff --git a/lib/mdl/cards/container.js b/lib/mdl/cards/container.js index 04d75ca6..b73db555 100644 --- a/lib/mdl/cards/container.js +++ b/lib/mdl/cards/container.js @@ -1,20 +1,19 @@ const React = require('react-native'); -let styles = require('./styles'); +const styles = require('./styles'); const { - PropTypes, View, -} = React; + } = React; -var Container = React.createClass({ +const Container = React.createClass({ - render(){ - return ( - - {this.props.children} - - ) + render() { + return ( + + {this.props.children} + + ) }, -}) +}); module.exports = Container; diff --git a/lib/mdl/cards/content.js b/lib/mdl/cards/content.js index fa4001b5..c2ebc89c 100644 --- a/lib/mdl/cards/content.js +++ b/lib/mdl/cards/content.js @@ -1,23 +1,22 @@ const React = require('react-native'); -let styles = require('./styles'); +const styles = require('./styles'); const { - PropTypes, View, Text, -} = React; + } = React; -var Content = React.createClass({ +const Content = React.createClass({ - render(){ - if(this.props.children.type.displayName === "Text"){ - return {this.props.children} - }else{ + render() { + if (this.props.children.type.displayName === 'Text') { + return {this.props.children} + } else { return {this.props.children} } }, -}) +}); module.exports = Content; diff --git a/lib/mdl/cards/image.js b/lib/mdl/cards/image.js index deb69901..f2e7041c 100644 --- a/lib/mdl/cards/image.js +++ b/lib/mdl/cards/image.js @@ -1,18 +1,15 @@ const React = require('react-native'); -let styles = require('./styles'); const { - PropTypes, View, - Image, -} = React; + } = React; -var Imag = React.createClass({ +const Image = React.createClass({ - render(){ + render() { return {this.props.children}; }, -}) +}); -module.exports = Imag; +module.exports = Image; diff --git a/lib/mdl/cards/menu.js b/lib/mdl/cards/menu.js index c73fe34e..39490acf 100644 --- a/lib/mdl/cards/menu.js +++ b/lib/mdl/cards/menu.js @@ -1,18 +1,11 @@ const React = require('react-native'); -let styles = require('./styles'); -const { - PropTypes, - View, - Text, -} = React; +const Menu = React.createClass({ -var Menu = React.createClass({ - - render(){ - return this.props.children + render() { + return this.props.children; }, -}) +}); module.exports = Menu; diff --git a/lib/mdl/cards/styles.js b/lib/mdl/cards/styles.js index e8264d05..d2e17814 100644 --- a/lib/mdl/cards/styles.js +++ b/lib/mdl/cards/styles.js @@ -1,57 +1,59 @@ const React = require('react-native'); const { - StyleSheet -} = React; + StyleSheet, + } = React; -// TODO: Plug colors etc with MKTheme -var style = StyleSheet.create({ - card: { - flex : 1, - backgroundColor: "#ffffff", - borderRadius: 2, +// TODO: Plug colors etc with MKTheme +const style = StyleSheet.create({ + card: { + flex: 1, + backgroundColor: '#ffffff', + borderRadius: 8, + borderColor: '#ffffff', + borderWidth: 10, - shadowColor: "rgba(0,0,0,.12)", + shadowColor: 'rgba(0,0,0,.12)', shadowOpacity: 0.8, shadowRadius: 2, shadowOffset: { height: 1, - width: 2 - } + width: 2, + }, }, - image : { - flex : 1, - height : 170, - resizeMode: 'cover' - }, - title : { - position : "absolute", - top : 120, - left : 26, - backgroundColor: 'transparent', - padding : 16, - fontSize : 24, - color : "#000000", - fontWeight: 'bold', - }, - content : { - padding : 15, - color: "rgba(0,0,0,.54)", - }, - action : { - borderStyle:"solid", - borderTopColor : "rgba(0,0,0,.1)", - borderTopWidth : 1, - padding : 15, + image: { + flex: 1, + height: 170, + resizeMode: 'cover', + }, + title: { + position: 'absolute', + top: 120, + left: 26, + backgroundColor: 'transparent', + padding: 16, + fontSize: 24, + color: '#000000', + fontWeight: 'bold', + }, + content: { + padding: 15, + color: 'rgba(0,0,0,.54)', + }, + action: { + borderStyle: 'solid', + borderTopColor: 'rgba(0,0,0,.1)', + borderTopWidth: 1, + padding: 15, - }, - menu : { - position : "absolute", - top : 16, - right : 16, - backgroundColor : "transparent", + }, + menu: { + position: 'absolute', + top: 16, + right: 16, + backgroundColor: 'transparent', - } + }, }); module.exports = style; diff --git a/lib/mdl/cards/title.js b/lib/mdl/cards/title.js index 0f9ca469..8ae7a348 100644 --- a/lib/mdl/cards/title.js +++ b/lib/mdl/cards/title.js @@ -1,18 +1,16 @@ const React = require('react-native'); -let styles = require('./styles'); +const styles = require('./styles'); const { - PropTypes, - View, Text, -} = React; + } = React; -var Title = React.createClass({ +const Title = React.createClass({ - render(){ - return {this.props.children} + render() { + return {this.props.children} }, -}) +}); module.exports = Title;