Remove use of decorator syntax

This commit is contained in:
Nicolas Gallagher
2016-07-06 10:11:03 -07:00
parent d4d67dafc0
commit f0202dbe61
7 changed files with 20 additions and 14 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import applyNativeMethods from '../../modules/applyNativeMethods'
import React, { Component, PropTypes } from 'react'
import ReactDOM from 'react-dom'
import StyleSheet from '../../apis/StyleSheet'
@@ -19,7 +19,6 @@ const keyframeEffects = [
{ transform: 'scale(0.95)', opacity: 0.5 }
]
@NativeMethodsDecorator
class ActivityIndicator extends Component {
static propTypes = {
animating: PropTypes.bool,
@@ -87,6 +86,8 @@ class ActivityIndicator extends Component {
}
}
applyNativeMethods(ActivityIndicator)
const styles = StyleSheet.create({
container: {
alignItems: 'center',
+3 -2
View File
@@ -1,8 +1,8 @@
/* global window */
import applyNativeMethods from '../../modules/applyNativeMethods'
import createNativeComponent from '../../modules/createNativeComponent'
import ImageResizeMode from './ImageResizeMode'
import ImageStylePropTypes from './ImageStylePropTypes'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import resolveAssetSource from './resolveAssetSource'
import React, { Component, PropTypes } from 'react'
import StyleSheet from '../../apis/StyleSheet'
@@ -22,7 +22,6 @@ const ImageSourcePropType = PropTypes.oneOfType([
PropTypes.string
])
@NativeMethodsDecorator
class Image extends Component {
static propTypes = {
accessibilityLabel: createNativeComponent.propTypes.accessibilityLabel,
@@ -176,6 +175,8 @@ class Image extends Component {
}
}
applyNativeMethods(Image)
const styles = StyleSheet.create({
initial: {
alignSelf: 'flex-start',
+3 -2
View File
@@ -1,4 +1,4 @@
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import applyNativeMethods from '../../modules/applyNativeMethods'
import React, { Component } from 'react'
import ScrollView from '../ScrollView'
import ListViewDataSource from './ListViewDataSource'
@@ -6,7 +6,6 @@ import ListViewPropTypes from './ListViewPropTypes'
const SCROLLVIEW_REF = 'listviewscroll'
@NativeMethodsDecorator
class ListView extends Component {
static propTypes = ListViewPropTypes;
@@ -100,4 +99,6 @@ class ListView extends Component {
}
}
applyNativeMethods(ListView)
module.exports = ListView
+3 -2
View File
@@ -1,11 +1,10 @@
import applyNativeMethods from '../../modules/applyNativeMethods'
import createNativeComponent from '../../modules/createNativeComponent'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import { Component, PropTypes } from 'react'
import StyleSheet from '../../apis/StyleSheet'
import StyleSheetPropType from '../../apis/StyleSheet/StyleSheetPropType'
import TextStylePropTypes from './TextStylePropTypes'
@NativeMethodsDecorator
class Text extends Component {
static propTypes = {
accessibilityLabel: createNativeComponent.propTypes.accessibilityLabel,
@@ -49,6 +48,8 @@ class Text extends Component {
}
}
applyNativeMethods(Text)
const styles = StyleSheet.create({
initial: {
color: 'inherit',
+3 -2
View File
@@ -1,5 +1,5 @@
import applyNativeMethods from '../../modules/applyNativeMethods'
import createNativeComponent from '../../modules/createNativeComponent'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import omit from 'lodash/omit'
import pick from 'lodash/pick'
import React, { Component, PropTypes } from 'react'
@@ -14,7 +14,6 @@ import ViewStylePropTypes from '../View/ViewStylePropTypes'
const viewStyleProps = Object.keys(ViewStylePropTypes)
@NativeMethodsDecorator
class TextInput extends Component {
static propTypes = {
...View.propTypes,
@@ -233,6 +232,8 @@ class TextInput extends Component {
}
}
applyNativeMethods(TextInput)
const styles = StyleSheet.create({
initial: {
borderColor: 'black',
+3 -2
View File
@@ -1,12 +1,11 @@
import applyNativeMethods from '../../modules/applyNativeMethods'
import createNativeComponent from '../../modules/createNativeComponent'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import normalizeNativeEvent from '../../apis/PanResponder/normalizeNativeEvent'
import { Component, PropTypes } from 'react'
import StyleSheet from '../../apis/StyleSheet'
import StyleSheetPropType from '../../apis/StyleSheet/StyleSheetPropType'
import ViewStylePropTypes from './ViewStylePropTypes'
@NativeMethodsDecorator
class View extends Component {
static propTypes = {
accessibilityLabel: createNativeComponent.propTypes.accessibilityLabel,
@@ -98,6 +97,8 @@ class View extends Component {
}
}
applyNativeMethods(View)
const styles = StyleSheet.create({
// https://github.com/facebook/css-layout#default-values
initial: {
@@ -7,7 +7,7 @@
import NativeMethodsMixin from '../NativeMethodsMixin'
const NativeMethodsDecorator = (Component) => {
const applyNativeMethods = (Component) => {
Object.keys(NativeMethodsMixin).forEach((method) => {
if (!Component.prototype[method]) {
Component.prototype[method] = NativeMethodsMixin[method]
@@ -16,4 +16,4 @@ const NativeMethodsDecorator = (Component) => {
return Component
}
module.exports = NativeMethodsDecorator
module.exports = applyNativeMethods