Expose additional private modules

Summary: - TextInputState as TextInput.State
- Touchable
- flattenStyle as StyleSheet.flatten
- ReactNativeART as ART

Original discussion in #1821
Closes https://github.com/facebook/react-native/pull/3308

Reviewed By: sebmarkbage

Differential Revision: D2527152

Pulled By: javache

fb-gh-sync-id: 19d4ef9d4c0e6587b9f0793e1ca624aebb034f3b
This commit is contained in:
Brent Vatne 2015-11-05 03:31:11 -08:00 committed by facebook-github-bot-4
parent 7af752403e
commit 0da2004e88
6 changed files with 27 additions and 2 deletions

View File

@ -566,8 +566,14 @@ function Pattern(url, width, height, left, top) {
this._brush = [PATTERN, url, +left || 0, +top || 0, +width, +height]; this._brush = [PATTERN, url, +left || 0, +top || 0, +width, +height];
} }
var ReactART = { // This doesn't work on iOS and is just a placeholder to get Spectrum running.
// I will try to eliminate this dependency in Spectrum and remove it from
// ReactART proper.
function CSSBackgroundPattern() {
return new Color('rgba(0,0,0,0)');
}
var ReactART = {
LinearGradient: LinearGradient, LinearGradient: LinearGradient,
RadialGradient: RadialGradient, RadialGradient: RadialGradient,
Pattern: Pattern, Pattern: Pattern,
@ -578,7 +584,7 @@ var ReactART = {
ClippingRectangle: ClippingRectangle, ClippingRectangle: ClippingRectangle,
Shape: Shape, Shape: Shape,
Text: Text, Text: Text,
CSSBackgroundPattern: CSSBackgroundPattern
}; };
module.exports = ReactART; module.exports = ReactART;

View File

@ -86,6 +86,11 @@ type Event = Object;
* ``` * ```
*/ */
var TextInput = React.createClass({ var TextInput = React.createClass({
statics: {
/* TODO(brentvatne) docs are needed for this */
State: TextInputState,
},
propTypes: { propTypes: {
/** /**
* Can tell TextInput to automatically capitalize certain characters. * Can tell TextInput to automatically capitalize certain characters.

View File

@ -13,6 +13,7 @@
var StyleSheetRegistry = require('StyleSheetRegistry'); var StyleSheetRegistry = require('StyleSheetRegistry');
var StyleSheetValidation = require('StyleSheetValidation'); var StyleSheetValidation = require('StyleSheetValidation');
var flattenStyle = require('flattenStyle');
/** /**
* A StyleSheet is an abstraction similar to CSS StyleSheets * A StyleSheet is an abstraction similar to CSS StyleSheets
@ -59,6 +60,8 @@ var StyleSheetValidation = require('StyleSheetValidation');
* subsequent uses are going to refer an id (not implemented yet). * subsequent uses are going to refer an id (not implemented yet).
*/ */
class StyleSheet { class StyleSheet {
static flatten: typeof flattenStyle;
static create(obj: {[key: string]: any}): {[key: string]: number} { static create(obj: {[key: string]: any}): {[key: string]: number} {
var result = {}; var result = {};
for (var key in obj) { for (var key in obj) {
@ -69,4 +72,7 @@ class StyleSheet {
} }
} }
/* TODO(brentvatne) docs are needed for this */
StyleSheet.flatten = flattenStyle;
module.exports = StyleSheet; module.exports = StyleSheet;

View File

@ -20,6 +20,7 @@
var ReactNative = Object.assign(Object.create(require('React')), { var ReactNative = Object.assign(Object.create(require('React')), {
// Components // Components
ActivityIndicatorIOS: require('ActivityIndicatorIOS'), ActivityIndicatorIOS: require('ActivityIndicatorIOS'),
ART: require('ReactNativeART'),
DatePickerIOS: require('DatePickerIOS'), DatePickerIOS: require('DatePickerIOS'),
DrawerLayoutAndroid: require('DrawerLayoutAndroid'), DrawerLayoutAndroid: require('DrawerLayoutAndroid'),
Image: require('Image'), Image: require('Image'),
@ -43,6 +44,7 @@ var ReactNative = Object.assign(Object.create(require('React')), {
TextInput: require('TextInput'), TextInput: require('TextInput'),
ToastAndroid: require('ToastAndroid'), ToastAndroid: require('ToastAndroid'),
ToolbarAndroid: require('ToolbarAndroid'), ToolbarAndroid: require('ToolbarAndroid'),
Touchable: require('Touchable'),
TouchableHighlight: require('TouchableHighlight'), TouchableHighlight: require('TouchableHighlight'),
TouchableNativeFeedback: require('TouchableNativeFeedback'), TouchableNativeFeedback: require('TouchableNativeFeedback'),
TouchableOpacity: require('TouchableOpacity'), TouchableOpacity: require('TouchableOpacity'),

5
npm-shrinkwrap.json generated
View File

@ -7,6 +7,11 @@
"from": "absolute-path@0.0.0", "from": "absolute-path@0.0.0",
"resolved": "https://registry.npmjs.org/absolute-path/-/absolute-path-0.0.0.tgz" "resolved": "https://registry.npmjs.org/absolute-path/-/absolute-path-0.0.0.tgz"
}, },
"art": {
"version": "0.10.0",
"from": "art@0.10.0",
"resolved": "https://registry.npmjs.org/art/-/art-0.10.0.tgz"
},
"babel": { "babel": {
"version": "5.8.23", "version": "5.8.23",
"from": "babel@5.8.23", "from": "babel@5.8.23",

View File

@ -54,6 +54,7 @@
}, },
"dependencies": { "dependencies": {
"absolute-path": "^0.0.0", "absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel": "^5.8.23", "babel": "^5.8.23",
"babel-core": "^5.8.23", "babel-core": "^5.8.23",
"bser": "^1.0.2", "bser": "^1.0.2",