mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-30 23:23:35 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
701ecb7c52 | ||
|
|
75042093c2 | ||
|
|
bb417900a9 | ||
|
|
89e0a15d1b | ||
|
|
b2e0a3702f | ||
|
|
a4644c204d | ||
|
|
1e9536b611 | ||
|
|
d15dafc108 | ||
|
|
c9c1aab97e | ||
|
|
a2903f9d30 | ||
|
|
c7771ac64f | ||
|
|
c8129c2a99 | ||
|
|
b793737393 |
@@ -2,11 +2,19 @@ import { Linking, StyleSheet, Text, View } from 'react-native'
|
||||
import React, { Component } from 'react';
|
||||
import { storiesOf, action } from '@kadira/storybook';
|
||||
|
||||
const url = 'https://mathiasbynens.github.io/rel-noopener/malicious.html';
|
||||
|
||||
class LinkingExample extends Component {
|
||||
handlePress() {
|
||||
Linking.canOpenURL(url).then((supported) => {
|
||||
return Linking.openURL(url);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text onPress={() => { Linking.openURL('https://mathiasbynens.github.io/rel-noopener/malicious.html'); }} style={styles.text}>
|
||||
<Text onPress={this.handlePress} style={styles.text}>
|
||||
Linking.openURL (Expect: "The previous tab is safe and intact")
|
||||
</Text>
|
||||
<Text accessibilityRole='link' href='https://mathiasbynens.github.io/rel-noopener/malicious.html' style={styles.text} target='_blank'>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-web",
|
||||
"version": "0.0.69",
|
||||
"version": "0.0.71",
|
||||
"description": "React Native for Web",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
@@ -41,7 +41,7 @@
|
||||
"babel-core": "^6.21.0",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-loader": "^6.2.10",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.2.11",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.3.0",
|
||||
"babel-preset-react-native": "^1.9.1",
|
||||
"del-cli": "^0.2.1",
|
||||
"enzyme": "^2.4.1",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { Component } from 'react';
|
||||
import invariant from 'fbjs/lib/invariant';
|
||||
import { unmountComponentAtNode } from 'react-dom/lib/ReactMount';
|
||||
import { unmountComponentAtNode } from 'react-dom';
|
||||
import renderApplication, { getApplication } from './renderApplication';
|
||||
|
||||
const emptyObject = {};
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
const Linking = {
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
canOpenURL() { return true; },
|
||||
getInitialURL() { return ''; },
|
||||
canOpenURL() {
|
||||
return Promise.resolve(true);
|
||||
},
|
||||
getInitialURL() {
|
||||
return Promise.resolve('');
|
||||
},
|
||||
openURL(url) {
|
||||
iframeOpen(url);
|
||||
try {
|
||||
iframeOpen(url);
|
||||
return Promise.resolve();
|
||||
} catch (e) {
|
||||
return Promise.reject(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,9 +3,14 @@ import CSSPropertyOperations from 'react-dom/lib/CSSPropertyOperations';
|
||||
|
||||
const getRect = (node) => {
|
||||
const height = node.offsetHeight;
|
||||
const left = node.offsetLeft;
|
||||
const top = node.offsetTop;
|
||||
const width = node.offsetWidth;
|
||||
let left = 0;
|
||||
let top = 0;
|
||||
while (node && node.nodeType === 1 /* Node.ELEMENT_NODE */) {
|
||||
left += node.offsetLeft;
|
||||
top += node.offsetTop;
|
||||
node = node.offsetParent;
|
||||
}
|
||||
return { height, left, top, width };
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import applyNativeMethods from '../../modules/applyNativeMethods';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
class ActivityIndicator extends Component {
|
||||
static displayName = 'ActivityIndicator';
|
||||
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
animating: PropTypes.bool,
|
||||
color: PropTypes.string,
|
||||
hidesWhenStopped: PropTypes.bool,
|
||||
|
||||
@@ -3,13 +3,15 @@ import ColorPropType from '../../propTypes/ColorPropType';
|
||||
import ImageResizeMode from './ImageResizeMode';
|
||||
import LayoutPropTypes from '../../propTypes/LayoutPropTypes';
|
||||
import { PropTypes } from 'react';
|
||||
import ShadowPropTypes from '../../propTypes/ShadowPropTypes';
|
||||
import TransformPropTypes from '../../propTypes/TransformPropTypes';
|
||||
|
||||
const hiddenOrVisible = PropTypes.oneOf([ 'hidden', 'visible' ]);
|
||||
|
||||
module.exports = process.env.NODE_ENV !== 'production' ? {
|
||||
module.exports = {
|
||||
...BorderPropTypes,
|
||||
...LayoutPropTypes,
|
||||
...ShadowPropTypes,
|
||||
...TransformPropTypes,
|
||||
backfaceVisibility: hiddenOrVisible,
|
||||
backgroundColor: ColorPropType,
|
||||
@@ -24,4 +26,4 @@ module.exports = process.env.NODE_ENV !== 'production' ? {
|
||||
* @platform web
|
||||
*/
|
||||
visibility: hiddenOrVisible
|
||||
} : {};
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import requestAnimationFrame from 'fbjs/lib/requestAnimationFrame';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
const emptyObject = {};
|
||||
@@ -41,7 +42,7 @@ class Image extends Component {
|
||||
static displayName = 'Image';
|
||||
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
children: PropTypes.any,
|
||||
defaultSource: ImageSourcePropType,
|
||||
onError: PropTypes.func,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import ListViewDataSource from './ListViewDataSource';
|
||||
import { PropTypes } from 'react';
|
||||
import ScrollView from '../ScrollView';
|
||||
import { propTypes as ScrollViewPropTypes } from '../ScrollView';
|
||||
|
||||
export default {
|
||||
...ScrollView.propTypes,
|
||||
...ScrollViewPropTypes,
|
||||
dataSource: PropTypes.instanceOf(ListViewDataSource).isRequired,
|
||||
renderSeparator: PropTypes.func,
|
||||
renderRow: PropTypes.func.isRequired,
|
||||
|
||||
@@ -2,13 +2,14 @@ import applyNativeMethods from '../../modules/applyNativeMethods';
|
||||
import ColorPropType from '../../propTypes/ColorPropType';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
class ProgressBar extends Component {
|
||||
static displayName = 'ProgressBar';
|
||||
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
color: ColorPropType,
|
||||
indeterminate: PropTypes.bool,
|
||||
progress: PropTypes.number,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import debounce from 'debounce';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
const normalizeScrollEvent = (e) => ({
|
||||
@@ -36,7 +37,8 @@ const normalizeScrollEvent = (e) => ({
|
||||
return e.target.offsetWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
timeStamp: Date.now()
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -44,7 +46,7 @@ const normalizeScrollEvent = (e) => ({
|
||||
*/
|
||||
export default class ScrollViewBase extends Component {
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
onMomentumScrollBegin: PropTypes.func,
|
||||
onMomentumScrollEnd: PropTypes.func,
|
||||
onScroll: PropTypes.func,
|
||||
|
||||
@@ -14,6 +14,7 @@ import ScrollViewBase from './ScrollViewBase';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import ViewStylePropTypes from '../View/ViewStylePropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
@@ -22,7 +23,7 @@ const emptyObject = {};
|
||||
/* eslint-disable react/prefer-es6-class */
|
||||
const ScrollView = React.createClass({
|
||||
propTypes: {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
contentContainerStyle: StyleSheetPropType(ViewStylePropTypes),
|
||||
horizontal: PropTypes.bool,
|
||||
keyboardDismissMode: PropTypes.oneOf([ 'none', 'interactive', 'on-drag' ]),
|
||||
|
||||
@@ -5,6 +5,7 @@ import multiplyStyleLengthValue from '../../modules/multiplyStyleLengthValue';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import UIManager from '../../apis/UIManager';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
const emptyObject = {};
|
||||
@@ -15,7 +16,7 @@ class Switch extends Component {
|
||||
static displayName = 'Switch';
|
||||
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
activeThumbColor: ColorPropType,
|
||||
activeTrackColor: ColorPropType,
|
||||
disabled: PropTypes.bool,
|
||||
|
||||
@@ -1,7 +1,45 @@
|
||||
import TextPropTypes from '../../propTypes/TextPropTypes';
|
||||
import ColorPropType from '../../propTypes/ColorPropType';
|
||||
import { PropTypes } from 'react';
|
||||
import ViewStylePropTypes from '../View/ViewStylePropTypes';
|
||||
|
||||
module.exports = process.env.NODE_ENV !== 'production' ? {
|
||||
const { number, oneOf, oneOfType, shape, string } = PropTypes;
|
||||
const numberOrString = oneOfType([ number, string ]);
|
||||
|
||||
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 = {
|
||||
color: ColorPropType,
|
||||
fontFamily: string,
|
||||
fontSize: numberOrString,
|
||||
fontStyle: string,
|
||||
fontWeight: string,
|
||||
letterSpacing: numberOrString,
|
||||
lineHeight: numberOrString,
|
||||
textAlign: TextAlignPropType,
|
||||
textAlignVertical: oneOf([ 'auto', 'bottom', 'center', 'top' ]),
|
||||
textDecorationLine: string,
|
||||
textShadowColor: ColorPropType,
|
||||
textShadowOffset: ShadowOffsetPropType,
|
||||
textShadowRadius: number,
|
||||
writingDirection: WritingDirectionPropType,
|
||||
/* @platform web */
|
||||
textOverflow: string,
|
||||
textRendering: oneOf([ 'auto', 'geometricPrecision', 'optimizeLegibility', 'optimizeSpeed' ]),
|
||||
textTransform: oneOf([ 'capitalize', 'lowercase', 'none', 'uppercase' ]),
|
||||
unicodeBidi: oneOf([ 'normal', 'bidi-override', 'embed', 'isolate', 'isolate-override', 'plaintext' ]),
|
||||
whiteSpace: string,
|
||||
wordWrap: string,
|
||||
MozOsxFontSmoothing: string,
|
||||
WebkitFontSmoothing: string,
|
||||
// opt-out of RTL flipping
|
||||
textAlign$noI18n: TextAlignPropType,
|
||||
textShadowOffset$noI18n: ShadowOffsetPropType,
|
||||
writingDirection$noI18n: WritingDirectionPropType
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
...ViewStylePropTypes,
|
||||
...TextPropTypes
|
||||
} : {};
|
||||
...TextOnlyStylePropTypes
|
||||
};
|
||||
|
||||
@@ -4,10 +4,11 @@ import NativeMethodsMixin from '../../modules/NativeMethodsMixin';
|
||||
import createDOMElement from '../../modules/createDOMElement';
|
||||
import findNodeHandle from '../../modules/findNodeHandle';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import Text from '../Text';
|
||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||
import TextStylePropTypes from '../Text/TextStylePropTypes';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import TextInputState from './TextInputState';
|
||||
import View from '../View';
|
||||
import ViewPropTypes from '../View/ViewPropTypes';
|
||||
import { Component, PropTypes } from 'react';
|
||||
|
||||
const emptyObject = {};
|
||||
@@ -52,7 +53,7 @@ class TextInput extends Component {
|
||||
static displayName = 'TextInput';
|
||||
|
||||
static propTypes = {
|
||||
...View.propTypes,
|
||||
...ViewPropTypes,
|
||||
autoCapitalize: PropTypes.oneOf([ 'characters', 'none', 'sentences', 'words' ]),
|
||||
autoComplete: PropTypes.string,
|
||||
autoCorrect: PropTypes.bool,
|
||||
@@ -83,7 +84,7 @@ class TextInput extends Component {
|
||||
start: PropTypes.number.isRequired,
|
||||
end: PropTypes.number
|
||||
}),
|
||||
style: Text.propTypes.style,
|
||||
style: StyleSheetPropType(TextStylePropTypes),
|
||||
value: PropTypes.string
|
||||
};
|
||||
|
||||
@@ -99,6 +100,8 @@ class TextInput extends Component {
|
||||
style: emptyObject
|
||||
};
|
||||
|
||||
static State = TextInputState;
|
||||
|
||||
blur() {
|
||||
TextInputState.blurTextInput(this._node);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ var ViewStylePropTypes = require('../View/ViewStylePropTypes');
|
||||
|
||||
var ensureComponentIsNative = require('./ensureComponentIsNative');
|
||||
var ensurePositiveDelayProps = require('./ensurePositiveDelayProps');
|
||||
var TouchableWithoutFeedbackPropTypes = TouchableWithoutFeedback.propTypes
|
||||
|
||||
type Event = Object;
|
||||
|
||||
@@ -67,7 +68,7 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
var TouchableHighlight = React.createClass({
|
||||
propTypes: {
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
...TouchableWithoutFeedbackPropTypes,
|
||||
/**
|
||||
* Determines what the opacity of the wrapped view should be when touch is
|
||||
* active.
|
||||
|
||||
@@ -24,6 +24,7 @@ var View = require('../View');
|
||||
|
||||
var ensurePositiveDelayProps = require('./ensurePositiveDelayProps');
|
||||
var flattenStyle = StyleSheet.flatten
|
||||
var TouchableWithoutFeedbackPropTypes = TouchableWithoutFeedback.propTypes;
|
||||
|
||||
type Event = Object;
|
||||
|
||||
@@ -54,7 +55,7 @@ var TouchableOpacity = React.createClass({
|
||||
mixins: [TimerMixin, Touchable.Mixin, NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
...TouchableWithoutFeedbackPropTypes,
|
||||
/**
|
||||
* Determines what the opacity of the wrapped view should be when touch is
|
||||
* active.
|
||||
|
||||
37
src/components/View/ViewPropTypes.js
Normal file
37
src/components/View/ViewPropTypes.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import BaseComponentPropTypes from '../../propTypes/BaseComponentPropTypes';
|
||||
import EdgeInsetsPropType from '../../propTypes/EdgeInsetsPropType';
|
||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||
import ViewStylePropTypes from './ViewStylePropTypes';
|
||||
import { PropTypes } from 'react';
|
||||
|
||||
const ViewPropTypes = {
|
||||
...BaseComponentPropTypes,
|
||||
children: PropTypes.any,
|
||||
collapsable: PropTypes.bool,
|
||||
hitSlop: EdgeInsetsPropType,
|
||||
onClick: PropTypes.func,
|
||||
onClickCapture: PropTypes.func,
|
||||
onLayout: PropTypes.func,
|
||||
onMoveShouldSetResponder: PropTypes.func,
|
||||
onMoveShouldSetResponderCapture: PropTypes.func,
|
||||
onResponderGrant: PropTypes.func,
|
||||
onResponderMove: PropTypes.func,
|
||||
onResponderReject: PropTypes.func,
|
||||
onResponderRelease: PropTypes.func,
|
||||
onResponderTerminate: PropTypes.func,
|
||||
onResponderTerminationRequest: PropTypes.func,
|
||||
onStartShouldSetResponder: PropTypes.func,
|
||||
onStartShouldSetResponderCapture: PropTypes.func,
|
||||
onTouchCancel: PropTypes.func,
|
||||
onTouchCancelCapture: PropTypes.func,
|
||||
onTouchEnd: PropTypes.func,
|
||||
onTouchEndCapture: PropTypes.func,
|
||||
onTouchMove: PropTypes.func,
|
||||
onTouchMoveCapture: PropTypes.func,
|
||||
onTouchStart: PropTypes.func,
|
||||
onTouchStartCapture: PropTypes.func,
|
||||
pointerEvents: PropTypes.oneOf([ 'auto', 'box-none', 'box-only', 'none' ]),
|
||||
style: StyleSheetPropType(ViewStylePropTypes)
|
||||
};
|
||||
|
||||
module.exports = ViewPropTypes;
|
||||
@@ -10,7 +10,7 @@ const { number, oneOf, string } = PropTypes;
|
||||
const autoOrHiddenOrVisible = oneOf([ 'auto', 'hidden', 'visible' ]);
|
||||
const hiddenOrVisible = oneOf([ 'hidden', 'visible' ]);
|
||||
|
||||
module.exports = process.env.NODE_ENV !== 'production' ? {
|
||||
module.exports = {
|
||||
...AnimationPropTypes,
|
||||
...BorderPropTypes,
|
||||
...LayoutPropTypes,
|
||||
@@ -45,5 +45,6 @@ module.exports = process.env.NODE_ENV !== 'production' ? {
|
||||
transitionTimingFunction: string,
|
||||
userSelect: string,
|
||||
visibility: hiddenOrVisible,
|
||||
WebkitOverflowScrolling: oneOf([ 'auto', 'touch' ])
|
||||
} : {};
|
||||
WebkitOverflowScrolling: oneOf([ 'auto', 'touch' ]),
|
||||
willChange: string
|
||||
};
|
||||
|
||||
@@ -2,13 +2,10 @@ import '../../modules/injectResponderEventPlugin';
|
||||
|
||||
import applyLayout from '../../modules/applyLayout';
|
||||
import applyNativeMethods from '../../modules/applyNativeMethods';
|
||||
import BaseComponentPropTypes from '../../propTypes/BaseComponentPropTypes';
|
||||
import createDOMElement from '../../modules/createDOMElement';
|
||||
import EdgeInsetsPropType from '../../propTypes/EdgeInsetsPropType';
|
||||
import normalizeNativeEvent from '../../modules/normalizeNativeEvent';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||
import ViewStylePropTypes from './ViewStylePropTypes';
|
||||
import ViewPropTypes from './ViewPropTypes';
|
||||
import { Component, PropTypes } from 'react';
|
||||
|
||||
const eventHandlerNames = [
|
||||
@@ -37,35 +34,7 @@ const eventHandlerNames = [
|
||||
class View extends Component {
|
||||
static displayName = 'View';
|
||||
|
||||
static propTypes = {
|
||||
...BaseComponentPropTypes,
|
||||
children: PropTypes.any,
|
||||
collapsable: PropTypes.bool,
|
||||
hitSlop: EdgeInsetsPropType,
|
||||
onClick: PropTypes.func,
|
||||
onClickCapture: PropTypes.func,
|
||||
onLayout: PropTypes.func,
|
||||
onMoveShouldSetResponder: PropTypes.func,
|
||||
onMoveShouldSetResponderCapture: PropTypes.func,
|
||||
onResponderGrant: PropTypes.func,
|
||||
onResponderMove: PropTypes.func,
|
||||
onResponderReject: PropTypes.func,
|
||||
onResponderRelease: PropTypes.func,
|
||||
onResponderTerminate: PropTypes.func,
|
||||
onResponderTerminationRequest: PropTypes.func,
|
||||
onStartShouldSetResponder: PropTypes.func,
|
||||
onStartShouldSetResponderCapture: PropTypes.func,
|
||||
onTouchCancel: PropTypes.func,
|
||||
onTouchCancelCapture: PropTypes.func,
|
||||
onTouchEnd: PropTypes.func,
|
||||
onTouchEndCapture: PropTypes.func,
|
||||
onTouchMove: PropTypes.func,
|
||||
onTouchMoveCapture: PropTypes.func,
|
||||
onTouchStart: PropTypes.func,
|
||||
onTouchStartCapture: PropTypes.func,
|
||||
pointerEvents: PropTypes.oneOf([ 'auto', 'box-none', 'box-only', 'none' ]),
|
||||
style: StyleSheetPropType(ViewStylePropTypes)
|
||||
};
|
||||
static propTypes = ViewPropTypes;
|
||||
|
||||
static defaultProps = {
|
||||
accessible: true
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import findNodeHandle from './modules/findNodeHandle';
|
||||
import ReactDefaultInjection from 'react-dom/lib/ReactDefaultInjection';
|
||||
import { render, unmountComponentAtNode } from 'react-dom/lib/ReactMount';
|
||||
|
||||
ReactDefaultInjection.inject();
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
|
||||
// APIs
|
||||
import I18nManager from './apis/I18nManager';
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import findNodeHandle from './modules/findNodeHandle';
|
||||
import ReactDefaultInjection from 'react-dom/lib/ReactDefaultInjection';
|
||||
import { render, unmountComponentAtNode } from 'react-dom/lib/ReactMount';
|
||||
|
||||
ReactDefaultInjection.inject();
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
|
||||
// APIs
|
||||
import Animated from './apis/Animated';
|
||||
|
||||
@@ -33,7 +33,7 @@ const applyLayout = (Component) => {
|
||||
if (layout.x !== x || layout.y !== y || layout.width !== width || layout.height !== height) {
|
||||
const nextLayout = { x, y, width, height };
|
||||
const nativeEvent = { layout: nextLayout };
|
||||
onLayout({ nativeEvent });
|
||||
onLayout({ nativeEvent, timeStamp: Date.now() });
|
||||
this._layoutState = nextLayout;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import findNodeHandle from 'react-dom/lib/findDOMNode';
|
||||
export default findNodeHandle;
|
||||
import { findDOMNode } from 'react-dom';
|
||||
export default findDOMNode;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { PropTypes } from 'react';
|
||||
|
||||
const { number, oneOf, oneOfType, string } = PropTypes;
|
||||
|
||||
const AnimationPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
const AnimationPropTypes = {
|
||||
animationDelay: string,
|
||||
animationDirection: oneOf([ 'alternate', 'alternate-reverse', 'normal', 'reverse' ]),
|
||||
animationDuration: string,
|
||||
@@ -11,6 +11,6 @@ const AnimationPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
animationName: string,
|
||||
animationPlayState: oneOf([ 'paused', 'running' ]),
|
||||
animationTimingFunction: string
|
||||
} : {};
|
||||
};
|
||||
|
||||
module.exports = AnimationPropTypes;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { PropTypes } from 'react';
|
||||
const { array, bool, number, object, oneOf, oneOfType, string } = PropTypes;
|
||||
|
||||
const BaseComponentPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
const BaseComponentPropTypes = {
|
||||
accessibilityLabel: string,
|
||||
accessibilityLiveRegion: oneOf([ 'assertive', 'off', 'polite' ]),
|
||||
accessibilityRole: string,
|
||||
accessible: bool,
|
||||
style: oneOfType([ array, number, object ]),
|
||||
testID: string
|
||||
} : {};
|
||||
};
|
||||
|
||||
module.exports = BaseComponentPropTypes;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { PropTypes } from 'react';
|
||||
const numberOrString = PropTypes.oneOfType([ PropTypes.number, PropTypes.string ]);
|
||||
const BorderStylePropType = PropTypes.oneOf([ 'solid', 'dotted', 'dashed' ]);
|
||||
|
||||
const BorderPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
const BorderPropTypes = {
|
||||
borderColor: ColorPropType,
|
||||
borderTopColor: ColorPropType,
|
||||
borderRightColor: ColorPropType,
|
||||
@@ -29,6 +29,6 @@ const BorderPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
borderBottomRightRadius$noI18n: numberOrString,
|
||||
borderLeftStyle$noI18n: BorderStylePropType,
|
||||
borderRightStyle$noI18n: BorderStylePropType
|
||||
} : {};
|
||||
};
|
||||
|
||||
module.exports = BorderPropTypes;
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
var PropTypes = require('react').PropTypes;
|
||||
|
||||
var EdgeInsetsPropType = process.env.NODE_ENV !== 'production' ? require('./createStrictShapeTypeChecker')({
|
||||
var EdgeInsetsPropType = require('./createStrictShapeTypeChecker')({
|
||||
top: PropTypes.number,
|
||||
left: PropTypes.number,
|
||||
bottom: PropTypes.number,
|
||||
right: PropTypes.number,
|
||||
}) : function () {};
|
||||
});
|
||||
|
||||
module.exports = EdgeInsetsPropType;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { PropTypes } from 'react';
|
||||
const { number, oneOf, oneOfType, string } = PropTypes;
|
||||
const numberOrString = oneOfType([ number, string ]);
|
||||
|
||||
const LayoutPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
const LayoutPropTypes = {
|
||||
// box model
|
||||
borderWidth: numberOrString,
|
||||
borderBottomWidth: numberOrString,
|
||||
@@ -58,6 +58,6 @@ const LayoutPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
paddingLeft$noI18n: numberOrString,
|
||||
paddingRight$noI18n: numberOrString,
|
||||
right$noI18n: numberOrString
|
||||
} : {};
|
||||
};
|
||||
|
||||
module.exports = LayoutPropTypes;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
var PropTypes = require('react').PropTypes;
|
||||
|
||||
var PointPropType = process.env.NODE_ENV !== 'production' ? require('./createStrictShapeTypeChecker')({
|
||||
var PointPropType = require('./createStrictShapeTypeChecker')({
|
||||
x: PropTypes.number,
|
||||
y: PropTypes.number,
|
||||
}) : function () {};
|
||||
});
|
||||
|
||||
module.exports = PointPropType;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
module.exports = process.env.NODE_ENV !== 'production' ? function StyleSheetPropType(shape) {
|
||||
module.exports = function StyleSheetPropType(shape) {
|
||||
const createStrictShapeTypeChecker = require('./createStrictShapeTypeChecker');
|
||||
const StyleSheet = require('../apis/StyleSheet');
|
||||
|
||||
@@ -19,4 +19,4 @@ module.exports = process.env.NODE_ENV !== 'production' ? function StyleSheetProp
|
||||
}
|
||||
return shapePropType(newProps, propName, componentName, location);
|
||||
};
|
||||
} : function () {};
|
||||
};
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import ColorPropType from './ColorPropType';
|
||||
import { PropTypes } from 'react';
|
||||
|
||||
const { number, oneOf, oneOfType, shape, string } = PropTypes;
|
||||
const numberOrString = oneOfType([ number, string ]);
|
||||
|
||||
const ShadowOffsetPropType = shape({ width: number, height: number });
|
||||
const TextAlignPropType = oneOf([ 'center', 'inherit', 'justify', 'justify-all', 'left', 'right' ]);
|
||||
const WritingDirectionPropType = oneOf([ 'auto', 'ltr', 'rtl' ]);
|
||||
|
||||
const TextPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
// box model
|
||||
color: ColorPropType,
|
||||
fontFamily: string,
|
||||
fontSize: numberOrString,
|
||||
fontStyle: string,
|
||||
fontWeight: string,
|
||||
letterSpacing: numberOrString,
|
||||
lineHeight: numberOrString,
|
||||
textAlign: TextAlignPropType,
|
||||
textAlignVertical: oneOf([ 'auto', 'bottom', 'center', 'top' ]),
|
||||
textDecorationLine: string,
|
||||
textShadowColor: ColorPropType,
|
||||
textShadowOffset: ShadowOffsetPropType,
|
||||
textShadowRadius: number,
|
||||
writingDirection: WritingDirectionPropType,
|
||||
/* @platform web */
|
||||
textOverflow: string,
|
||||
textRendering: oneOf([ 'auto', 'geometricPrecision', 'optimizeLegibility', 'optimizeSpeed' ]),
|
||||
textTransform: oneOf([ 'capitalize', 'lowercase', 'none', 'uppercase' ]),
|
||||
unicodeBidi: oneOf([ 'normal', 'bidi-override', 'embed', 'isolate', 'isolate-override', 'plaintext' ]),
|
||||
whiteSpace: string,
|
||||
wordWrap: string,
|
||||
MozOsxFontSmoothing: string,
|
||||
WebkitFontSmoothing: string,
|
||||
// opt-out of RTL flipping
|
||||
textAlign$noI18n: TextAlignPropType,
|
||||
textShadowOffset$noI18n: ShadowOffsetPropType,
|
||||
writingDirection$noI18n: WritingDirectionPropType
|
||||
} : {};
|
||||
|
||||
module.exports = TextPropTypes;
|
||||
@@ -10,7 +10,7 @@ import { PropTypes } from 'react';
|
||||
const { arrayOf, number, oneOfType, shape, string } = PropTypes;
|
||||
const numberOrString = oneOfType([ number, string ]);
|
||||
|
||||
const TransformPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
const TransformPropTypes = {
|
||||
transform: arrayOf(
|
||||
oneOfType([
|
||||
shape({ perspective: numberOrString }),
|
||||
@@ -30,6 +30,6 @@ const TransformPropTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
])
|
||||
),
|
||||
transformOrigin: string
|
||||
} : {};
|
||||
};
|
||||
|
||||
module.exports = TransformPropTypes;
|
||||
|
||||
@@ -2,12 +2,11 @@ const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
const SRC_DIRECTORY = './src'
|
||||
const DIST_DIRECTORY = './dist'
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
main: DIST_DIRECTORY
|
||||
},
|
||||
entry: SRC_DIRECTORY,
|
||||
externals: [
|
||||
{
|
||||
react: {
|
||||
@@ -18,6 +17,21 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
],
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: { cacheDirectory: true }
|
||||
},
|
||||
{
|
||||
test: /\.(gif|jpe?g|png|svg)$/,
|
||||
loader: 'url-loader',
|
||||
query: { name: '[name].[ext]' }
|
||||
}
|
||||
]
|
||||
},
|
||||
output: {
|
||||
filename: 'ReactNative.js',
|
||||
library: 'ReactNative',
|
||||
|
||||
@@ -895,9 +895,9 @@ babel-plugin-transform-react-jsx@^6.3.13, babel-plugin-transform-react-jsx@^6.5.
|
||||
babel-plugin-syntax-jsx "^6.8.0"
|
||||
babel-runtime "^6.0.0"
|
||||
|
||||
babel-plugin-transform-react-remove-prop-types:
|
||||
version "0.2.11"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.2.11.tgz#05eb7cc4670d6506d801680576589c7abcd51b00"
|
||||
babel-plugin-transform-react-remove-prop-types@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.3.0.tgz#88baefdb530c95c37c6e685f591e263db9fe5585"
|
||||
|
||||
babel-plugin-transform-regenerator@6.16.1, babel-plugin-transform-regenerator@^6.16.0, babel-plugin-transform-regenerator@^6.5.0, babel-plugin-transform-regenerator@^6.6.0:
|
||||
version "6.16.1"
|
||||
|
||||
Reference in New Issue
Block a user