mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Removed deprecated RCT_EXPORT + code paths
This commit is contained in:
@@ -120,7 +120,7 @@ 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
|
||||
@@ -128,7 +128,7 @@ var DatePickerIOS = React.createClass({
|
||||
minimumDate={
|
||||
props.minimumDate ? props.minimumDate.getTime() : undefined
|
||||
}
|
||||
mode={RCTDatePickerIOSConsts.DatePickerModes[props.mode]}
|
||||
mode={props.mode}
|
||||
minuteInterval={props.minuteInterval}
|
||||
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
|
||||
onChange={this._onChange}
|
||||
@@ -139,7 +139,7 @@ var DatePickerIOS = React.createClass({
|
||||
});
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
rkDatePickerIOS: {
|
||||
datePickerIOS: {
|
||||
height: RCTDatePickerIOSConsts.ComponentHeight,
|
||||
width: RCTDatePickerIOSConsts.ComponentWidth,
|
||||
},
|
||||
|
||||
@@ -77,13 +77,7 @@ var styles = StyleSheet.create({
|
||||
|
||||
var RCTProgressView = requireNativeComponent(
|
||||
'RCTProgressView',
|
||||
null
|
||||
ProgressViewIOS
|
||||
);
|
||||
if (__DEV__) {
|
||||
verifyPropTypes(
|
||||
RCTProgressView,
|
||||
RCTProgressView.viewConfig
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = ProgressViewIOS;
|
||||
|
||||
@@ -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.
|
||||
@@ -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
|
||||
@@ -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,
|
||||
@@ -308,7 +299,7 @@ var ScrollView = React.createClass({
|
||||
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
||||
onResponderReject: this.scrollResponderHandleResponderReject,
|
||||
};
|
||||
|
||||
|
||||
var ScrollViewClass;
|
||||
if (Platform.OS === 'ios') {
|
||||
ScrollViewClass = RCTScrollView;
|
||||
@@ -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,
|
||||
|
||||
@@ -108,13 +108,7 @@ var styles = StyleSheet.create({
|
||||
|
||||
var RCTSegmentedControl = requireNativeComponent(
|
||||
'RCTSegmentedControl',
|
||||
null
|
||||
SegmentedControlIOS
|
||||
);
|
||||
if (__DEV__) {
|
||||
verifyPropTypes(
|
||||
RCTSegmentedControl,
|
||||
RCTSegmentedControl.viewConfig
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = SegmentedControlIOS;
|
||||
|
||||
@@ -13,26 +13,26 @@
|
||||
|
||||
var RCTStatusBarManager = require('NativeModules').StatusBarManager;
|
||||
|
||||
type StatusBarStyle = $Enum<{
|
||||
'default': string,
|
||||
'light-content': string,
|
||||
}>;
|
||||
|
||||
type StatusBarAnimation = $Enum<{
|
||||
'none': string,
|
||||
'fade': string,
|
||||
'slide': string,
|
||||
}>;
|
||||
|
||||
var StatusBarIOS = {
|
||||
|
||||
Style: {
|
||||
default: RCTStatusBarManager.Style.default,
|
||||
lightContent: RCTStatusBarManager.Style.lightContent
|
||||
},
|
||||
|
||||
Animation: {
|
||||
none: RCTStatusBarManager.Animation.none,
|
||||
fade: RCTStatusBarManager.Animation.fade,
|
||||
slide: RCTStatusBarManager.Animation.slide,
|
||||
},
|
||||
|
||||
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);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
@@ -96,10 +92,6 @@ var viewConfigAndroid = {
|
||||
validAttributes: AndroidTextInputAttributes,
|
||||
};
|
||||
|
||||
var crossPlatformKeyboardTypeMap = {
|
||||
'numeric': 'decimal-pad',
|
||||
};
|
||||
|
||||
type DefaultProps = {
|
||||
bufferDelay: number;
|
||||
};
|
||||
@@ -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',
|
||||
@@ -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.
|
||||
@@ -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 props = this.props;
|
||||
props.style = [styles.input, this.props.style];
|
||||
|
||||
var keyboardType = keyboardTypeConsts[
|
||||
crossPlatformKeyboardTypeMap[this.props.keyboardType] ||
|
||||
this.props.keyboardType
|
||||
];
|
||||
var returnKeyType = returnKeyTypeConsts[this.props.returnKeyType];
|
||||
|
||||
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.'
|
||||
);
|
||||
@@ -446,77 +432,48 @@ 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}
|
||||
/>;
|
||||
}
|
||||
|
||||
@@ -524,14 +481,14 @@ var TextInput = React.createClass({
|
||||
<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);
|
||||
|
||||
Reference in New Issue
Block a user