diff --git a/docs/storybook/components/TextInput/TextInputExample.js b/docs/storybook/components/TextInput/TextInputExample.js index 3180ffd2..e00a1ccd 100644 --- a/docs/storybook/components/TextInput/TextInputExample.js +++ b/docs/storybook/components/TextInput/TextInputExample.js @@ -26,8 +26,8 @@ import React from 'react'; import { storiesOf } from '@kadira/storybook'; import UIExplorer from '../../UIExplorer'; -import { any, bool, object, string } from 'prop-types'; -import { StyleSheet, Text, TextInput, View } from 'react-native'; +import { any, bool, string } from 'prop-types'; +import { StyleSheet, Text, TextInput, TextPropTypes, View } from 'react-native'; class WithLabel extends React.Component { static propTypes = { @@ -320,7 +320,7 @@ class SelectionExample extends React.Component { static propTypes = { multiline: bool, - style: object, + style: TextPropTypes.style, value: string }; diff --git a/docs/storybook/components/View/ViewTransformsExample.js b/docs/storybook/components/View/ViewTransformsExample.js index a58a0ec9..112fbd51 100644 --- a/docs/storybook/components/View/ViewTransformsExample.js +++ b/docs/storybook/components/View/ViewTransformsExample.js @@ -37,13 +37,13 @@ class Flip extends React.Component { this._animate(); } - _animate() { + _animate = () => { this.state.theta.setValue(0); Animated.timing(this.state.theta, { toValue: 360, duration: 5000 }).start(this._animate); - } + }; render() { return ( @@ -255,4 +255,4 @@ const examples = [ } ]; -module.exports = examples; +export default examples; diff --git a/docs/storybook/demos/Calculator/Calculator.js b/docs/storybook/demos/Calculator/Calculator.js index a531d6be..bd522e94 100644 --- a/docs/storybook/demos/Calculator/Calculator.js +++ b/docs/storybook/demos/Calculator/Calculator.js @@ -438,4 +438,4 @@ const calculatorStyles = StyleSheet.create({ } }); -module.exports = Calculator; +export default Calculator; diff --git a/docs/storybook/demos/Game2048/Game2048.js b/docs/storybook/demos/Game2048/Game2048.js index a36d3f37..1591b57e 100644 --- a/docs/storybook/demos/Game2048/Game2048.js +++ b/docs/storybook/demos/Game2048/Game2048.js @@ -323,4 +323,4 @@ const styles = StyleSheet.create({ AppRegistry.registerComponent('Game2048', () => Game2048); -module.exports = Game2048; +export default Game2048; diff --git a/docs/storybook/demos/Game2048/GameBoard.js b/docs/storybook/demos/Game2048/GameBoard.js index b908bac4..89ac3e27 100644 --- a/docs/storybook/demos/Game2048/GameBoard.js +++ b/docs/storybook/demos/Game2048/GameBoard.js @@ -207,4 +207,4 @@ Board.prototype.hasLost = function() { return !canMove; }; -module.exports = Board; +export default Board; diff --git a/docs/storybook/demos/TicTacToe/TicTacToe.js b/docs/storybook/demos/TicTacToe/TicTacToe.js index 2b2eea96..788fe93c 100644 --- a/docs/storybook/demos/TicTacToe/TicTacToe.js +++ b/docs/storybook/demos/TicTacToe/TicTacToe.js @@ -325,4 +325,4 @@ const styles = StyleSheet.create({ AppRegistry.registerComponent('TicTacToeApp', () => TicTacToeApp); -module.exports = TicTacToeApp; +export default TicTacToeApp; diff --git a/src/apis/Animated/index.js b/src/apis/Animated/index.js index 2e9ad1df..16e4cc09 100644 --- a/src/apis/Animated/index.js +++ b/src/apis/Animated/index.js @@ -7,10 +7,12 @@ import View from '../../components/View'; Animated.inject.FlattenStyle(StyleSheet.flatten); -module.exports = { +const AnimatedImplementation = { ...Animated, Image: Animated.createAnimatedComponent(Image), ScrollView: Animated.createAnimatedComponent(ScrollView), Text: Animated.createAnimatedComponent(Text), View: Animated.createAnimatedComponent(View) }; + +export default AnimatedImplementation; diff --git a/src/apis/AppRegistry/AppContainer.js b/src/apis/AppRegistry/AppContainer.js index bc55ac49..4f62f3d1 100644 --- a/src/apis/AppRegistry/AppContainer.js +++ b/src/apis/AppRegistry/AppContainer.js @@ -20,7 +20,7 @@ type State = { mainKey: number }; -class AppContainer extends Component { +export default class AppContainer extends Component { props: Props; state: State = { mainKey: 1 }; @@ -61,5 +61,3 @@ const styles = StyleSheet.create({ flex: 1 } }); - -module.exports = AppContainer; diff --git a/src/apis/AppRegistry/index.js b/src/apis/AppRegistry/index.js index 9ab20754..bc996817 100644 --- a/src/apis/AppRegistry/index.js +++ b/src/apis/AppRegistry/index.js @@ -24,7 +24,7 @@ export type AppConfig = { /** * `AppRegistry` is the JS entry point to running all React Native apps. */ -class AppRegistry { +export default class AppRegistry { static getAppKeys(): Array { return Object.keys(runnables); } @@ -90,5 +90,3 @@ class AppRegistry { unmountComponentAtNode(rootTag); } } - -module.exports = AppRegistry; diff --git a/src/apis/AppState/index.js b/src/apis/AppState/index.js index 7db14dc0..942b9f8d 100644 --- a/src/apis/AppState/index.js +++ b/src/apis/AppState/index.js @@ -16,7 +16,7 @@ const AppStates = { const listeners = []; -class AppState { +export default class AppState { static isAvailable = ExecutionEnvironment.canUseDOM && document.visibilityState; static get currentState() { @@ -65,5 +65,3 @@ class AppState { } } } - -module.exports = AppState; diff --git a/src/apis/AsyncStorage/index.js b/src/apis/AsyncStorage/index.js index dd6e274a..f604df3b 100644 --- a/src/apis/AsyncStorage/index.js +++ b/src/apis/AsyncStorage/index.js @@ -46,7 +46,7 @@ const createPromiseAll = (promises, callback, processResult) => { ); }; -class AsyncStorage { +export default class AsyncStorage { /** * Erases *all* AsyncStorage for the domain. */ @@ -147,5 +147,3 @@ class AsyncStorage { return createPromiseAll(promises, callback); } } - -module.exports = AsyncStorage; diff --git a/src/apis/BackAndroid/index.js b/src/apis/BackAndroid/index.js index 3ad9e13a..e82b3045 100644 --- a/src/apis/BackAndroid/index.js +++ b/src/apis/BackAndroid/index.js @@ -23,4 +23,4 @@ const BackAndroid = { removeEventListener: emptyFunction }; -module.exports = BackAndroid; +export default BackAndroid; diff --git a/src/apis/Clipboard/index.js b/src/apis/Clipboard/index.js index 8bf0758e..051e5dbd 100644 --- a/src/apis/Clipboard/index.js +++ b/src/apis/Clipboard/index.js @@ -3,7 +3,7 @@ * @flow */ -class Clipboard { +export default class Clipboard { static isSupported() { return ( typeof document.queryCommandSupported === 'function' && document.queryCommandSupported('copy') @@ -47,5 +47,3 @@ class Clipboard { return success; } } - -module.exports = Clipboard; diff --git a/src/apis/Dimensions/index.js b/src/apis/Dimensions/index.js index 8a9c97cd..5a68f3be 100644 --- a/src/apis/Dimensions/index.js +++ b/src/apis/Dimensions/index.js @@ -24,7 +24,7 @@ const win = canUseDOM const dimensions = {}; -class Dimensions { +export default class Dimensions { static get(dimension: string): Object { invariant(dimensions[dimension], `No dimension set for key ${dimension}`); return dimensions[dimension]; @@ -52,5 +52,3 @@ Dimensions.set(); if (canUseDOM) { window.addEventListener('resize', debounce(Dimensions.set, 16), false); } - -module.exports = Dimensions; diff --git a/src/apis/I18nManager/index.js b/src/apis/I18nManager/index.js index d2c66d07..6bfeeb7e 100644 --- a/src/apis/I18nManager/index.js +++ b/src/apis/I18nManager/index.js @@ -48,4 +48,4 @@ const I18nManager: I18nManagerStatus = { } }; -module.exports = I18nManager; +export default I18nManager; diff --git a/src/apis/InteractionManager/index.js b/src/apis/InteractionManager/index.js index 05a8ce8a..3160b027 100644 --- a/src/apis/InteractionManager/index.js +++ b/src/apis/InteractionManager/index.js @@ -38,4 +38,4 @@ const InteractionManager = { addListener: () => {} }; -module.exports = InteractionManager; +export default InteractionManager; diff --git a/src/apis/Linking/index.js b/src/apis/Linking/index.js index 462e70f5..b9dc446e 100644 --- a/src/apis/Linking/index.js +++ b/src/apis/Linking/index.js @@ -58,4 +58,4 @@ const iframeOpen = url => { } }; -module.exports = Linking; +export default Linking; diff --git a/src/apis/NetInfo/index.js b/src/apis/NetInfo/index.js index d7005a05..3ef386e8 100644 --- a/src/apis/NetInfo/index.js +++ b/src/apis/NetInfo/index.js @@ -111,4 +111,4 @@ const NetInfo = { } }; -module.exports = NetInfo; +export default NetInfo; diff --git a/src/apis/PanResponder/index.js b/src/apis/PanResponder/index.js index e183c3db..cd77c083 100644 --- a/src/apis/PanResponder/index.js +++ b/src/apis/PanResponder/index.js @@ -4,9 +4,7 @@ * All rights reserved. */ -'use strict'; - -var TouchHistoryMath = require('../../vendor/TouchHistoryMath'); +import TouchHistoryMath from '../../vendor/TouchHistoryMath'; var currentCentroidXOfTouchesChangedAfter = TouchHistoryMath.currentCentroidXOfTouchesChangedAfter; var currentCentroidYOfTouchesChangedAfter = TouchHistoryMath.currentCentroidYOfTouchesChangedAfter; @@ -385,4 +383,4 @@ var PanResponder = { } }; -module.exports = PanResponder; +export default PanResponder; diff --git a/src/apis/PixelRatio/index.js b/src/apis/PixelRatio/index.js index aa24d893..cc73dc0d 100644 --- a/src/apis/PixelRatio/index.js +++ b/src/apis/PixelRatio/index.js @@ -11,7 +11,7 @@ import Dimensions from '../Dimensions'; /** * PixelRatio gives access to the device pixel density. */ -class PixelRatio { +export default class PixelRatio { /** * Returns the device pixel density. */ @@ -45,5 +45,3 @@ class PixelRatio { return Math.round(layoutSize * ratio) / ratio; } } - -module.exports = PixelRatio; diff --git a/src/apis/Platform/index.js b/src/apis/Platform/index.js index 2a497d9f..5973c995 100644 --- a/src/apis/Platform/index.js +++ b/src/apis/Platform/index.js @@ -7,4 +7,4 @@ const Platform = { select: (obj: Object) => ('web' in obj ? obj.web : obj.default) }; -module.exports = Platform; +export default Platform; diff --git a/src/apis/StyleSheet/StyleManager.js b/src/apis/StyleSheet/StyleManager.js index af008b9c..5fba0020 100644 --- a/src/apis/StyleSheet/StyleManager.js +++ b/src/apis/StyleSheet/StyleManager.js @@ -33,7 +33,7 @@ const pointerEventsCss = `.${pointerEvents.boxOnly} *{pointer-events:none;}\n` + `.${pointerEvents.none}{pointer-events:none;}`; -class StyleManager { +export default class StyleManager { constructor() { // custom pointer event values are implemented using descendent selectors, // so we manually create the CSS and pre-register the declarations @@ -131,5 +131,3 @@ class StyleManager { cache.byClassName[className] = { prop, value }; } } - -module.exports = StyleManager; diff --git a/src/apis/StyleSheet/StyleRegistry.js b/src/apis/StyleSheet/StyleRegistry.js index 42aa0ff8..61b61a13 100644 --- a/src/apis/StyleSheet/StyleRegistry.js +++ b/src/apis/StyleSheet/StyleRegistry.js @@ -20,7 +20,7 @@ const createCacheKey = id => { const classListToString = list => list.join(' ').trim(); -class StyleRegistry { +export default class StyleRegistry { constructor() { this.cache = { ltr: {}, rtl: {} }; this.styleManager = new StyleManager(); @@ -189,5 +189,3 @@ class StyleRegistry { return this._resolveStyle(style, options); } } - -module.exports = StyleRegistry; diff --git a/src/apis/StyleSheet/StyleSheetValidation.js b/src/apis/StyleSheet/StyleSheetValidation.js index 0d584108..103ab6dd 100644 --- a/src/apis/StyleSheet/StyleSheetValidation.js +++ b/src/apis/StyleSheet/StyleSheetValidation.js @@ -23,7 +23,7 @@ import { oneOf, string } from 'prop-types'; // plz don't fire me. const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; -class StyleSheetValidation { +export default class StyleSheetValidation { static validateStyleProp(prop, style, caller) { if (process.env.NODE_ENV !== 'production') { if (allStylePropTypes[prop] === undefined) { @@ -89,5 +89,3 @@ StyleSheetValidation.addValidStylePropTypes({ listStyle: string, pointerEvents: string }); - -module.exports = StyleSheetValidation; diff --git a/src/apis/StyleSheet/createReactDOMStyle.js b/src/apis/StyleSheet/createReactDOMStyle.js index 903ab88f..a4a1c431 100644 --- a/src/apis/StyleSheet/createReactDOMStyle.js +++ b/src/apis/StyleSheet/createReactDOMStyle.js @@ -223,4 +223,4 @@ const createReactDOMStyle = style => { return resolvedStyle; }; -module.exports = createReactDOMStyle; +export default createReactDOMStyle; diff --git a/src/apis/StyleSheet/flattenStyle.js b/src/apis/StyleSheet/flattenStyle.js index af85be1a..daca1a57 100644 --- a/src/apis/StyleSheet/flattenStyle.js +++ b/src/apis/StyleSheet/flattenStyle.js @@ -48,4 +48,4 @@ function flattenStyle(style: ?StyleObj): ?Object { return result; } -module.exports = flattenStyle; +export default flattenStyle; diff --git a/src/apis/StyleSheet/generateCss.js b/src/apis/StyleSheet/generateCss.js index e2089652..3e5c543e 100644 --- a/src/apis/StyleSheet/generateCss.js +++ b/src/apis/StyleSheet/generateCss.js @@ -21,4 +21,4 @@ const createDeclarationString = (prop, val) => { const generateCss = style => mapKeyValue(prefixStyles(style), createDeclarationString).sort().join(';'); -module.exports = generateCss; +export default generateCss; diff --git a/src/apis/StyleSheet/hash.js b/src/apis/StyleSheet/hash.js index 1376a1b7..1c500fc2 100644 --- a/src/apis/StyleSheet/hash.js +++ b/src/apis/StyleSheet/hash.js @@ -52,4 +52,5 @@ function murmurhash2_32_gc(str, seed) { return h >>> 0; } -module.exports = str => murmurhash2_32_gc(str, 1).toString(36); +const hash = str => murmurhash2_32_gc(str, 1).toString(36); +export default hash; diff --git a/src/apis/StyleSheet/i18nStyle.js b/src/apis/StyleSheet/i18nStyle.js index 7e2e06f1..ee5e01cf 100644 --- a/src/apis/StyleSheet/i18nStyle.js +++ b/src/apis/StyleSheet/i18nStyle.js @@ -78,4 +78,4 @@ const i18nStyle = originalStyle => { return nextStyle; }; -module.exports = i18nStyle; +export default i18nStyle; diff --git a/src/apis/StyleSheet/index.js b/src/apis/StyleSheet/index.js index 83774dae..8af41ebd 100644 --- a/src/apis/StyleSheet/index.js +++ b/src/apis/StyleSheet/index.js @@ -10,14 +10,15 @@ const absoluteFillObject = { }; const absoluteFill = StyleRegistry.register(absoluteFillObject); -module.exports = { +const StyleSheet = { absoluteFill, absoluteFillObject, create(styles) { const result = {}; Object.keys(styles).forEach(key => { if (process.env.NODE_ENV !== 'production') { - require('./StyleSheetValidation').validateStyle(key, styles); + const StyleSheetValidation = require('./StyleSheetValidation').default; + StyleSheetValidation.validateStyle(key, styles); } result[key] = StyleRegistry.register(styles[key]); }); @@ -29,3 +30,5 @@ module.exports = { return StyleRegistry.getStyleSheetHtml(); } }; + +export default StyleSheet; diff --git a/src/apis/StyleSheet/normalizeValue.js b/src/apis/StyleSheet/normalizeValue.js index 93edf81d..abbe8748 100644 --- a/src/apis/StyleSheet/normalizeValue.js +++ b/src/apis/StyleSheet/normalizeValue.js @@ -7,4 +7,4 @@ const normalizeValue = (property, value) => { return value; }; -module.exports = normalizeValue; +export default normalizeValue; diff --git a/src/apis/StyleSheet/registry.js b/src/apis/StyleSheet/registry.js index d067b76f..57fbb57a 100644 --- a/src/apis/StyleSheet/registry.js +++ b/src/apis/StyleSheet/registry.js @@ -1,3 +1,3 @@ import StyleRegistry from './StyleRegistry'; const registry = new StyleRegistry(); -module.exports = registry; +export default registry; diff --git a/src/apis/StyleSheet/staticCss.js b/src/apis/StyleSheet/staticCss.js index 69ceb59a..a22d9793 100644 --- a/src/apis/StyleSheet/staticCss.js +++ b/src/apis/StyleSheet/staticCss.js @@ -1,5 +1,4 @@ -module.exports = - 'html{' + // css reset +export default 'html{' + // css reset 'font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;' + '-webkit-tap-highlight-color:rgba(0,0,0,0);' + '}\n' + diff --git a/src/apis/UIManager/index.js b/src/apis/UIManager/index.js index 46565ab2..02b73e57 100644 --- a/src/apis/UIManager/index.js +++ b/src/apis/UIManager/index.js @@ -108,4 +108,4 @@ const UIManager = { } }; -module.exports = UIManager; +export default UIManager; diff --git a/src/apis/Vibration/index.js b/src/apis/Vibration/index.js index de368f00..93de95f9 100644 --- a/src/apis/Vibration/index.js +++ b/src/apis/Vibration/index.js @@ -23,4 +23,4 @@ const Vibration = { } }; -module.exports = Vibration; +export default Vibration; diff --git a/src/components/ActivityIndicator/index.js b/src/components/ActivityIndicator/index.js index 651fc7ee..6d5935c7 100644 --- a/src/components/ActivityIndicator/index.js +++ b/src/components/ActivityIndicator/index.js @@ -110,4 +110,4 @@ const indicatorSizes = StyleSheet.create({ } }); -module.exports = applyNativeMethods(ActivityIndicator); +export default applyNativeMethods(ActivityIndicator); diff --git a/src/components/Button/index.js b/src/components/Button/index.js index 853bc5bb..13d4aca7 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -62,4 +62,4 @@ const styles = StyleSheet.create({ } }); -module.exports = Button; +export default Button; diff --git a/src/components/Image/ImageResizeMode.js b/src/components/Image/ImageResizeMode.js index 3c7c2aea..46d592d0 100644 --- a/src/components/Image/ImageResizeMode.js +++ b/src/components/Image/ImageResizeMode.js @@ -11,4 +11,4 @@ const ImageResizeMode = { stretch: 'stretch' }; -module.exports = ImageResizeMode; +export default ImageResizeMode; diff --git a/src/components/Image/ImageStylePropTypes.js b/src/components/Image/ImageStylePropTypes.js index 32288320..5af1bd40 100644 --- a/src/components/Image/ImageStylePropTypes.js +++ b/src/components/Image/ImageStylePropTypes.js @@ -10,7 +10,7 @@ import ShadowPropTypes from '../../propTypes/ShadowPropTypes'; import TransformPropTypes from '../../propTypes/TransformPropTypes'; import { number, oneOf, string } from 'prop-types'; -module.exports = { +const ImageStylePropTypes = { ...BorderPropTypes, ...LayoutPropTypes, ...ShadowPropTypes, @@ -28,3 +28,5 @@ module.exports = { */ boxShadow: string }; + +export default ImageStylePropTypes; diff --git a/src/components/Image/ImageUriCache.js b/src/components/Image/ImageUriCache.js index 595c355f..c1b6ad1b 100644 --- a/src/components/Image/ImageUriCache.js +++ b/src/components/Image/ImageUriCache.js @@ -2,7 +2,7 @@ * @flow */ -class ImageUriCache { +export default class ImageUriCache { static _maximumEntries: number = 256; static _entries = {}; @@ -61,5 +61,3 @@ class ImageUriCache { } } } - -module.exports = ImageUriCache; diff --git a/src/components/Image/index.js b/src/components/Image/index.js index 9319b30b..a10aee73 100644 --- a/src/components/Image/index.js +++ b/src/components/Image/index.js @@ -298,4 +298,4 @@ const resizeModeStyles = StyleSheet.create({ } }); -module.exports = applyNativeMethods(Image); +export default applyNativeMethods(Image); diff --git a/src/components/ListView/ListViewDataSource.js b/src/components/ListView/ListViewDataSource.js index ec80322d..e359bc2d 100644 --- a/src/components/ListView/ListViewDataSource.js +++ b/src/components/ListView/ListViewDataSource.js @@ -27,11 +27,10 @@ * @typechecks * @flow */ -'use strict'; -var invariant = require('fbjs/lib/invariant'); -var isEmpty = require('fbjs/lib/isEmpty'); -var warning = require('fbjs/lib/warning'); +import invariant from 'fbjs/lib/invariant'; +import isEmpty from 'fbjs/lib/isEmpty'; +import warning from 'fbjs/lib/warning'; function defaultGetRowData(dataBlob: any, sectionID: number | string, rowID: number | string): any { return dataBlob[sectionID][rowID]; @@ -392,4 +391,4 @@ function keyedDictionaryFromArray(arr) { return result; } -module.exports = ListViewDataSource; +export default ListViewDataSource; diff --git a/src/components/ListView/index.js b/src/components/ListView/index.js index 5034a172..40845665 100644 --- a/src/components/ListView/index.js +++ b/src/components/ListView/index.js @@ -441,4 +441,4 @@ class ListView extends Component { }; } -module.exports = applyNativeMethods(ListView); +export default applyNativeMethods(ListView); diff --git a/src/components/ProgressBar/index.js b/src/components/ProgressBar/index.js index 4302db61..34c05650 100644 --- a/src/components/ProgressBar/index.js +++ b/src/components/ProgressBar/index.js @@ -93,4 +93,4 @@ const styles = StyleSheet.create({ } }); -module.exports = applyNativeMethods(ProgressBar); +export default applyNativeMethods(ProgressBar); diff --git a/src/components/ScrollView/index.js b/src/components/ScrollView/index.js index 9452f648..4353ba34 100644 --- a/src/components/ScrollView/index.js +++ b/src/components/ScrollView/index.js @@ -244,4 +244,4 @@ const styles = StyleSheet.create({ } }); -module.exports = ScrollView; +export default ScrollView; diff --git a/src/components/StaticContainer/index.js b/src/components/StaticContainer/index.js index 9a42c2b8..edeaf44b 100644 --- a/src/components/StaticContainer/index.js +++ b/src/components/StaticContainer/index.js @@ -24,7 +24,7 @@ import { Children, Component } from 'react'; * Typically, you will not need to use this component and should opt for normal * React reconciliation. */ -class StaticContainer extends Component { +export default class StaticContainer extends Component { static propTypes = { children: any.isRequired, shouldUpdate: bool.isRequired @@ -39,5 +39,3 @@ class StaticContainer extends Component { return child === null || child === false ? null : Children.only(child); } } - -module.exports = StaticContainer; diff --git a/src/components/StaticRenderer/index.js b/src/components/StaticRenderer/index.js index 0f847ca9..51c0a1d1 100644 --- a/src/components/StaticRenderer/index.js +++ b/src/components/StaticRenderer/index.js @@ -23,7 +23,7 @@ import { bool, func } from 'prop-types'; * React reconciliation. */ -class StaticRenderer extends Component { +export default class StaticRenderer extends Component { static propTypes = { render: func.isRequired, shouldUpdate: bool.isRequired @@ -37,5 +37,3 @@ class StaticRenderer extends Component { return this.props.render(); } } - -module.exports = StaticRenderer; diff --git a/src/components/StatusBar/index.js b/src/components/StatusBar/index.js index a4dda723..828f549d 100644 --- a/src/components/StatusBar/index.js +++ b/src/components/StatusBar/index.js @@ -4,7 +4,7 @@ import { Component } from 'react'; -class StatusBar extends Component { +export default class StatusBar extends Component { static setBackgroundColor() {} static setBarStyle() {} static setHidden() {} @@ -14,5 +14,3 @@ class StatusBar extends Component { return null; } } - -module.exports = StatusBar; diff --git a/src/components/Switch/index.js b/src/components/Switch/index.js index e0e9024d..c64c6f03 100644 --- a/src/components/Switch/index.js +++ b/src/components/Switch/index.js @@ -196,4 +196,4 @@ const styles = StyleSheet.create({ } }); -module.exports = applyNativeMethods(Switch); +export default applyNativeMethods(Switch); diff --git a/src/components/Text/TextPropTypes.js b/src/components/Text/TextPropTypes.js new file mode 100644 index 00000000..770c1b02 --- /dev/null +++ b/src/components/Text/TextPropTypes.js @@ -0,0 +1,21 @@ +/** + * @flow + */ + +import BaseComponentPropTypes from '../../propTypes/BaseComponentPropTypes'; +import StyleSheetPropType from '../../propTypes/StyleSheetPropType'; +import TextStylePropTypes from './TextStylePropTypes'; +import { any, bool, func, number, oneOf } from 'prop-types'; + +const TextPropTypes = { + ...BaseComponentPropTypes, + accessibilityRole: oneOf(['button', 'heading', 'link', 'listitem']), + children: any, + numberOfLines: number, + onLayout: func, + onPress: func, + selectable: bool, + style: StyleSheetPropType(TextStylePropTypes) +}; + +export default TextPropTypes; diff --git a/src/components/Text/TextStylePropTypes.js b/src/components/Text/TextStylePropTypes.js index 60e306f8..389b71b8 100644 --- a/src/components/Text/TextStylePropTypes.js +++ b/src/components/Text/TextStylePropTypes.js @@ -12,7 +12,8 @@ const ShadowOffsetPropType = shape({ width: number, height: number }); const TextAlignPropType = oneOf(['center', 'inherit', 'justify', 'justify-all', 'left', 'right']); const WritingDirectionPropType = oneOf(['auto', 'ltr', 'rtl']); -const TextOnlyStylePropTypes = { +const TextStylePropTypes = { + ...ViewStylePropTypes, color: ColorPropType, fontFamily: string, fontFeatureSettings: string, @@ -23,7 +24,9 @@ const TextOnlyStylePropTypes = { lineHeight: numberOrString, textAlign: TextAlignPropType, textAlignVertical: oneOf(['auto', 'bottom', 'center', 'top']), + textDecorationColor: ColorPropType, textDecorationLine: string, + textDecorationStyle: string, textShadowColor: ColorPropType, textShadowOffset: ShadowOffsetPropType, textShadowRadius: number, @@ -47,7 +50,4 @@ const TextOnlyStylePropTypes = { WebkitFontSmoothing: string }; -module.exports = { - ...ViewStylePropTypes, - ...TextOnlyStylePropTypes -}; +export default TextStylePropTypes; diff --git a/src/components/Text/index.js b/src/components/Text/index.js index 94ee4b40..54adfc8c 100644 --- a/src/components/Text/index.js +++ b/src/components/Text/index.js @@ -4,27 +4,16 @@ import applyLayout from '../../modules/applyLayout'; import applyNativeMethods from '../../modules/applyNativeMethods'; -import BaseComponentPropTypes from '../../propTypes/BaseComponentPropTypes'; +import { bool } from 'prop-types'; import { Component } from 'react'; import createDOMElement from '../../modules/createDOMElement'; import StyleSheet from '../../apis/StyleSheet'; -import StyleSheetPropType from '../../propTypes/StyleSheetPropType'; -import TextStylePropTypes from './TextStylePropTypes'; -import { any, bool, func, number, oneOf } from 'prop-types'; +import TextPropTypes from './TextPropTypes'; class Text extends Component { static displayName = 'Text'; - static propTypes = { - ...BaseComponentPropTypes, - accessibilityRole: oneOf(['button', 'heading', 'link', 'listitem']), - children: any, - numberOfLines: number, - onLayout: func, - onPress: func, - selectable: bool, - style: StyleSheetPropType(TextStylePropTypes) - }; + static propTypes = TextPropTypes; static childContextTypes = { isInAParentText: bool @@ -114,4 +103,4 @@ const styles = StyleSheet.create({ } }); -module.exports = applyLayout(applyNativeMethods(Text)); +export default applyLayout(applyNativeMethods(Text)); diff --git a/src/components/TextInput/TextInputState.js b/src/components/TextInput/TextInputState.js index 32ccaac4..0f5eaee9 100644 --- a/src/components/TextInput/TextInputState.js +++ b/src/components/TextInput/TextInputState.js @@ -55,4 +55,4 @@ const TextInputState = { } }; -module.exports = TextInputState; +export default TextInputState; diff --git a/src/components/TextInput/TextInputStylePropTypes.js b/src/components/TextInput/TextInputStylePropTypes.js index 780e9e03..d8ab8ebb 100644 --- a/src/components/TextInput/TextInputStylePropTypes.js +++ b/src/components/TextInput/TextInputStylePropTypes.js @@ -5,12 +5,10 @@ import TextStylePropTypes from '../Text/TextStylePropTypes'; import { oneOf } from 'prop-types'; -const TextInputOnlyStylePropTypes = { +const TextInputStylePropTypes = { + ...TextStylePropTypes, /* @platform web */ resize: oneOf(['none', 'vertical', 'horizontal', 'both']) }; -module.exports = { - ...TextStylePropTypes, - ...TextInputOnlyStylePropTypes -}; +export default TextInputStylePropTypes; diff --git a/src/components/TextInput/index.js b/src/components/TextInput/index.js index c6ff90e5..c80b58d9 100644 --- a/src/components/TextInput/index.js +++ b/src/components/TextInput/index.js @@ -321,4 +321,4 @@ const styles = StyleSheet.create({ } }); -module.exports = applyLayout(applyNativeMethods(TextInput)); +export default applyLayout(applyNativeMethods(TextInput)); diff --git a/src/components/Touchable/BoundingDimensions.js b/src/components/Touchable/BoundingDimensions.js index b1316068..478e07d9 100644 --- a/src/components/Touchable/BoundingDimensions.js +++ b/src/components/Touchable/BoundingDimensions.js @@ -5,7 +5,7 @@ * All rights reserved. */ -var PooledClass = require('../../vendor/PooledClass'); +import PooledClass from '../../vendor/PooledClass'; var twoArgumentPooler = PooledClass.twoArgumentPooler; @@ -36,4 +36,4 @@ BoundingDimensions.getPooledFromElement = function(element) { PooledClass.addPoolingTo(BoundingDimensions, twoArgumentPooler); -module.exports = BoundingDimensions; +export default BoundingDimensions; diff --git a/src/components/Touchable/Position.js b/src/components/Touchable/Position.js index 7cacb828..708ffade 100644 --- a/src/components/Touchable/Position.js +++ b/src/components/Touchable/Position.js @@ -5,9 +5,7 @@ * All rights reserved. */ -'use strict'; - -var PooledClass = require('../../vendor/PooledClass'); +import PooledClass from '../../vendor/PooledClass'; var twoArgumentPooler = PooledClass.twoArgumentPooler; @@ -31,4 +29,4 @@ Position.prototype.destructor = function() { PooledClass.addPoolingTo(Position, twoArgumentPooler); -module.exports = Position; +export default Position; diff --git a/src/components/Touchable/Touchable.js b/src/components/Touchable/Touchable.js index aab673c2..4aa6806e 100644 --- a/src/components/Touchable/Touchable.js +++ b/src/components/Touchable/Touchable.js @@ -10,16 +10,14 @@ * @providesModule Touchable */ -'use strict'; - /* @edit start */ -const BoundingDimensions = require('./BoundingDimensions'); -const normalizeColor = require('normalize-css-color'); -const Position = require('./Position'); -const React = require('react'); -const TouchEventUtils = require('fbjs/lib/TouchEventUtils'); -const UIManager = require('../../apis/UIManager'); -const View = require('../../components/View'); +import BoundingDimensions from './BoundingDimensions'; +import normalizeColor from 'normalize-css-color'; +import Position from './Position'; +import React from 'react'; +import TouchEventUtils from 'fbjs/lib/TouchEventUtils'; +import UIManager from '../../apis/UIManager'; +import View from '../../components/View'; /* @edit end */ /** @@ -792,4 +790,4 @@ var Touchable = { } }; -module.exports = Touchable; +export default Touchable; diff --git a/src/components/Touchable/TouchableHighlight.js b/src/components/Touchable/TouchableHighlight.js index bbbc5385..4dc5ad74 100644 --- a/src/components/Touchable/TouchableHighlight.js +++ b/src/components/Touchable/TouchableHighlight.js @@ -10,26 +10,22 @@ * @providesModule TouchableHighlight * @noflow */ -'use strict'; -// Note (avik): add @flow when Flow supports spread properties in propTypes - -var ColorPropType = require('../../propTypes/ColorPropType'); -var NativeMethodsMixin = require('../../modules/NativeMethodsMixin'); -var React = require('react'); -var StyleSheet = require('../../apis/StyleSheet'); -var StyleSheetPropType = require('../../propTypes/StyleSheetPropType'); -var TimerMixin = require('react-timer-mixin'); -var Touchable = require('./Touchable'); -var TouchableWithoutFeedback = require('./TouchableWithoutFeedback'); -var View = require('../View'); -var ViewStylePropTypes = require('../View/ViewStylePropTypes'); +import ColorPropType from '../../propTypes/ColorPropType'; import createReactClass from 'create-react-class'; +import ensureComponentIsNative from './ensureComponentIsNative'; +import ensurePositiveDelayProps from './ensurePositiveDelayProps'; +import NativeMethodsMixin from '../../modules/NativeMethodsMixin'; +import React from 'react'; +import StyleSheet from '../../apis/StyleSheet'; +import StyleSheetPropType from '../../propTypes/StyleSheetPropType'; +import TimerMixin from 'react-timer-mixin'; +import Touchable from './Touchable'; +import TouchableWithoutFeedback from './TouchableWithoutFeedback'; +import View from '../View'; +import ViewStylePropTypes from '../View/ViewStylePropTypes'; import { func, number } from 'prop-types'; -var ensureComponentIsNative = require('./ensureComponentIsNative'); -var ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); - type Event = Object; var DEFAULT_PROPS = { @@ -308,4 +304,4 @@ var styles = StyleSheet.create({ } }); -module.exports = TouchableHighlight; +export default TouchableHighlight; diff --git a/src/components/Touchable/TouchableOpacity.js b/src/components/Touchable/TouchableOpacity.js index c825d640..394b4289 100644 --- a/src/components/Touchable/TouchableOpacity.js +++ b/src/components/Touchable/TouchableOpacity.js @@ -10,21 +10,18 @@ * @providesModule TouchableOpacity * @noflow */ -'use strict'; -// Note (avik): add @flow when Flow supports spread properties in propTypes - -var NativeMethodsMixin = require('../../modules/NativeMethodsMixin'); -var React = require('react'); -var StyleSheet = require('../../apis/StyleSheet'); -var TimerMixin = require('react-timer-mixin'); -var Touchable = require('./Touchable'); -var TouchableWithoutFeedback = require('./TouchableWithoutFeedback'); -var View = require('../View'); import createReactClass from 'create-react-class'; +import ensurePositiveDelayProps from './ensurePositiveDelayProps'; +import NativeMethodsMixin from '../../modules/NativeMethodsMixin'; import { number } from 'prop-types'; +import React from 'react'; +import StyleSheet from '../../apis/StyleSheet'; +import TimerMixin from 'react-timer-mixin'; +import Touchable from './Touchable'; +import TouchableWithoutFeedback from './TouchableWithoutFeedback'; +import View from '../View'; -var ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); var flattenStyle = StyleSheet.flatten; type Event = Object; @@ -217,4 +214,4 @@ var styles = StyleSheet.create({ } }); -module.exports = TouchableOpacity; +export default TouchableOpacity; diff --git a/src/components/Touchable/TouchableWithoutFeedback.js b/src/components/Touchable/TouchableWithoutFeedback.js index 53ca4f4b..178e0b28 100644 --- a/src/components/Touchable/TouchableWithoutFeedback.js +++ b/src/components/Touchable/TouchableWithoutFeedback.js @@ -1,4 +1,5 @@ /* eslint-disable */ + /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. @@ -10,16 +11,15 @@ * @providesModule TouchableWithoutFeedback * @flow */ -'use strict'; -var EdgeInsetsPropType = require('../../propTypes/EdgeInsetsPropType'); -var React = require('react'); -var TimerMixin = require('react-timer-mixin'); -var Touchable = require('./Touchable'); -var ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); -var warning = require('fbjs/lib/warning'); -var StyleSheet = require('../../apis/StyleSheet'); import createReactClass from 'create-react-class'; +import EdgeInsetsPropType from '../../propTypes/EdgeInsetsPropType'; +import ensurePositiveDelayProps from './ensurePositiveDelayProps'; +import React from 'react'; +import StyleSheet from '../../apis/StyleSheet'; +import TimerMixin from 'react-timer-mixin'; +import Touchable from './Touchable'; +import warning from 'fbjs/lib/warning'; import { bool, element, func, number, string } from 'prop-types'; type Event = Object; @@ -207,4 +207,4 @@ var styles = StyleSheet.create({ } }); -module.exports = TouchableWithoutFeedback; +export default TouchableWithoutFeedback; diff --git a/src/components/Touchable/ensureComponentIsNative.js b/src/components/Touchable/ensureComponentIsNative.js index c49b2d1b..4df4b42d 100644 --- a/src/components/Touchable/ensureComponentIsNative.js +++ b/src/components/Touchable/ensureComponentIsNative.js @@ -10,15 +10,14 @@ * @providesModule ensureComponentIsNative * @flow */ -'use strict'; -var invariant = require('fbjs/lib/invariant'); +import invariant from 'fbjs/lib/invariant'; -var ensureComponentIsNative = function(component: any) { +const ensureComponentIsNative = (component: any) => { invariant( component && typeof component.setNativeProps === 'function', 'Touchable child must either be native or forward setNativeProps to a ' + 'native component' ); }; -module.exports = ensureComponentIsNative; +export default ensureComponentIsNative; diff --git a/src/components/Touchable/ensurePositiveDelayProps.js b/src/components/Touchable/ensurePositiveDelayProps.js index 688d6db2..302fdbc1 100644 --- a/src/components/Touchable/ensurePositiveDelayProps.js +++ b/src/components/Touchable/ensurePositiveDelayProps.js @@ -10,15 +10,14 @@ * @providesModule ensurePositiveDelayProps * @flow */ -'use strict'; -var invariant = require('fbjs/lib/invariant'); +import invariant from 'fbjs/lib/invariant'; -var ensurePositiveDelayProps = function(props: any) { +const ensurePositiveDelayProps = (props: any) => { invariant( !(props.delayPressIn < 0 || props.delayPressOut < 0 || props.delayLongPress < 0), 'Touchable components cannot have negative delay properties' ); }; -module.exports = ensurePositiveDelayProps; +export default ensurePositiveDelayProps; diff --git a/src/components/View/ViewPropTypes.js b/src/components/View/ViewPropTypes.js index 71353603..7dc033ef 100644 --- a/src/components/View/ViewPropTypes.js +++ b/src/components/View/ViewPropTypes.js @@ -38,4 +38,4 @@ const ViewPropTypes = { style: StyleSheetPropType(ViewStylePropTypes) }; -module.exports = ViewPropTypes; +export default ViewPropTypes; diff --git a/src/components/View/ViewStylePropTypes.js b/src/components/View/ViewStylePropTypes.js index 7ca548c9..162bd690 100644 --- a/src/components/View/ViewStylePropTypes.js +++ b/src/components/View/ViewStylePropTypes.js @@ -10,7 +10,7 @@ import ShadowPropTypes from '../../propTypes/ShadowPropTypes'; import TransformPropTypes from '../../propTypes/TransformPropTypes'; import { number, oneOf, oneOfType, string } from 'prop-types'; -module.exports = { +const ViewStylePropTypes = { ...AnimationPropTypes, ...BorderPropTypes, ...LayoutPropTypes, @@ -49,3 +49,5 @@ module.exports = { WebkitMaskImage: string, WebkitOverflowScrolling: oneOf(['auto', 'touch']) }; + +export default ViewStylePropTypes; diff --git a/src/components/View/index.js b/src/components/View/index.js index b9163c02..95fb0e60 100644 --- a/src/components/View/index.js +++ b/src/components/View/index.js @@ -102,4 +102,4 @@ const styles = StyleSheet.create({ } }); -module.exports = applyLayout(applyNativeMethods(View)); +export default applyLayout(applyNativeMethods(View)); diff --git a/src/core.js b/src/core.js index 13469fbe..a6b369f8 100644 --- a/src/core.js +++ b/src/core.js @@ -42,4 +42,4 @@ const ReactNativeCore = { View }; -module.exports = ReactNativeCore; +export default ReactNativeCore; diff --git a/src/index.js b/src/index.js index 2ace1ce3..6c85f01b 100644 --- a/src/index.js +++ b/src/index.js @@ -50,6 +50,7 @@ import { ColorPropType, EdgeInsetsPropType, PointPropType, + TextPropTypes, ViewPropTypes } from './module'; @@ -106,6 +107,7 @@ const ReactNative = { ColorPropType, EdgeInsetsPropType, PointPropType, + TextPropTypes, ViewPropTypes }; diff --git a/src/module.js b/src/module.js index 54a84940..13935e14 100644 --- a/src/module.js +++ b/src/module.js @@ -47,4 +47,5 @@ export { default as View } from './components/View'; export { default as ColorPropType } from './propTypes/ColorPropType'; export { default as EdgeInsetsPropType } from './propTypes/EdgeInsetsPropType'; export { default as PointPropType } from './propTypes/PointPropType'; +export { default as TextPropTypes } from './components/Text/TextPropTypes'; export { default as ViewPropTypes } from './components/View/ViewPropTypes'; diff --git a/src/modules/AccessibilityUtil/index.js b/src/modules/AccessibilityUtil/index.js index 093f8666..bddba701 100644 --- a/src/modules/AccessibilityUtil/index.js +++ b/src/modules/AccessibilityUtil/index.js @@ -2,8 +2,10 @@ import propsToAccessibilityComponent from './propsToAccessibilityComponent'; import propsToAriaRole from './propsToAriaRole'; import propsToTabIndex from './propsToTabIndex'; -module.exports = { +const AccessibilityUtil = { propsToAccessibilityComponent, propsToAriaRole, propsToTabIndex }; + +export default AccessibilityUtil; diff --git a/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js b/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js index 32745fa3..69511eeb 100644 --- a/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js +++ b/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js @@ -26,4 +26,4 @@ const propsToAccessibilityComponent = (props = emptyObject) => { return roleComponents[role]; }; -module.exports = propsToAccessibilityComponent; +export default propsToAccessibilityComponent; diff --git a/src/modules/AccessibilityUtil/propsToAriaRole.js b/src/modules/AccessibilityUtil/propsToAriaRole.js index 2c00d836..052a44d9 100644 --- a/src/modules/AccessibilityUtil/propsToAriaRole.js +++ b/src/modules/AccessibilityUtil/propsToAriaRole.js @@ -31,4 +31,4 @@ const propsToAriaRole = ({ } }; -module.exports = propsToAriaRole; +export default propsToAriaRole; diff --git a/src/modules/AccessibilityUtil/propsToTabIndex.js b/src/modules/AccessibilityUtil/propsToTabIndex.js index 8cb523d4..36b35548 100644 --- a/src/modules/AccessibilityUtil/propsToTabIndex.js +++ b/src/modules/AccessibilityUtil/propsToTabIndex.js @@ -19,4 +19,4 @@ const propsToTabIndex = props => { } }; -module.exports = propsToTabIndex; +export default propsToTabIndex; diff --git a/src/modules/NativeMethodsMixin/index.js b/src/modules/NativeMethodsMixin/index.js index 8c1a53d3..6092a056 100644 --- a/src/modules/NativeMethodsMixin/index.js +++ b/src/modules/NativeMethodsMixin/index.js @@ -123,4 +123,4 @@ const NativeMethodsMixin = { } }; -module.exports = NativeMethodsMixin; +export default NativeMethodsMixin; diff --git a/src/modules/NativeModules/index.js b/src/modules/NativeModules/index.js index a3383fba..6964e433 100644 --- a/src/modules/NativeModules/index.js +++ b/src/modules/NativeModules/index.js @@ -1,2 +1,3 @@ // NativeModules shim -module.exports = {}; +const NativeModules = {}; +export default NativeModules; diff --git a/src/modules/ReactNativePropRegistry/index.js b/src/modules/ReactNativePropRegistry/index.js index 8a294ca4..c8861f80 100644 --- a/src/modules/ReactNativePropRegistry/index.js +++ b/src/modules/ReactNativePropRegistry/index.js @@ -10,7 +10,6 @@ * @providesModule ReactNativePropRegistry * @flow */ -'use strict'; const emptyObject = {}; const objects = {}; @@ -19,7 +18,7 @@ let uniqueID = 1; const createKey = id => `${prefix}-${id}`; -class ReactNativePropRegistry { +export default class ReactNativePropRegistry { static register(object: Object): number { let id = uniqueID++; if (process.env.NODE_ENV !== 'production') { @@ -45,5 +44,3 @@ class ReactNativePropRegistry { return object; } } - -module.exports = ReactNativePropRegistry; diff --git a/src/modules/ScrollResponder/index.js b/src/modules/ScrollResponder/index.js index b8519eca..d727ea8f 100644 --- a/src/modules/ScrollResponder/index.js +++ b/src/modules/ScrollResponder/index.js @@ -10,20 +10,15 @@ * @providesModule ScrollResponder * @flow */ -'use strict'; -var Dimensions = require('../../apis/Dimensions'); -var findNodeHandle = require('../findNodeHandle'); -var Platform = require('../../apis/Platform'); -var React = require('react'); -// var Subscribable = require('../Subscribable'); -var TextInputState = require('../../components/TextInput/TextInputState'); -var UIManager = require('../../apis/UIManager'); - -// var { ScrollViewManager } = require('../../modules/NativeModules'); - -var invariant = require('fbjs/lib/invariant'); -var warning = require('fbjs/lib/warning'); +import Dimensions from '../../apis/Dimensions'; +import findNodeHandle from '../findNodeHandle'; +import invariant from 'fbjs/lib/invariant'; +import Platform from '../../apis/Platform'; +import React from 'react'; +import TextInputState from '../../components/TextInput/TextInputState'; +import UIManager from '../../apis/UIManager'; +import warning from 'fbjs/lib/warning'; // type Component = React.Component @@ -557,4 +552,4 @@ var ScrollResponder = { Mixin: ScrollResponderMixin }; -module.exports = ScrollResponder; +export default ScrollResponder; diff --git a/src/modules/applyLayout/index.js b/src/modules/applyLayout/index.js index 62c8f662..c78b2fd9 100644 --- a/src/modules/applyLayout/index.js +++ b/src/modules/applyLayout/index.js @@ -90,4 +90,4 @@ const applyLayout = (Component: ReactClass) => { return Component; }; -module.exports = applyLayout; +export default applyLayout; diff --git a/src/modules/applyNativeMethods/index.js b/src/modules/applyNativeMethods/index.js index 2df551bc..24764cf7 100644 --- a/src/modules/applyNativeMethods/index.js +++ b/src/modules/applyNativeMethods/index.js @@ -16,4 +16,4 @@ const applyNativeMethods = (Component: ReactClass) => { return Component; }; -module.exports = applyNativeMethods; +export default applyNativeMethods; diff --git a/src/modules/createDOMElement/index.js b/src/modules/createDOMElement/index.js index a31b6eff..5f23f15d 100644 --- a/src/modules/createDOMElement/index.js +++ b/src/modules/createDOMElement/index.js @@ -55,4 +55,4 @@ const createDOMElement = (component, props) => { return ; }; -module.exports = createDOMElement; +export default createDOMElement; diff --git a/src/modules/createDOMProps/index.js b/src/modules/createDOMProps/index.js index 0b0d60f0..db6058a9 100644 --- a/src/modules/createDOMProps/index.js +++ b/src/modules/createDOMProps/index.js @@ -109,4 +109,4 @@ const createDOMProps = (rnProps, resolveStyle) => { return domProps; }; -module.exports = createDOMProps; +export default createDOMProps; diff --git a/src/modules/dismissKeyboard/index.js b/src/modules/dismissKeyboard/index.js index e1d832dc..c34e58f5 100644 --- a/src/modules/dismissKeyboard/index.js +++ b/src/modules/dismissKeyboard/index.js @@ -4,4 +4,4 @@ const dismissKeyboard = () => { TextInputState.blurTextInput(TextInputState.currentlyFocusedField()); }; -module.exports = dismissKeyboard; +export default dismissKeyboard; diff --git a/src/modules/flattenArray/index.js b/src/modules/flattenArray/index.js index 353f99c4..6dc3baa7 100644 --- a/src/modules/flattenArray/index.js +++ b/src/modules/flattenArray/index.js @@ -15,4 +15,4 @@ function flattenArray(array) { return flattenDown(array, []); } -module.exports = flattenArray; +export default flattenArray; diff --git a/src/modules/mapKeyValue/index.js b/src/modules/mapKeyValue/index.js index 3a296b2b..f019a3c6 100644 --- a/src/modules/mapKeyValue/index.js +++ b/src/modules/mapKeyValue/index.js @@ -11,4 +11,4 @@ const mapKeyValue = (obj, fn) => { return result; }; -module.exports = mapKeyValue; +export default mapKeyValue; diff --git a/src/modules/normalizeNativeEvent.js b/src/modules/normalizeNativeEvent.js index daa10c3c..a72ba503 100644 --- a/src/modules/normalizeNativeEvent.js +++ b/src/modules/normalizeNativeEvent.js @@ -105,4 +105,4 @@ function normalizeNativeEvent(nativeEvent) { return mouse ? normalizeMouseEvent(nativeEvent) : normalizeTouchEvent(nativeEvent); } -module.exports = normalizeNativeEvent; +export default normalizeNativeEvent; diff --git a/src/modules/processColor/index.js b/src/modules/processColor/index.js index bcf7f572..82a22836 100644 --- a/src/modules/processColor/index.js +++ b/src/modules/processColor/index.js @@ -22,4 +22,4 @@ const processColor = (color, opacity = 1) => { return `rgba(${r},${g},${b},${a * opacity})`; }; -module.exports = processColor; +export default processColor; diff --git a/src/modules/unitlessNumbers/index.js b/src/modules/unitlessNumbers/index.js index 4bc53166..48817839 100644 --- a/src/modules/unitlessNumbers/index.js +++ b/src/modules/unitlessNumbers/index.js @@ -42,4 +42,4 @@ const unitlessNumbers = { shadowOpacity: true }; -module.exports = unitlessNumbers; +export default unitlessNumbers; diff --git a/src/propTypes/AnimationPropTypes.js b/src/propTypes/AnimationPropTypes.js index 601acf73..9a2800a2 100644 --- a/src/propTypes/AnimationPropTypes.js +++ b/src/propTypes/AnimationPropTypes.js @@ -11,4 +11,4 @@ const AnimationPropTypes = { animationTimingFunction: string }; -module.exports = AnimationPropTypes; +export default AnimationPropTypes; diff --git a/src/propTypes/BaseComponentPropTypes.js b/src/propTypes/BaseComponentPropTypes.js index 7dfc59fa..2bd96d26 100644 --- a/src/propTypes/BaseComponentPropTypes.js +++ b/src/propTypes/BaseComponentPropTypes.js @@ -10,4 +10,4 @@ const BaseComponentPropTypes = { testID: string }; -module.exports = BaseComponentPropTypes; +export default BaseComponentPropTypes; diff --git a/src/propTypes/BorderPropTypes.js b/src/propTypes/BorderPropTypes.js index 38b4a795..2b22f438 100644 --- a/src/propTypes/BorderPropTypes.js +++ b/src/propTypes/BorderPropTypes.js @@ -22,4 +22,4 @@ const BorderPropTypes = { borderLeftStyle: BorderStylePropType }; -module.exports = BorderPropTypes; +export default BorderPropTypes; diff --git a/src/propTypes/ColorPropType.js b/src/propTypes/ColorPropType.js index 9c5059b3..c0335689 100644 --- a/src/propTypes/ColorPropType.js +++ b/src/propTypes/ColorPropType.js @@ -76,4 +76,4 @@ if (process.env.NODE_ENV !== 'production') { ColorPropType = function() {}; } -module.exports = ColorPropType; +export default ColorPropType; diff --git a/src/propTypes/EdgeInsetsPropType.js b/src/propTypes/EdgeInsetsPropType.js index aaf437b7..238fed97 100644 --- a/src/propTypes/EdgeInsetsPropType.js +++ b/src/propTypes/EdgeInsetsPropType.js @@ -28,4 +28,4 @@ const EdgeInsetsPropType = createStrictShapeTypeChecker({ right: number }); -module.exports = EdgeInsetsPropType; +export default EdgeInsetsPropType; diff --git a/src/propTypes/LayoutPropTypes.js b/src/propTypes/LayoutPropTypes.js index bac234ad..a8aea9f3 100644 --- a/src/propTypes/LayoutPropTypes.js +++ b/src/propTypes/LayoutPropTypes.js @@ -82,4 +82,4 @@ const LayoutPropTypes = { gridTemplateAreas: string }; -module.exports = LayoutPropTypes; +export default LayoutPropTypes; diff --git a/src/propTypes/PointPropType.js b/src/propTypes/PointPropType.js index 8b46ae03..fcd5a05f 100644 --- a/src/propTypes/PointPropType.js +++ b/src/propTypes/PointPropType.js @@ -1,4 +1,5 @@ /* eslint-disable */ + /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. @@ -10,13 +11,13 @@ * @providesModule PointPropType * @flow */ -'use strict'; +import createStrictShapeTypeChecker from './createStrictShapeTypeChecker'; import { number } from 'prop-types'; -var PointPropType = require('./createStrictShapeTypeChecker')({ +var PointPropType = createStrictShapeTypeChecker({ x: number, y: number }); -module.exports = PointPropType; +export default PointPropType; diff --git a/src/propTypes/ShadowPropTypes.js b/src/propTypes/ShadowPropTypes.js index b183e55a..75d8b0d3 100644 --- a/src/propTypes/ShadowPropTypes.js +++ b/src/propTypes/ShadowPropTypes.js @@ -13,4 +13,4 @@ const ShadowPropTypes = { shadowSpread: numberOrString }; -module.exports = ShadowPropTypes; +export default ShadowPropTypes; diff --git a/src/propTypes/StyleSheetPropType.js b/src/propTypes/StyleSheetPropType.js index 4009dbd8..f2e26ed1 100644 --- a/src/propTypes/StyleSheetPropType.js +++ b/src/propTypes/StyleSheetPropType.js @@ -6,8 +6,8 @@ */ function StyleSheetPropType(shape: { [key: string]: ReactPropsCheckType }): ReactPropsCheckType { - const createStrictShapeTypeChecker = require('./createStrictShapeTypeChecker'); - const StyleSheet = require('../apis/StyleSheet'); + const createStrictShapeTypeChecker = require('./createStrictShapeTypeChecker').default; + const StyleSheet = require('../apis/StyleSheet').default; const shapePropType = createStrictShapeTypeChecker(shape); return function(props, propName, componentName, location?, ...rest) { @@ -21,4 +21,4 @@ function StyleSheetPropType(shape: { [key: string]: ReactPropsCheckType }): Reac }; } -module.exports = StyleSheetPropType; +export default StyleSheetPropType; diff --git a/src/propTypes/TransformPropTypes.js b/src/propTypes/TransformPropTypes.js index 16a0f774..667d3ee9 100644 --- a/src/propTypes/TransformPropTypes.js +++ b/src/propTypes/TransformPropTypes.js @@ -30,4 +30,4 @@ const TransformPropTypes = { transformOrigin: string }; -module.exports = TransformPropTypes; +export default TransformPropTypes; diff --git a/src/propTypes/createStrictShapeTypeChecker.js b/src/propTypes/createStrictShapeTypeChecker.js index b859f0f6..b25811e7 100644 --- a/src/propTypes/createStrictShapeTypeChecker.js +++ b/src/propTypes/createStrictShapeTypeChecker.js @@ -72,4 +72,4 @@ function createStrictShapeTypeChecker(shapeTypes: { return chainedCheckType; } -module.exports = createStrictShapeTypeChecker; +export default createStrictShapeTypeChecker; diff --git a/src/vendor/PooledClass/index.js b/src/vendor/PooledClass/index.js index cf233064..923cbdef 100644 --- a/src/vendor/PooledClass/index.js +++ b/src/vendor/PooledClass/index.js @@ -9,7 +9,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -var invariant = require('fbjs/lib/invariant'); +import invariant from 'fbjs/lib/invariant'; var twoArgumentPooler = function(a1, a2) { var Klass = this; @@ -60,4 +60,4 @@ var PooledClass = { twoArgumentPooler: twoArgumentPooler }; -module.exports = PooledClass; +export default PooledClass; diff --git a/src/vendor/TouchHistoryMath/index.js b/src/vendor/TouchHistoryMath/index.js index 1e38005e..0a30cfbb 100644 --- a/src/vendor/TouchHistoryMath/index.js +++ b/src/vendor/TouchHistoryMath/index.js @@ -119,4 +119,4 @@ var TouchHistoryMath = { noCentroid: -1 }; -module.exports = TouchHistoryMath; +export default TouchHistoryMath; diff --git a/src/vendor/setValueForStyles/index.js b/src/vendor/setValueForStyles/index.js index 5ae12f03..dbc9131e 100644 --- a/src/vendor/setValueForStyles/index.js +++ b/src/vendor/setValueForStyles/index.js @@ -10,8 +10,6 @@ * */ -'use strict'; - import unitlessNumbers from '../../modules/unitlessNumbers'; if (process.env.NODE_ENV !== 'production') { @@ -235,4 +233,4 @@ const setValueForStyles = function(node, styles, component) { } }; -module.exports = setValueForStyles; +export default setValueForStyles;