Skip to content

Commit

Permalink
Expose additional private modules
Browse files Browse the repository at this point in the history
Summary: - TextInputState as TextInput.State
- Touchable
- flattenStyle as StyleSheet.flatten
- ReactNativeART as ART

Original discussion in facebook#1821
Closes facebook#3308

Reviewed By: sebmarkbage

Differential Revision: D2527152

Pulled By: javache

fb-gh-sync-id: 19d4ef9d4c0e6587b9f0793e1ca624aebb034f3b
  • Loading branch information
brentvatne authored and Crash-- committed Dec 24, 2015
1 parent 39a4eab commit efae049
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Libraries/ART/ReactNativeART.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,14 @@ function Pattern(url, width, height, left, top) {
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,
RadialGradient: RadialGradient,
Pattern: Pattern,
Expand All @@ -578,7 +584,7 @@ var ReactART = {
ClippingRectangle: ClippingRectangle,
Shape: Shape,
Text: Text,

CSSBackgroundPattern: CSSBackgroundPattern
};

module.exports = ReactART;
5 changes: 5 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ type Event = Object;
* ```
*/
var TextInput = React.createClass({
statics: {
/* TODO(brentvatne) docs are needed for this */
State: TextInputState,
},

propTypes: {
/**
* Can tell TextInput to automatically capitalize certain characters.
Expand Down
6 changes: 6 additions & 0 deletions Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

var StyleSheetRegistry = require('StyleSheetRegistry');
var StyleSheetValidation = require('StyleSheetValidation');
var flattenStyle = require('flattenStyle');

/**
* A StyleSheet is an abstraction similar to CSS StyleSheets
Expand Down Expand Up @@ -59,6 +60,8 @@ var StyleSheetValidation = require('StyleSheetValidation');
* subsequent uses are going to refer an id (not implemented yet).
*/
class StyleSheet {
static flatten: typeof flattenStyle;

static create(obj: {[key: string]: any}): {[key: string]: number} {
var result = {};
for (var key in obj) {
Expand All @@ -69,4 +72,7 @@ class StyleSheet {
}
}

/* TODO(brentvatne) docs are needed for this */
StyleSheet.flatten = flattenStyle;

module.exports = StyleSheet;
2 changes: 2 additions & 0 deletions Libraries/react-native/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
var ReactNative = Object.assign(Object.create(require('React')), {
// Components
ActivityIndicatorIOS: require('ActivityIndicatorIOS'),
ART: require('ReactNativeART'),
DatePickerIOS: require('DatePickerIOS'),
DrawerLayoutAndroid: require('DrawerLayoutAndroid'),
Image: require('Image'),
Expand All @@ -43,6 +44,7 @@ var ReactNative = Object.assign(Object.create(require('React')), {
TextInput: require('TextInput'),
ToastAndroid: require('ToastAndroid'),
ToolbarAndroid: require('ToolbarAndroid'),
Touchable: require('Touchable'),
TouchableHighlight: require('TouchableHighlight'),
TouchableNativeFeedback: require('TouchableNativeFeedback'),
TouchableOpacity: require('TouchableOpacity'),
Expand Down
5 changes: 5 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"dependencies": {
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel": "^5.8.23",
"babel-core": "^5.8.23",
"bser": "^1.0.2",
Expand Down

0 comments on commit efae049

Please sign in to comment.