Skip to content

Commit

Permalink
Removed deprecated RCT_EXPORT + code paths
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jun 5, 2015
1 parent f90fa53 commit 45d8fb0
Show file tree
Hide file tree
Showing 27 changed files with 235 additions and 431 deletions.
2 changes: 1 addition & 1 deletion Examples/Movies/SearchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ var SearchScreen = React.createClass({
renderRow={this.renderRow}
onEndReached={this.onEndReached}
automaticallyAdjustContentInsets={false}
keyboardDismissMode="onDrag"
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps={true}
showsVerticalScrollIndicator={false}
/>;
Expand Down
22 changes: 11 additions & 11 deletions Examples/UIExplorer/StatusBarIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ exports.examples = [{
render() {
return (
<View>
{Object.keys(StatusBarIOS.Style).map((key) =>
{['default', 'light-content'].map((style) =>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setStyle(StatusBarIOS.Style[key])}>
onPress={() => StatusBarIOS.setStyle(style)}>
<View style={styles.button}>
<Text>setStyle(StatusBarIOS.Style.{key})</Text>
<Text>setStyle('{style}')</Text>
</View>
</TouchableHighlight>
)}
Expand All @@ -48,11 +48,11 @@ exports.examples = [{
render() {
return (
<View>
{Object.keys(StatusBarIOS.Style).map((key) =>
{['default', 'light-content'].map((style) =>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setStyle(StatusBarIOS.Style[key], true)}>
onPress={() => StatusBarIOS.setStyle(style, true)}>
<View style={styles.button}>
<Text>setStyle(StatusBarIOS.Style.{key}, true)</Text>
<Text>setStyle('{style}', true)</Text>
</View>
</TouchableHighlight>
)}
Expand All @@ -64,18 +64,18 @@ exports.examples = [{
render() {
return (
<View>
{Object.keys(StatusBarIOS.Animation).map((key) =>
{['none', 'fade', 'slide'].map((animation) =>
<View>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setHidden(true, StatusBarIOS.Animation[key])}>
onPress={() => StatusBarIOS.setHidden(true, animation)}>
<View style={styles.button}>
<Text>setHidden(true, StatusBarIOS.Animation.{key})</Text>
<Text>setHidden(true, '{animation}')</Text>
</View>
</TouchableHighlight>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setHidden(false, StatusBarIOS.Animation[key])}>
onPress={() => StatusBarIOS.setHidden(false, animation)}>
<View style={styles.button}>
<Text>setHidden(false, StatusBarIOS.Animation.{key})</Text>
<Text>setHidden(false, '{animation}')</Text>
</View>
</TouchableHighlight>
</View>
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class UIExplorerList extends React.Component {
renderSectionHeader={this._renderSectionHeader}
keyboardShouldPersistTaps={true}
automaticallyAdjustContentInsets={false}
keyboardDismissMode="onDrag"
keyboardDismissMode="on-drag"
/>
</View>
);
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Components/DatePicker/DatePickerIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ var DatePickerIOS = React.createClass({
<View style={props.style}>
<RCTDatePickerIOS
ref={DATEPICKER}
style={styles.rkDatePickerIOS}
style={styles.datePickerIOS}
date={props.date.getTime()}
maximumDate={
props.maximumDate ? props.maximumDate.getTime() : undefined
}
minimumDate={
props.minimumDate ? props.minimumDate.getTime() : undefined
}
mode={RCTDatePickerIOSConsts.DatePickerModes[props.mode]}
mode={props.mode}
minuteInterval={props.minuteInterval}
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
onChange={this._onChange}
Expand All @@ -139,7 +139,7 @@ var DatePickerIOS = React.createClass({
});

var styles = StyleSheet.create({
rkDatePickerIOS: {
datePickerIOS: {
height: RCTDatePickerIOSConsts.ComponentHeight,
width: RCTDatePickerIOSConsts.ComponentWidth,
},
Expand Down
8 changes: 1 addition & 7 deletions Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,7 @@ var styles = StyleSheet.create({

var RCTProgressView = requireNativeComponent(
'RCTProgressView',
null
ProgressViewIOS
);
if (__DEV__) {
verifyPropTypes(
RCTProgressView,
RCTProgressView.viewConfig
);
}

module.exports = ProgressViewIOS;
20 changes: 9 additions & 11 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ var PropTypes = React.PropTypes;
var SCROLLVIEW = 'ScrollView';
var INNERVIEW = 'InnerScrollView';

var keyboardDismissModeConstants = {
'none': RCTScrollViewConsts.KeyboardDismissMode.None, // default
'interactive': RCTScrollViewConsts.KeyboardDismissMode.Interactive,
'onDrag': RCTScrollViewConsts.KeyboardDismissMode.OnDrag,
};

/**
* Component that wraps platform ScrollView while providing
* integration with touch locking "responder" system.
Expand Down Expand Up @@ -147,7 +141,7 @@ var ScrollView = React.createClass({
keyboardDismissMode: PropTypes.oneOf([
'none', // default
'interactive',
'onDrag',
'on-drag',
]),
/**
* When false, tapping outside of the focused text input when the keyboard
Expand Down Expand Up @@ -287,9 +281,6 @@ var ScrollView = React.createClass({
...this.props,
alwaysBounceHorizontal,
alwaysBounceVertical,
keyboardDismissMode: this.props.keyboardDismissMode ?
keyboardDismissModeConstants[this.props.keyboardDismissMode] :
undefined,
style: ([styles.base, this.props.style]: ?Array<any>),
onTouchStart: this.scrollResponderHandleTouchStart,
onTouchMove: this.scrollResponderHandleTouchMove,
Expand All @@ -308,7 +299,7 @@ var ScrollView = React.createClass({
onResponderRelease: this.scrollResponderHandleResponderRelease,
onResponderReject: this.scrollResponderHandleResponderReject,
};

var ScrollViewClass;
if (Platform.OS === 'ios') {
ScrollViewClass = RCTScrollView;
Expand All @@ -318,6 +309,13 @@ var ScrollView = React.createClass({
} else {
ScrollViewClass = AndroidScrollView;
}
var keyboardDismissModeConstants = {
'none': RCTScrollViewConsts.KeyboardDismissMode.None, // default
'interactive': RCTScrollViewConsts.KeyboardDismissMode.Interactive,
'on-drag': RCTScrollViewConsts.KeyboardDismissMode.OnDrag,
};
props.keyboardDismissMode = props.keyboardDismissMode ?
keyboardDismissModeConstants[props.keyboardDismissMode] : undefined;
}
invariant(
ScrollViewClass !== undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,7 @@ var styles = StyleSheet.create({

var RCTSegmentedControl = requireNativeComponent(
'RCTSegmentedControl',
null
SegmentedControlIOS
);
if (__DEV__) {
verifyPropTypes(
RCTSegmentedControl,
RCTSegmentedControl.viewConfig
);
}

module.exports = SegmentedControlIOS;
26 changes: 13 additions & 13 deletions Libraries/Components/StatusBar/StatusBarIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@

var RCTStatusBarManager = require('NativeModules').StatusBarManager;

var StatusBarIOS = {
type StatusBarStyle = $Enum<{
'default': string,
'light-content': string,
}>;

Style: {
default: RCTStatusBarManager.Style.default,
lightContent: RCTStatusBarManager.Style.lightContent
},
type StatusBarAnimation = $Enum<{
'none': string,
'fade': string,
'slide': string,
}>;

Animation: {
none: RCTStatusBarManager.Animation.none,
fade: RCTStatusBarManager.Animation.fade,
slide: RCTStatusBarManager.Animation.slide,
},
var StatusBarIOS = {

setStyle(style: number, animated?: boolean) {
setStyle(style: StatusBarStyle, animated?: boolean) {
animated = animated || false;
RCTStatusBarManager.setStyle(style, animated);
},

setHidden(hidden: boolean, animation: number) {
animation = animation || StatusBarIOS.Animation.none;
setHidden(hidden: boolean, animation?: StatusBarAnimation) {
animation = animation || 'none';
RCTStatusBarManager.setHidden(hidden, animation);
},
};
Expand Down
79 changes: 18 additions & 61 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ var emptyFunction = require('emptyFunction');
var invariant = require('invariant');
var merge = require('merge');

var autoCapitalizeConsts = RCTUIManager.UIText.AutocapitalizationType;
var keyboardTypeConsts = RCTUIManager.UIKeyboardType;
var returnKeyTypeConsts = RCTUIManager.UIReturnKeyType;

var RCTTextViewAttributes = merge(ReactNativeViewAttributes.UIView, {
autoCorrect: true,
autoCapitalize: true,
Expand Down Expand Up @@ -96,10 +92,6 @@ var viewConfigAndroid = {
validAttributes: AndroidTextInputAttributes,
};

var crossPlatformKeyboardTypeMap = {
'numeric': 'decimal-pad',
};

type DefaultProps = {
bufferDelay: number;
};
Expand Down Expand Up @@ -171,8 +163,11 @@ var TextInput = React.createClass({
* Determines which keyboard to open, e.g.`numeric`.
*/
keyboardType: PropTypes.oneOf([
'default',
// iOS
// Cross-platform
'default',
'numeric',
'email-address',
// iOS-only
'ascii-capable',
'numbers-and-punctuation',
'url',
Expand All @@ -182,9 +177,6 @@ var TextInput = React.createClass({
'decimal-pad',
'twitter',
'web-search',
// Cross-platform
'numeric',
'email-address',
]),
/**
* Determines how the return key should look.
Expand Down Expand Up @@ -426,18 +418,12 @@ var TextInput = React.createClass({
_renderIOS: function() {
var textContainer;

var autoCapitalize = autoCapitalizeConsts[this.props.autoCapitalize];
var clearButtonMode = RCTUIManager.UITextField.clearButtonMode[this.props.clearButtonMode];

var keyboardType = keyboardTypeConsts[
crossPlatformKeyboardTypeMap[this.props.keyboardType] ||
this.props.keyboardType
];
var returnKeyType = returnKeyTypeConsts[this.props.returnKeyType];
var props = this.props;
props.style = [styles.input, this.props.style];

if (!this.props.multiline) {
if (!props.multiline) {
for (var propKey in onlyMultiline) {
if (this.props[propKey]) {
if (props[propKey]) {
throw new Error(
'TextInput prop `' + propKey + '` is only supported with multiline.'
);
Expand All @@ -446,92 +432,63 @@ var TextInput = React.createClass({
textContainer =
<RCTTextField
ref="input"
style={[styles.input, this.props.style]}
enabled={this.props.editable}
keyboardType={keyboardType}
returnKeyType={returnKeyType}
enablesReturnKeyAutomatically={this.props.enablesReturnKeyAutomatically}
secureTextEntry={this.props.password || this.props.secureTextEntry}
{...props}
onFocus={this._onFocus}
onBlur={this._onBlur}
onChange={this._onChange}
onEndEditing={this.props.onEndEditing}
onSubmitEditing={this.props.onSubmitEditing}
onSelectionChangeShouldSetResponder={() => true}
onLayout={this.props.onLayout}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
text={this.state.bufferedValue}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
clearButtonMode={clearButtonMode}
clearTextOnFocus={this.props.clearTextOnFocus}
selectTextOnFocus={this.props.selectTextOnFocus}
/>;
} else {
for (var propKey in notMultiline) {
if (this.props[propKey]) {
if (props[propKey]) {
throw new Error(
'TextInput prop `' + propKey + '` cannot be used with multiline.'
);
}
}

var children = this.props.children;
var children = props.children;
var childCount = 0;
ReactChildren.forEach(children, () => ++childCount);
invariant(
!(this.props.value && childCount),
!(props.value && childCount),
'Cannot specify both value and children.'
);
if (childCount > 1) {
children = <Text>{children}</Text>;
}
if (this.props.inputView) {
children = [children, this.props.inputView];
if (props.inputView) {
children = [children, props.inputView];
}
textContainer =
<RCTTextView
ref="input"
style={[styles.input, this.props.style]}
{...props}
children={children}
mostRecentEventCounter={this.state.mostRecentEventCounter}
editable={this.props.editable}
keyboardType={keyboardType}
returnKeyType={returnKeyType}
enablesReturnKeyAutomatically={this.props.enablesReturnKeyAutomatically}
secureTextEntry={this.props.password || this.props.secureTextEntry}
onFocus={this._onFocus}
onBlur={this._onBlur}
onChange={this._onChange}
onEndEditing={this.props.onEndEditing}
onSelectionChange={this._onSelectionChange}
onTextInput={this._onTextInput}
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
onLayout={this.props.onLayout}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
text={this.state.bufferedValue}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
clearButtonMode={clearButtonMode}
selectTextOnFocus={this.props.selectTextOnFocus}
clearTextOnFocus={this.props.clearTextOnFocus}
/>;
}

return (
<TouchableWithoutFeedback
onPress={this._onPress}
rejectResponderTermination={true}
testID={this.props.testID}>
testID={props.testID}>
{textContainer}
</TouchableWithoutFeedback>
);
},

_renderAndroid: function() {
var autoCapitalize = autoCapitalizeConsts[this.props.autoCapitalize];
var autoCapitalize = RCTUIManager.UIText.AutocapitalizationType[this.props.autoCapitalize];
var children = this.props.children;
var childCount = 0;
ReactChildren.forEach(children, () => ++childCount);
Expand Down
Loading

0 comments on commit 45d8fb0

Please sign in to comment.