mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Updates from Tue 9 Jun
This commit is contained in:
@@ -19,7 +19,6 @@ var Platform = require('Platform');
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var React = require('React');
|
||||
var ReactChildren = require('ReactChildren');
|
||||
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var Text = require('Text');
|
||||
var TextInputState = require('TextInputState');
|
||||
@@ -29,36 +28,7 @@ var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
var createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
var emptyFunction = require('emptyFunction');
|
||||
var invariant = require('invariant');
|
||||
var merge = require('merge');
|
||||
|
||||
var RCTTextViewAttributes = merge(ReactNativeViewAttributes.UIView, {
|
||||
autoCorrect: true,
|
||||
autoCapitalize: true,
|
||||
clearTextOnFocus: true,
|
||||
color: true,
|
||||
editable: true,
|
||||
fontFamily: true,
|
||||
fontSize: true,
|
||||
fontStyle: true,
|
||||
fontWeight: true,
|
||||
keyboardType: true,
|
||||
returnKeyType: true,
|
||||
enablesReturnKeyAutomatically: true,
|
||||
secureTextEntry: true,
|
||||
selectTextOnFocus: true,
|
||||
mostRecentEventCounter: true,
|
||||
placeholder: true,
|
||||
placeholderTextColor: true,
|
||||
text: true,
|
||||
});
|
||||
|
||||
var RCTTextFieldAttributes = merge(RCTTextViewAttributes, {
|
||||
caretHidden: true,
|
||||
enabled: true,
|
||||
clearButtonMode: true,
|
||||
clearTextOnFocus: true,
|
||||
selectTextOnFocus: true,
|
||||
});
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
var onlyMultiline = {
|
||||
onSelectionChange: true,
|
||||
@@ -82,16 +52,14 @@ var AndroidTextInputAttributes = {
|
||||
testID: true,
|
||||
};
|
||||
|
||||
var viewConfigIOS = {
|
||||
uiViewClassName: 'RCTTextField',
|
||||
validAttributes: RCTTextFieldAttributes,
|
||||
};
|
||||
|
||||
var viewConfigAndroid = {
|
||||
uiViewClassName: 'AndroidTextInput',
|
||||
validAttributes: AndroidTextInputAttributes,
|
||||
};
|
||||
|
||||
var RCTTextView = requireNativeComponent('RCTTextView', null);
|
||||
var RCTTextField = requireNativeComponent('RCTTextField', null);
|
||||
|
||||
type DefaultProps = {
|
||||
bufferDelay: number;
|
||||
};
|
||||
@@ -164,7 +132,7 @@ var TextInput = React.createClass({
|
||||
*/
|
||||
keyboardType: PropTypes.oneOf([
|
||||
// Cross-platform
|
||||
'default',
|
||||
'default',
|
||||
'numeric',
|
||||
'email-address',
|
||||
// iOS-only
|
||||
@@ -296,7 +264,7 @@ var TextInput = React.createClass({
|
||||
*/
|
||||
mixins: [NativeMethodsMixin, TimerMixin],
|
||||
|
||||
viewConfig: ((Platform.OS === 'ios' ? viewConfigIOS :
|
||||
viewConfig: ((Platform.OS === 'ios' ? RCTTextField.viewConfig :
|
||||
(Platform.OS === 'android' ? viewConfigAndroid : {})) : Object),
|
||||
|
||||
isFocused: function(): boolean {
|
||||
@@ -510,6 +478,7 @@ var TextInput = React.createClass({
|
||||
onFocus={this._onFocus}
|
||||
onBlur={this._onBlur}
|
||||
onChange={this._onChange}
|
||||
onTextInput={this._onTextInput}
|
||||
onEndEditing={this.props.onEndEditing}
|
||||
onSubmitEditing={this.props.onSubmitEditing}
|
||||
onLayout={this.props.onLayout}
|
||||
@@ -576,16 +545,6 @@ var styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
var RCTTextView = createReactNativeComponentClass({
|
||||
validAttributes: RCTTextViewAttributes,
|
||||
uiViewClassName: 'RCTTextView',
|
||||
});
|
||||
|
||||
var RCTTextField = createReactNativeComponentClass({
|
||||
validAttributes: RCTTextFieldAttributes,
|
||||
uiViewClassName: 'RCTTextField',
|
||||
});
|
||||
|
||||
var AndroidTextInput = createReactNativeComponentClass({
|
||||
validAttributes: AndroidTextInputAttributes,
|
||||
uiViewClassName: 'AndroidTextInput',
|
||||
|
||||
Reference in New Issue
Block a user