mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Removed deprecated RCT_EXPORT + code paths
This commit is contained in:
@@ -281,7 +281,7 @@ var SearchScreen = React.createClass({
|
|||||||
renderRow={this.renderRow}
|
renderRow={this.renderRow}
|
||||||
onEndReached={this.onEndReached}
|
onEndReached={this.onEndReached}
|
||||||
automaticallyAdjustContentInsets={false}
|
automaticallyAdjustContentInsets={false}
|
||||||
keyboardDismissMode="onDrag"
|
keyboardDismissMode="on-drag"
|
||||||
keyboardShouldPersistTaps={true}
|
keyboardShouldPersistTaps={true}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
/>;
|
/>;
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ exports.examples = [{
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{Object.keys(StatusBarIOS.Style).map((key) =>
|
{['default', 'light-content'].map((style) =>
|
||||||
<TouchableHighlight style={styles.wrapper}
|
<TouchableHighlight style={styles.wrapper}
|
||||||
onPress={() => StatusBarIOS.setStyle(StatusBarIOS.Style[key])}>
|
onPress={() => StatusBarIOS.setStyle(style)}>
|
||||||
<View style={styles.button}>
|
<View style={styles.button}>
|
||||||
<Text>setStyle(StatusBarIOS.Style.{key})</Text>
|
<Text>setStyle('{style}')</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
)}
|
)}
|
||||||
@@ -48,11 +48,11 @@ exports.examples = [{
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{Object.keys(StatusBarIOS.Style).map((key) =>
|
{['default', 'light-content'].map((style) =>
|
||||||
<TouchableHighlight style={styles.wrapper}
|
<TouchableHighlight style={styles.wrapper}
|
||||||
onPress={() => StatusBarIOS.setStyle(StatusBarIOS.Style[key], true)}>
|
onPress={() => StatusBarIOS.setStyle(style, true)}>
|
||||||
<View style={styles.button}>
|
<View style={styles.button}>
|
||||||
<Text>setStyle(StatusBarIOS.Style.{key}, true)</Text>
|
<Text>setStyle('{style}', true)</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
)}
|
)}
|
||||||
@@ -64,18 +64,18 @@ exports.examples = [{
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{Object.keys(StatusBarIOS.Animation).map((key) =>
|
{['none', 'fade', 'slide'].map((animation) =>
|
||||||
<View>
|
<View>
|
||||||
<TouchableHighlight style={styles.wrapper}
|
<TouchableHighlight style={styles.wrapper}
|
||||||
onPress={() => StatusBarIOS.setHidden(true, StatusBarIOS.Animation[key])}>
|
onPress={() => StatusBarIOS.setHidden(true, animation)}>
|
||||||
<View style={styles.button}>
|
<View style={styles.button}>
|
||||||
<Text>setHidden(true, StatusBarIOS.Animation.{key})</Text>
|
<Text>setHidden(true, '{animation}')</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
<TouchableHighlight style={styles.wrapper}
|
<TouchableHighlight style={styles.wrapper}
|
||||||
onPress={() => StatusBarIOS.setHidden(false, StatusBarIOS.Animation[key])}>
|
onPress={() => StatusBarIOS.setHidden(false, animation)}>
|
||||||
<View style={styles.button}>
|
<View style={styles.button}>
|
||||||
<Text>setHidden(false, StatusBarIOS.Animation.{key})</Text>
|
<Text>setHidden(false, '{animation}')</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class UIExplorerList extends React.Component {
|
|||||||
renderSectionHeader={this._renderSectionHeader}
|
renderSectionHeader={this._renderSectionHeader}
|
||||||
keyboardShouldPersistTaps={true}
|
keyboardShouldPersistTaps={true}
|
||||||
automaticallyAdjustContentInsets={false}
|
automaticallyAdjustContentInsets={false}
|
||||||
keyboardDismissMode="onDrag"
|
keyboardDismissMode="on-drag"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ var DatePickerIOS = React.createClass({
|
|||||||
<View style={props.style}>
|
<View style={props.style}>
|
||||||
<RCTDatePickerIOS
|
<RCTDatePickerIOS
|
||||||
ref={DATEPICKER}
|
ref={DATEPICKER}
|
||||||
style={styles.rkDatePickerIOS}
|
style={styles.datePickerIOS}
|
||||||
date={props.date.getTime()}
|
date={props.date.getTime()}
|
||||||
maximumDate={
|
maximumDate={
|
||||||
props.maximumDate ? props.maximumDate.getTime() : undefined
|
props.maximumDate ? props.maximumDate.getTime() : undefined
|
||||||
@@ -128,7 +128,7 @@ var DatePickerIOS = React.createClass({
|
|||||||
minimumDate={
|
minimumDate={
|
||||||
props.minimumDate ? props.minimumDate.getTime() : undefined
|
props.minimumDate ? props.minimumDate.getTime() : undefined
|
||||||
}
|
}
|
||||||
mode={RCTDatePickerIOSConsts.DatePickerModes[props.mode]}
|
mode={props.mode}
|
||||||
minuteInterval={props.minuteInterval}
|
minuteInterval={props.minuteInterval}
|
||||||
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
|
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
|
||||||
onChange={this._onChange}
|
onChange={this._onChange}
|
||||||
@@ -139,7 +139,7 @@ var DatePickerIOS = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var styles = StyleSheet.create({
|
var styles = StyleSheet.create({
|
||||||
rkDatePickerIOS: {
|
datePickerIOS: {
|
||||||
height: RCTDatePickerIOSConsts.ComponentHeight,
|
height: RCTDatePickerIOSConsts.ComponentHeight,
|
||||||
width: RCTDatePickerIOSConsts.ComponentWidth,
|
width: RCTDatePickerIOSConsts.ComponentWidth,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -77,13 +77,7 @@ var styles = StyleSheet.create({
|
|||||||
|
|
||||||
var RCTProgressView = requireNativeComponent(
|
var RCTProgressView = requireNativeComponent(
|
||||||
'RCTProgressView',
|
'RCTProgressView',
|
||||||
null
|
ProgressViewIOS
|
||||||
);
|
);
|
||||||
if (__DEV__) {
|
|
||||||
verifyPropTypes(
|
|
||||||
RCTProgressView,
|
|
||||||
RCTProgressView.viewConfig
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = ProgressViewIOS;
|
module.exports = ProgressViewIOS;
|
||||||
|
|||||||
@@ -38,12 +38,6 @@ var PropTypes = React.PropTypes;
|
|||||||
var SCROLLVIEW = 'ScrollView';
|
var SCROLLVIEW = 'ScrollView';
|
||||||
var INNERVIEW = 'InnerScrollView';
|
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
|
* Component that wraps platform ScrollView while providing
|
||||||
* integration with touch locking "responder" system.
|
* integration with touch locking "responder" system.
|
||||||
@@ -147,7 +141,7 @@ var ScrollView = React.createClass({
|
|||||||
keyboardDismissMode: PropTypes.oneOf([
|
keyboardDismissMode: PropTypes.oneOf([
|
||||||
'none', // default
|
'none', // default
|
||||||
'interactive',
|
'interactive',
|
||||||
'onDrag',
|
'on-drag',
|
||||||
]),
|
]),
|
||||||
/**
|
/**
|
||||||
* When false, tapping outside of the focused text input when the keyboard
|
* When false, tapping outside of the focused text input when the keyboard
|
||||||
@@ -287,9 +281,6 @@ var ScrollView = React.createClass({
|
|||||||
...this.props,
|
...this.props,
|
||||||
alwaysBounceHorizontal,
|
alwaysBounceHorizontal,
|
||||||
alwaysBounceVertical,
|
alwaysBounceVertical,
|
||||||
keyboardDismissMode: this.props.keyboardDismissMode ?
|
|
||||||
keyboardDismissModeConstants[this.props.keyboardDismissMode] :
|
|
||||||
undefined,
|
|
||||||
style: ([styles.base, this.props.style]: ?Array<any>),
|
style: ([styles.base, this.props.style]: ?Array<any>),
|
||||||
onTouchStart: this.scrollResponderHandleTouchStart,
|
onTouchStart: this.scrollResponderHandleTouchStart,
|
||||||
onTouchMove: this.scrollResponderHandleTouchMove,
|
onTouchMove: this.scrollResponderHandleTouchMove,
|
||||||
@@ -308,7 +299,7 @@ var ScrollView = React.createClass({
|
|||||||
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
||||||
onResponderReject: this.scrollResponderHandleResponderReject,
|
onResponderReject: this.scrollResponderHandleResponderReject,
|
||||||
};
|
};
|
||||||
|
|
||||||
var ScrollViewClass;
|
var ScrollViewClass;
|
||||||
if (Platform.OS === 'ios') {
|
if (Platform.OS === 'ios') {
|
||||||
ScrollViewClass = RCTScrollView;
|
ScrollViewClass = RCTScrollView;
|
||||||
@@ -318,6 +309,13 @@ var ScrollView = React.createClass({
|
|||||||
} else {
|
} else {
|
||||||
ScrollViewClass = AndroidScrollView;
|
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(
|
invariant(
|
||||||
ScrollViewClass !== undefined,
|
ScrollViewClass !== undefined,
|
||||||
|
|||||||
@@ -108,13 +108,7 @@ var styles = StyleSheet.create({
|
|||||||
|
|
||||||
var RCTSegmentedControl = requireNativeComponent(
|
var RCTSegmentedControl = requireNativeComponent(
|
||||||
'RCTSegmentedControl',
|
'RCTSegmentedControl',
|
||||||
null
|
SegmentedControlIOS
|
||||||
);
|
);
|
||||||
if (__DEV__) {
|
|
||||||
verifyPropTypes(
|
|
||||||
RCTSegmentedControl,
|
|
||||||
RCTSegmentedControl.viewConfig
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = SegmentedControlIOS;
|
module.exports = SegmentedControlIOS;
|
||||||
|
|||||||
@@ -13,26 +13,26 @@
|
|||||||
|
|
||||||
var RCTStatusBarManager = require('NativeModules').StatusBarManager;
|
var RCTStatusBarManager = require('NativeModules').StatusBarManager;
|
||||||
|
|
||||||
|
type StatusBarStyle = $Enum<{
|
||||||
|
'default': string,
|
||||||
|
'light-content': string,
|
||||||
|
}>;
|
||||||
|
|
||||||
|
type StatusBarAnimation = $Enum<{
|
||||||
|
'none': string,
|
||||||
|
'fade': string,
|
||||||
|
'slide': string,
|
||||||
|
}>;
|
||||||
|
|
||||||
var StatusBarIOS = {
|
var StatusBarIOS = {
|
||||||
|
|
||||||
Style: {
|
setStyle(style: StatusBarStyle, animated?: boolean) {
|
||||||
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) {
|
|
||||||
animated = animated || false;
|
animated = animated || false;
|
||||||
RCTStatusBarManager.setStyle(style, animated);
|
RCTStatusBarManager.setStyle(style, animated);
|
||||||
},
|
},
|
||||||
|
|
||||||
setHidden(hidden: boolean, animation: number) {
|
setHidden(hidden: boolean, animation?: StatusBarAnimation) {
|
||||||
animation = animation || StatusBarIOS.Animation.none;
|
animation = animation || 'none';
|
||||||
RCTStatusBarManager.setHidden(hidden, animation);
|
RCTStatusBarManager.setHidden(hidden, animation);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ var emptyFunction = require('emptyFunction');
|
|||||||
var invariant = require('invariant');
|
var invariant = require('invariant');
|
||||||
var merge = require('merge');
|
var merge = require('merge');
|
||||||
|
|
||||||
var autoCapitalizeConsts = RCTUIManager.UIText.AutocapitalizationType;
|
|
||||||
var keyboardTypeConsts = RCTUIManager.UIKeyboardType;
|
|
||||||
var returnKeyTypeConsts = RCTUIManager.UIReturnKeyType;
|
|
||||||
|
|
||||||
var RCTTextViewAttributes = merge(ReactNativeViewAttributes.UIView, {
|
var RCTTextViewAttributes = merge(ReactNativeViewAttributes.UIView, {
|
||||||
autoCorrect: true,
|
autoCorrect: true,
|
||||||
autoCapitalize: true,
|
autoCapitalize: true,
|
||||||
@@ -96,10 +92,6 @@ var viewConfigAndroid = {
|
|||||||
validAttributes: AndroidTextInputAttributes,
|
validAttributes: AndroidTextInputAttributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
var crossPlatformKeyboardTypeMap = {
|
|
||||||
'numeric': 'decimal-pad',
|
|
||||||
};
|
|
||||||
|
|
||||||
type DefaultProps = {
|
type DefaultProps = {
|
||||||
bufferDelay: number;
|
bufferDelay: number;
|
||||||
};
|
};
|
||||||
@@ -171,8 +163,11 @@ var TextInput = React.createClass({
|
|||||||
* Determines which keyboard to open, e.g.`numeric`.
|
* Determines which keyboard to open, e.g.`numeric`.
|
||||||
*/
|
*/
|
||||||
keyboardType: PropTypes.oneOf([
|
keyboardType: PropTypes.oneOf([
|
||||||
'default',
|
// Cross-platform
|
||||||
// iOS
|
'default',
|
||||||
|
'numeric',
|
||||||
|
'email-address',
|
||||||
|
// iOS-only
|
||||||
'ascii-capable',
|
'ascii-capable',
|
||||||
'numbers-and-punctuation',
|
'numbers-and-punctuation',
|
||||||
'url',
|
'url',
|
||||||
@@ -182,9 +177,6 @@ var TextInput = React.createClass({
|
|||||||
'decimal-pad',
|
'decimal-pad',
|
||||||
'twitter',
|
'twitter',
|
||||||
'web-search',
|
'web-search',
|
||||||
// Cross-platform
|
|
||||||
'numeric',
|
|
||||||
'email-address',
|
|
||||||
]),
|
]),
|
||||||
/**
|
/**
|
||||||
* Determines how the return key should look.
|
* Determines how the return key should look.
|
||||||
@@ -426,18 +418,12 @@ var TextInput = React.createClass({
|
|||||||
_renderIOS: function() {
|
_renderIOS: function() {
|
||||||
var textContainer;
|
var textContainer;
|
||||||
|
|
||||||
var autoCapitalize = autoCapitalizeConsts[this.props.autoCapitalize];
|
var props = this.props;
|
||||||
var clearButtonMode = RCTUIManager.UITextField.clearButtonMode[this.props.clearButtonMode];
|
props.style = [styles.input, this.props.style];
|
||||||
|
|
||||||
var keyboardType = keyboardTypeConsts[
|
if (!props.multiline) {
|
||||||
crossPlatformKeyboardTypeMap[this.props.keyboardType] ||
|
|
||||||
this.props.keyboardType
|
|
||||||
];
|
|
||||||
var returnKeyType = returnKeyTypeConsts[this.props.returnKeyType];
|
|
||||||
|
|
||||||
if (!this.props.multiline) {
|
|
||||||
for (var propKey in onlyMultiline) {
|
for (var propKey in onlyMultiline) {
|
||||||
if (this.props[propKey]) {
|
if (props[propKey]) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'TextInput prop `' + propKey + '` is only supported with multiline.'
|
'TextInput prop `' + propKey + '` is only supported with multiline.'
|
||||||
);
|
);
|
||||||
@@ -446,77 +432,48 @@ var TextInput = React.createClass({
|
|||||||
textContainer =
|
textContainer =
|
||||||
<RCTTextField
|
<RCTTextField
|
||||||
ref="input"
|
ref="input"
|
||||||
style={[styles.input, this.props.style]}
|
{...props}
|
||||||
enabled={this.props.editable}
|
|
||||||
keyboardType={keyboardType}
|
|
||||||
returnKeyType={returnKeyType}
|
|
||||||
enablesReturnKeyAutomatically={this.props.enablesReturnKeyAutomatically}
|
|
||||||
secureTextEntry={this.props.password || this.props.secureTextEntry}
|
|
||||||
onFocus={this._onFocus}
|
onFocus={this._onFocus}
|
||||||
onBlur={this._onBlur}
|
onBlur={this._onBlur}
|
||||||
onChange={this._onChange}
|
onChange={this._onChange}
|
||||||
onEndEditing={this.props.onEndEditing}
|
|
||||||
onSubmitEditing={this.props.onSubmitEditing}
|
|
||||||
onSelectionChangeShouldSetResponder={() => true}
|
onSelectionChangeShouldSetResponder={() => true}
|
||||||
onLayout={this.props.onLayout}
|
|
||||||
placeholder={this.props.placeholder}
|
|
||||||
placeholderTextColor={this.props.placeholderTextColor}
|
|
||||||
text={this.state.bufferedValue}
|
text={this.state.bufferedValue}
|
||||||
autoCapitalize={autoCapitalize}
|
|
||||||
autoCorrect={this.props.autoCorrect}
|
|
||||||
clearButtonMode={clearButtonMode}
|
|
||||||
clearTextOnFocus={this.props.clearTextOnFocus}
|
|
||||||
selectTextOnFocus={this.props.selectTextOnFocus}
|
|
||||||
/>;
|
/>;
|
||||||
} else {
|
} else {
|
||||||
for (var propKey in notMultiline) {
|
for (var propKey in notMultiline) {
|
||||||
if (this.props[propKey]) {
|
if (props[propKey]) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'TextInput prop `' + propKey + '` cannot be used with multiline.'
|
'TextInput prop `' + propKey + '` cannot be used with multiline.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var children = this.props.children;
|
var children = props.children;
|
||||||
var childCount = 0;
|
var childCount = 0;
|
||||||
ReactChildren.forEach(children, () => ++childCount);
|
ReactChildren.forEach(children, () => ++childCount);
|
||||||
invariant(
|
invariant(
|
||||||
!(this.props.value && childCount),
|
!(props.value && childCount),
|
||||||
'Cannot specify both value and children.'
|
'Cannot specify both value and children.'
|
||||||
);
|
);
|
||||||
if (childCount > 1) {
|
if (childCount > 1) {
|
||||||
children = <Text>{children}</Text>;
|
children = <Text>{children}</Text>;
|
||||||
}
|
}
|
||||||
if (this.props.inputView) {
|
if (props.inputView) {
|
||||||
children = [children, this.props.inputView];
|
children = [children, props.inputView];
|
||||||
}
|
}
|
||||||
textContainer =
|
textContainer =
|
||||||
<RCTTextView
|
<RCTTextView
|
||||||
ref="input"
|
ref="input"
|
||||||
style={[styles.input, this.props.style]}
|
{...props}
|
||||||
children={children}
|
children={children}
|
||||||
mostRecentEventCounter={this.state.mostRecentEventCounter}
|
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}
|
onFocus={this._onFocus}
|
||||||
onBlur={this._onBlur}
|
onBlur={this._onBlur}
|
||||||
onChange={this._onChange}
|
onChange={this._onChange}
|
||||||
onEndEditing={this.props.onEndEditing}
|
|
||||||
onSelectionChange={this._onSelectionChange}
|
onSelectionChange={this._onSelectionChange}
|
||||||
onTextInput={this._onTextInput}
|
onTextInput={this._onTextInput}
|
||||||
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
|
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
|
||||||
onLayout={this.props.onLayout}
|
|
||||||
placeholder={this.props.placeholder}
|
|
||||||
placeholderTextColor={this.props.placeholderTextColor}
|
|
||||||
text={this.state.bufferedValue}
|
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
|
<TouchableWithoutFeedback
|
||||||
onPress={this._onPress}
|
onPress={this._onPress}
|
||||||
rejectResponderTermination={true}
|
rejectResponderTermination={true}
|
||||||
testID={this.props.testID}>
|
testID={props.testID}>
|
||||||
{textContainer}
|
{textContainer}
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderAndroid: function() {
|
_renderAndroid: function() {
|
||||||
var autoCapitalize = autoCapitalizeConsts[this.props.autoCapitalize];
|
var autoCapitalize = RCTUIManager.UIText.AutocapitalizationType[this.props.autoCapitalize];
|
||||||
var children = this.props.children;
|
var children = this.props.children;
|
||||||
var childCount = 0;
|
var childCount = 0;
|
||||||
ReactChildren.forEach(children, () => ++childCount);
|
ReactChildren.forEach(children, () => ++childCount);
|
||||||
|
|||||||
@@ -146,20 +146,11 @@ var Image = React.createClass({
|
|||||||
if (this.props.style && this.props.style.tintColor) {
|
if (this.props.style && this.props.style.tintColor) {
|
||||||
warning(RawImage === RCTStaticImage, 'tintColor style only supported on static images.');
|
warning(RawImage === RCTStaticImage, 'tintColor style only supported on static images.');
|
||||||
}
|
}
|
||||||
var resizeMode = this.props.resizeMode || style.resizeMode;
|
var resizeMode = this.props.resizeMode || style.resizeMode || 'cover';
|
||||||
var contentModes = NativeModules.UIManager.UIView.ContentMode;
|
|
||||||
var contentMode;
|
|
||||||
if (resizeMode === ImageResizeMode.stretch) {
|
|
||||||
contentMode = contentModes.ScaleToFill;
|
|
||||||
} else if (resizeMode === ImageResizeMode.contain) {
|
|
||||||
contentMode = contentModes.ScaleAspectFit;
|
|
||||||
} else { // ImageResizeMode.cover or undefined
|
|
||||||
contentMode = contentModes.ScaleAspectFill;
|
|
||||||
}
|
|
||||||
|
|
||||||
var nativeProps = merge(this.props, {
|
var nativeProps = merge(this.props, {
|
||||||
style,
|
style,
|
||||||
contentMode,
|
resizeMode,
|
||||||
tintColor: style.tintColor,
|
tintColor: style.tintColor,
|
||||||
});
|
});
|
||||||
if (isStored) {
|
if (isStored) {
|
||||||
@@ -187,7 +178,7 @@ var nativeOnlyProps = {
|
|||||||
src: true,
|
src: true,
|
||||||
defaultImageSrc: true,
|
defaultImageSrc: true,
|
||||||
imageTag: true,
|
imageTag: true,
|
||||||
contentMode: true,
|
resizeMode: true,
|
||||||
};
|
};
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
verifyPropTypes(Image, RCTStaticImage.viewConfig, nativeOnlyProps);
|
verifyPropTypes(Image, RCTStaticImage.viewConfig, nativeOnlyProps);
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ RCT_EXPORT_MODULE()
|
|||||||
|
|
||||||
RCT_REMAP_VIEW_PROPERTY(defaultImageSrc, defaultImage, UIImage)
|
RCT_REMAP_VIEW_PROPERTY(defaultImageSrc, defaultImage, UIImage)
|
||||||
RCT_REMAP_VIEW_PROPERTY(src, imageURL, NSURL)
|
RCT_REMAP_VIEW_PROPERTY(src, imageURL, NSURL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(contentMode, UIViewContentMode)
|
RCT_REMAP_VIEW_PROPERTY(resizeMode, contentMode, UIViewContentMode)
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ RCT_EXPORT_MODULE()
|
|||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_VIEW_PROPERTY(capInsets, UIEdgeInsets)
|
RCT_EXPORT_VIEW_PROPERTY(capInsets, UIEdgeInsets)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(contentMode, UIViewContentMode)
|
RCT_REMAP_VIEW_PROPERTY(resizeMode, contentMode, UIViewContentMode)
|
||||||
RCT_CUSTOM_VIEW_PROPERTY(src, NSURL, RCTStaticImage)
|
RCT_CUSTOM_VIEW_PROPERTY(src, NSURL, RCTStaticImage)
|
||||||
{
|
{
|
||||||
if (json) {
|
if (json) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ var PickerIOS = React.createClass({
|
|||||||
<View style={this.props.style}>
|
<View style={this.props.style}>
|
||||||
<RCTPickerIOS
|
<RCTPickerIOS
|
||||||
ref={PICKER}
|
ref={PICKER}
|
||||||
style={styles.rkPickerIOS}
|
style={styles.pickerIOS}
|
||||||
items={this.state.items}
|
items={this.state.items}
|
||||||
selectedIndex={this.state.selectedIndex}
|
selectedIndex={this.state.selectedIndex}
|
||||||
onChange={this._onChange}
|
onChange={this._onChange}
|
||||||
@@ -103,7 +103,7 @@ PickerIOS.Item = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var styles = StyleSheet.create({
|
var styles = StyleSheet.create({
|
||||||
rkPickerIOS: {
|
pickerIOS: {
|
||||||
// The picker will conform to whatever width is given, but we do
|
// The picker will conform to whatever width is given, but we do
|
||||||
// have to set the component's height explicitly on the
|
// have to set the component's height explicitly on the
|
||||||
// surrounding view to ensure it gets rendered.
|
// surrounding view to ensure it gets rendered.
|
||||||
|
|||||||
@@ -244,30 +244,19 @@ static NSArray *RCTBridgeModuleClassesByModuleID(void)
|
|||||||
|
|
||||||
@implementation RCTModuleMethod
|
@implementation RCTModuleMethod
|
||||||
{
|
{
|
||||||
BOOL _isClassMethod;
|
|
||||||
Class _moduleClass;
|
Class _moduleClass;
|
||||||
SEL _selector;
|
SEL _selector;
|
||||||
NSMethodSignature *_methodSignature;
|
NSMethodSignature *_methodSignature;
|
||||||
NSArray *_argumentBlocks;
|
NSArray *_argumentBlocks;
|
||||||
NSString *_methodName;
|
|
||||||
dispatch_block_t _methodQueue;
|
dispatch_block_t _methodQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|
||||||
{
|
|
||||||
NSRange colonRange = [methodName rangeOfString:@":"];
|
|
||||||
if (colonRange.length) {
|
|
||||||
methodName = [methodName substringToIndex:colonRange.location];
|
|
||||||
}
|
|
||||||
return methodName;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithReactMethodName:(NSString *)reactMethodName
|
- (instancetype)initWithReactMethodName:(NSString *)reactMethodName
|
||||||
objCMethodName:(NSString *)objCMethodName
|
objCMethodName:(NSString *)objCMethodName
|
||||||
JSMethodName:(NSString *)JSMethodName
|
JSMethodName:(NSString *)JSMethodName
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
_methodName = reactMethodName;
|
|
||||||
NSArray *parts = [[reactMethodName substringWithRange:(NSRange){2, reactMethodName.length - 3}] componentsSeparatedByString:@" "];
|
NSArray *parts = [[reactMethodName substringWithRange:(NSRange){2, reactMethodName.length - 3}] componentsSeparatedByString:@" "];
|
||||||
|
|
||||||
// Parse class and method
|
// Parse class and method
|
||||||
@@ -277,36 +266,33 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||||||
_moduleClassName = [_moduleClassName substringToIndex:categoryRange.location];
|
_moduleClassName = [_moduleClassName substringToIndex:categoryRange.location];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *argumentNames = nil;
|
NSString *selectorString = [parts[1] substringFromIndex:14];
|
||||||
if ([parts[1] hasPrefix:@"__rct_export__"]) {
|
_selector = NSSelectorFromString(selectorString);
|
||||||
// New format
|
_JSMethodName = JSMethodName ?: ({
|
||||||
NSString *selectorString = [parts[1] substringFromIndex:14];
|
NSString *methodName = selectorString;
|
||||||
_selector = NSSelectorFromString(selectorString);
|
NSRange colonRange = [methodName rangeOfString:@":"];
|
||||||
_JSMethodName = JSMethodName ?: RCTStringUpToFirstArgument(selectorString);
|
if (colonRange.length) {
|
||||||
|
methodName = [methodName substringToIndex:colonRange.location];
|
||||||
static NSRegularExpression *regExp;
|
|
||||||
if (!regExp) {
|
|
||||||
NSString *unusedPattern = @"(?:(?:__unused|__attribute__\\(\\(unused\\)\\)))";
|
|
||||||
NSString *constPattern = @"(?:const)";
|
|
||||||
NSString *constUnusedPattern = [NSString stringWithFormat:@"(?:(?:%@|%@)\\s*)", unusedPattern, constPattern];
|
|
||||||
NSString *pattern = [NSString stringWithFormat:@"\\(%1$@?(\\w+?)(?:\\s*\\*)?%1$@?\\)", constUnusedPattern];
|
|
||||||
regExp = [[NSRegularExpression alloc] initWithPattern:pattern options:0 error:NULL];
|
|
||||||
}
|
}
|
||||||
|
methodName;
|
||||||
|
});
|
||||||
|
|
||||||
argumentNames = [NSMutableArray array];
|
static NSRegularExpression *regExp;
|
||||||
[regExp enumerateMatchesInString:objCMethodName options:0 range:NSMakeRange(0, objCMethodName.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
if (!regExp) {
|
||||||
NSString *argumentName = [objCMethodName substringWithRange:[result rangeAtIndex:1]];
|
NSString *unusedPattern = @"(?:(?:__unused|__attribute__\\(\\(unused\\)\\)))";
|
||||||
[(NSMutableArray *)argumentNames addObject:argumentName];
|
NSString *constPattern = @"(?:const)";
|
||||||
}];
|
NSString *constUnusedPattern = [NSString stringWithFormat:@"(?:(?:%@|%@)\\s*)", unusedPattern, constPattern];
|
||||||
} else {
|
NSString *pattern = [NSString stringWithFormat:@"\\(%1$@?(\\w+?)(?:\\s*\\*)?%1$@?\\)", constUnusedPattern];
|
||||||
// Old format
|
regExp = [[NSRegularExpression alloc] initWithPattern:pattern options:0 error:NULL];
|
||||||
NSString *selectorString = parts[1];
|
|
||||||
_selector = NSSelectorFromString(selectorString);
|
|
||||||
_JSMethodName = JSMethodName ?: RCTStringUpToFirstArgument(selectorString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSMutableArray *argumentNames = [NSMutableArray array];
|
||||||
|
[regExp enumerateMatchesInString:objCMethodName options:0 range:NSMakeRange(0, objCMethodName.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
||||||
|
NSString *argumentName = [objCMethodName substringWithRange:[result rangeAtIndex:1]];
|
||||||
|
[argumentNames addObject:argumentName];
|
||||||
|
}];
|
||||||
|
|
||||||
// Extract class and method details
|
// Extract class and method details
|
||||||
_isClassMethod = [reactMethodName characterAtIndex:0] == '+';
|
|
||||||
_moduleClass = NSClassFromString(_moduleClassName);
|
_moduleClass = NSClassFromString(_moduleClassName);
|
||||||
|
|
||||||
if (RCT_DEBUG) {
|
if (RCT_DEBUG) {
|
||||||
@@ -318,9 +304,7 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get method signature
|
// Get method signature
|
||||||
_methodSignature = _isClassMethod ?
|
_methodSignature = [_moduleClass instanceMethodSignatureForSelector:_selector];
|
||||||
[_moduleClass methodSignatureForSelector:_selector] :
|
|
||||||
[_moduleClass instanceMethodSignatureForSelector:_selector];
|
|
||||||
|
|
||||||
// Process arguments
|
// Process arguments
|
||||||
NSUInteger numberOfArguments = _methodSignature.numberOfArguments;
|
NSUInteger numberOfArguments = _methodSignature.numberOfArguments;
|
||||||
@@ -363,119 +347,64 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||||||
for (NSUInteger i = 2; i < numberOfArguments; i++) {
|
for (NSUInteger i = 2; i < numberOfArguments; i++) {
|
||||||
const char *argumentType = [_methodSignature getArgumentTypeAtIndex:i];
|
const char *argumentType = [_methodSignature getArgumentTypeAtIndex:i];
|
||||||
|
|
||||||
BOOL useFallback = YES;
|
NSString *argumentName = argumentNames[i - 2];
|
||||||
if (argumentNames) {
|
SEL selector = NSSelectorFromString([argumentName stringByAppendingString:@":"]);
|
||||||
NSString *argumentName = argumentNames[i - 2];
|
if ([RCTConvert respondsToSelector:selector]) {
|
||||||
SEL selector = NSSelectorFromString([argumentName stringByAppendingString:@":"]);
|
|
||||||
if ([RCTConvert respondsToSelector:selector]) {
|
|
||||||
useFallback = NO;
|
|
||||||
switch (argumentType[0]) {
|
|
||||||
|
|
||||||
#define RCT_CONVERT_CASE(_value, _type) \
|
|
||||||
case _value: { \
|
|
||||||
_type (*convert)(id, SEL, id) = (typeof(convert))objc_msgSend; \
|
|
||||||
RCT_ARG_BLOCK( _type value = convert([RCTConvert class], selector, json); ) \
|
|
||||||
break; \
|
|
||||||
}
|
|
||||||
|
|
||||||
RCT_CONVERT_CASE(':', SEL)
|
|
||||||
RCT_CONVERT_CASE('*', const char *)
|
|
||||||
RCT_CONVERT_CASE('c', char)
|
|
||||||
RCT_CONVERT_CASE('C', unsigned char)
|
|
||||||
RCT_CONVERT_CASE('s', short)
|
|
||||||
RCT_CONVERT_CASE('S', unsigned short)
|
|
||||||
RCT_CONVERT_CASE('i', int)
|
|
||||||
RCT_CONVERT_CASE('I', unsigned int)
|
|
||||||
RCT_CONVERT_CASE('l', long)
|
|
||||||
RCT_CONVERT_CASE('L', unsigned long)
|
|
||||||
RCT_CONVERT_CASE('q', long long)
|
|
||||||
RCT_CONVERT_CASE('Q', unsigned long long)
|
|
||||||
RCT_CONVERT_CASE('f', float)
|
|
||||||
RCT_CONVERT_CASE('d', double)
|
|
||||||
RCT_CONVERT_CASE('B', BOOL)
|
|
||||||
RCT_CONVERT_CASE('@', id)
|
|
||||||
RCT_CONVERT_CASE('^', void *)
|
|
||||||
|
|
||||||
case '{': {
|
|
||||||
[argumentBlocks addObject:^(RCTBridge *bridge, NSNumber *context, NSInvocation *invocation, NSUInteger index, id json) {
|
|
||||||
NSMethodSignature *methodSignature = [RCTConvert methodSignatureForSelector:selector];
|
|
||||||
void *returnValue = malloc(methodSignature.methodReturnLength);
|
|
||||||
NSInvocation *_invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
|
|
||||||
[_invocation setTarget:[RCTConvert class]];
|
|
||||||
[_invocation setSelector:selector];
|
|
||||||
[_invocation setArgument:&json atIndex:2];
|
|
||||||
[_invocation invoke];
|
|
||||||
[_invocation getReturnValue:returnValue];
|
|
||||||
|
|
||||||
[invocation setArgument:returnValue atIndex:index];
|
|
||||||
|
|
||||||
free(returnValue);
|
|
||||||
}];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
defaultCase(argumentType);
|
|
||||||
}
|
|
||||||
} else if ([argumentName isEqualToString:@"RCTResponseSenderBlock"]) {
|
|
||||||
addBlockArgument();
|
|
||||||
useFallback = NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useFallback) {
|
|
||||||
switch (argumentType[0]) {
|
switch (argumentType[0]) {
|
||||||
|
|
||||||
#define RCT_CASE(_value, _class, _logic) \
|
#define RCT_CONVERT_CASE(_value, _type) \
|
||||||
case _value: { \
|
case _value: { \
|
||||||
RCT_ARG_BLOCK( \
|
_type (*convert)(id, SEL, id) = (typeof(convert))objc_msgSend; \
|
||||||
if (RCT_DEBUG && json && ![json isKindOfClass:[_class class]]) { \
|
RCT_ARG_BLOCK( _type value = convert([RCTConvert class], selector, json); ) \
|
||||||
RCTLogError(@"Argument %tu (%@) of %@.%@ should be of type %@", index, \
|
break; \
|
||||||
json, RCTBridgeModuleNameForClass(_moduleClass), _JSMethodName, [_class class]); \
|
}
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
_logic \
|
|
||||||
) \
|
|
||||||
break; \
|
|
||||||
}
|
|
||||||
|
|
||||||
RCT_CASE(':', NSString, SEL value = NSSelectorFromString(json); )
|
RCT_CONVERT_CASE(':', SEL)
|
||||||
RCT_CASE('*', NSString, const char *value = [json UTF8String]; )
|
RCT_CONVERT_CASE('*', const char *)
|
||||||
|
RCT_CONVERT_CASE('c', char)
|
||||||
|
RCT_CONVERT_CASE('C', unsigned char)
|
||||||
|
RCT_CONVERT_CASE('s', short)
|
||||||
|
RCT_CONVERT_CASE('S', unsigned short)
|
||||||
|
RCT_CONVERT_CASE('i', int)
|
||||||
|
RCT_CONVERT_CASE('I', unsigned int)
|
||||||
|
RCT_CONVERT_CASE('l', long)
|
||||||
|
RCT_CONVERT_CASE('L', unsigned long)
|
||||||
|
RCT_CONVERT_CASE('q', long long)
|
||||||
|
RCT_CONVERT_CASE('Q', unsigned long long)
|
||||||
|
RCT_CONVERT_CASE('f', float)
|
||||||
|
RCT_CONVERT_CASE('d', double)
|
||||||
|
RCT_CONVERT_CASE('B', BOOL)
|
||||||
|
RCT_CONVERT_CASE('@', id)
|
||||||
|
RCT_CONVERT_CASE('^', void *)
|
||||||
|
|
||||||
#define RCT_SIMPLE_CASE(_value, _type, _selector) \
|
case '{': {
|
||||||
case _value: { \
|
[argumentBlocks addObject:^(RCTBridge *bridge, NSNumber *context, NSInvocation *invocation, NSUInteger index, id json) {
|
||||||
RCT_ARG_BLOCK( \
|
NSMethodSignature *methodSignature = [RCTConvert methodSignatureForSelector:selector];
|
||||||
if (RCT_DEBUG && json && ![json respondsToSelector:@selector(_selector)]) { \
|
void *returnValue = malloc(methodSignature.methodReturnLength);
|
||||||
RCTLogError(@"Argument %tu (%@) of %@.%@ does not respond to selector: %@", \
|
NSInvocation *_invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
|
||||||
index, json, RCTBridgeModuleNameForClass(_moduleClass), _JSMethodName, @#_selector); \
|
[_invocation setTarget:[RCTConvert class]];
|
||||||
return; \
|
[_invocation setSelector:selector];
|
||||||
} \
|
[_invocation setArgument:&json atIndex:2];
|
||||||
_type value = [json _selector]; \
|
[_invocation invoke];
|
||||||
) \
|
[_invocation getReturnValue:returnValue];
|
||||||
break; \
|
|
||||||
}
|
|
||||||
|
|
||||||
RCT_SIMPLE_CASE('c', char, charValue)
|
[invocation setArgument:returnValue atIndex:index];
|
||||||
RCT_SIMPLE_CASE('C', unsigned char, unsignedCharValue)
|
|
||||||
RCT_SIMPLE_CASE('s', short, shortValue)
|
|
||||||
RCT_SIMPLE_CASE('S', unsigned short, unsignedShortValue)
|
|
||||||
RCT_SIMPLE_CASE('i', int, intValue)
|
|
||||||
RCT_SIMPLE_CASE('I', unsigned int, unsignedIntValue)
|
|
||||||
RCT_SIMPLE_CASE('l', long, longValue)
|
|
||||||
RCT_SIMPLE_CASE('L', unsigned long, unsignedLongValue)
|
|
||||||
RCT_SIMPLE_CASE('q', long long, longLongValue)
|
|
||||||
RCT_SIMPLE_CASE('Q', unsigned long long, unsignedLongLongValue)
|
|
||||||
RCT_SIMPLE_CASE('f', float, floatValue)
|
|
||||||
RCT_SIMPLE_CASE('d', double, doubleValue)
|
|
||||||
RCT_SIMPLE_CASE('B', BOOL, boolValue)
|
|
||||||
|
|
||||||
case '{':
|
free(returnValue);
|
||||||
RCTLogMustFix(@"Cannot convert JSON to struct %s", argumentType);
|
}];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
defaultCase(argumentType);
|
defaultCase(argumentType);
|
||||||
}
|
}
|
||||||
|
} else if ([argumentName isEqualToString:@"RCTResponseSenderBlock"]) {
|
||||||
|
addBlockArgument();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Unknown argument type
|
||||||
|
RCTLogError(@"Unknown argument type '%@' in method %@. Extend RCTConvert"
|
||||||
|
" to support this type.", argumentName, [self methodName]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +423,7 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
RCTAssert([module class] == _moduleClass, @"Attempted to invoke method \
|
RCTAssert([module class] == _moduleClass, @"Attempted to invoke method \
|
||||||
%@ on a module of class %@", _methodName, [module class]);
|
%@ on a module of class %@", [self methodName], [module class]);
|
||||||
|
|
||||||
// Safety check
|
// Safety check
|
||||||
if (arguments.count != _argumentBlocks.count) {
|
if (arguments.count != _argumentBlocks.count) {
|
||||||
@@ -520,12 +449,19 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Invoke method
|
// Invoke method
|
||||||
[invocation invokeWithTarget:_isClassMethod ? [module class] : module];
|
[invocation invokeWithTarget:module];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)methodName
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"-[%@ %@]", _moduleClass,
|
||||||
|
NSStringFromSelector(_selector)];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)description
|
- (NSString *)description
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@;>", NSStringFromClass(self.class), self, _methodName, _JSMethodName];
|
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@();>",
|
||||||
|
[self class], self, [self methodName], _JSMethodName];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -562,19 +498,10 @@ static RCTSparseArray *RCTExportedMethodsByModuleID(void)
|
|||||||
const char **entries = (const char **)(mach_header + addr);
|
const char **entries = (const char **)(mach_header + addr);
|
||||||
|
|
||||||
// Create method
|
// Create method
|
||||||
RCTModuleMethod *moduleMethod;
|
RCTModuleMethod *moduleMethod =
|
||||||
if (entries[2] == NULL) {
|
[[RCTModuleMethod alloc] initWithReactMethodName:@(entries[0])
|
||||||
|
objCMethodName:@(entries[1])
|
||||||
// Legacy support for RCT_EXPORT()
|
JSMethodName:strlen(entries[2]) ? @(entries[2]) : nil];
|
||||||
moduleMethod = [[RCTModuleMethod alloc] initWithReactMethodName:@(entries[0])
|
|
||||||
objCMethodName:@(entries[0])
|
|
||||||
JSMethodName:strlen(entries[1]) ? @(entries[1]) : nil];
|
|
||||||
} else {
|
|
||||||
moduleMethod = [[RCTModuleMethod alloc] initWithReactMethodName:@(entries[0])
|
|
||||||
objCMethodName:strlen(entries[1]) ? @(entries[1]) : nil
|
|
||||||
JSMethodName:strlen(entries[2]) ? @(entries[2]) : nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache method
|
// Cache method
|
||||||
NSArray *methods = methodsByModuleClassName[moduleMethod.moduleClassName];
|
NSArray *methods = methodsByModuleClassName[moduleMethod.moduleClassName];
|
||||||
methodsByModuleClassName[moduleMethod.moduleClassName] =
|
methodsByModuleClassName[moduleMethod.moduleClassName] =
|
||||||
@@ -726,7 +653,7 @@ static NSDictionary *RCTLocalModulesConfig()
|
|||||||
@"methodID": @(methods.count),
|
@"methodID": @(methods.count),
|
||||||
@"type": @"local"
|
@"type": @"local"
|
||||||
};
|
};
|
||||||
[RCTLocalMethodNames addObject:methodName];
|
[RCTLocalMethodNames addObject:methodName];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add module and method lookup
|
// Add module and method lookup
|
||||||
@@ -1610,7 +1537,7 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin
|
|||||||
|
|
||||||
- (void)stopProfiling
|
- (void)stopProfiling
|
||||||
{
|
{
|
||||||
RCTAssertMainThread();
|
RCTAssertMainThread();
|
||||||
|
|
||||||
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||||
NSString *log = RCTProfileEnd(self);
|
NSString *log = RCTProfileEnd(self);
|
||||||
|
|||||||
@@ -145,15 +145,6 @@ extern const dispatch_queue_t RCTJSThread;
|
|||||||
static const char *__rct_export_entry__[] = { __func__, #method, #js_name }; \
|
static const char *__rct_export_entry__[] = { __func__, #method, #js_name }; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated, do not use.
|
|
||||||
*/
|
|
||||||
#define RCT_EXPORT(js_name) \
|
|
||||||
_Pragma("message(\"RCT_EXPORT is deprecated. Use RCT_EXPORT_METHOD instead.\")") \
|
|
||||||
__attribute__((used, section("__DATA,RCTExport"))) \
|
|
||||||
__attribute__((__aligned__(1))) \
|
|
||||||
static const char *__rct_export_entry__[] = { __func__, #js_name, NULL }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The queue that will be used to call all exported methods. If omitted, this
|
* The queue that will be used to call all exported methods. If omitted, this
|
||||||
* will call on the default background queue, which is avoids blocking the main
|
* will call on the default background queue, which is avoids blocking the main
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
@interface RCTConvert : NSObject
|
@interface RCTConvert : NSObject
|
||||||
|
|
||||||
|
+ (id)id:(id)json;
|
||||||
|
|
||||||
+ (BOOL)BOOL:(id)json;
|
+ (BOOL)BOOL:(id)json;
|
||||||
+ (double)double:(id)json;
|
+ (double)double:(id)json;
|
||||||
+ (float)float:(id)json;
|
+ (float)float:(id)json;
|
||||||
@@ -52,7 +54,6 @@
|
|||||||
+ (NSWritingDirection)NSWritingDirection:(id)json;
|
+ (NSWritingDirection)NSWritingDirection:(id)json;
|
||||||
+ (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json;
|
+ (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json;
|
||||||
+ (UITextFieldViewMode)UITextFieldViewMode:(id)json;
|
+ (UITextFieldViewMode)UITextFieldViewMode:(id)json;
|
||||||
+ (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json;
|
|
||||||
+ (UIKeyboardType)UIKeyboardType:(id)json;
|
+ (UIKeyboardType)UIKeyboardType:(id)json;
|
||||||
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
|
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ void RCTLogConvertError(id json, const char *type)
|
|||||||
json, [json classForCoder], type);
|
json, [json classForCoder], type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_CONVERTER(id, id, self)
|
||||||
|
|
||||||
RCT_CONVERTER(BOOL, BOOL, boolValue)
|
RCT_CONVERTER(BOOL, BOOL, boolValue)
|
||||||
RCT_NUMBER_CONVERTER(double, doubleValue)
|
RCT_NUMBER_CONVERTER(double, doubleValue)
|
||||||
RCT_NUMBER_CONVERTER(float, floatValue)
|
RCT_NUMBER_CONVERTER(float, floatValue)
|
||||||
@@ -219,12 +221,6 @@ RCT_ENUM_CONVERTER(UITextFieldViewMode, (@{
|
|||||||
@"always": @(UITextFieldViewModeAlways),
|
@"always": @(UITextFieldViewModeAlways),
|
||||||
}), UITextFieldViewModeNever, integerValue)
|
}), UITextFieldViewModeNever, integerValue)
|
||||||
|
|
||||||
RCT_ENUM_CONVERTER(UIScrollViewKeyboardDismissMode, (@{
|
|
||||||
@"none": @(UIScrollViewKeyboardDismissModeNone),
|
|
||||||
@"on-drag": @(UIScrollViewKeyboardDismissModeOnDrag),
|
|
||||||
@"interactive": @(UIScrollViewKeyboardDismissModeInteractive),
|
|
||||||
}), UIScrollViewKeyboardDismissModeNone, integerValue)
|
|
||||||
|
|
||||||
RCT_ENUM_CONVERTER(UIKeyboardType, (@{
|
RCT_ENUM_CONVERTER(UIKeyboardType, (@{
|
||||||
@"default": @(UIKeyboardTypeDefault),
|
@"default": @(UIKeyboardTypeDefault),
|
||||||
@"ascii-capable": @(UIKeyboardTypeASCIICapable),
|
@"ascii-capable": @(UIKeyboardTypeASCIICapable),
|
||||||
@@ -237,6 +233,8 @@ RCT_ENUM_CONVERTER(UIKeyboardType, (@{
|
|||||||
@"decimal-pad": @(UIKeyboardTypeDecimalPad),
|
@"decimal-pad": @(UIKeyboardTypeDecimalPad),
|
||||||
@"twitter": @(UIKeyboardTypeTwitter),
|
@"twitter": @(UIKeyboardTypeTwitter),
|
||||||
@"web-search": @(UIKeyboardTypeWebSearch),
|
@"web-search": @(UIKeyboardTypeWebSearch),
|
||||||
|
// Added for Android compatibility
|
||||||
|
@"numeric": @(UIKeyboardTypeDecimalPad),
|
||||||
}), UIKeyboardTypeDefault, integerValue)
|
}), UIKeyboardTypeDefault, integerValue)
|
||||||
|
|
||||||
RCT_ENUM_CONVERTER(UIReturnKeyType, (@{
|
RCT_ENUM_CONVERTER(UIReturnKeyType, (@{
|
||||||
@@ -267,7 +265,11 @@ RCT_ENUM_CONVERTER(UIViewContentMode, (@{
|
|||||||
@"top-right": @(UIViewContentModeTopRight),
|
@"top-right": @(UIViewContentModeTopRight),
|
||||||
@"bottom-left": @(UIViewContentModeBottomLeft),
|
@"bottom-left": @(UIViewContentModeBottomLeft),
|
||||||
@"bottom-right": @(UIViewContentModeBottomRight),
|
@"bottom-right": @(UIViewContentModeBottomRight),
|
||||||
}), UIViewContentModeScaleToFill, integerValue)
|
// Cross-platform values
|
||||||
|
@"cover": @(UIViewContentModeScaleAspectFill),
|
||||||
|
@"contain": @(UIViewContentModeScaleAspectFit),
|
||||||
|
@"stretch": @(UIViewContentModeScaleToFill),
|
||||||
|
}), UIViewContentModeScaleAspectFill, integerValue)
|
||||||
|
|
||||||
RCT_ENUM_CONVERTER(UIBarStyle, (@{
|
RCT_ENUM_CONVERTER(UIBarStyle, (@{
|
||||||
@"default": @(UIBarStyleDefault),
|
@"default": @(UIBarStyleDefault),
|
||||||
|
|||||||
@@ -85,11 +85,6 @@
|
|||||||
selector:@selector(dismiss)
|
selector:@selector(dismiss)
|
||||||
name:RCTReloadNotification
|
name:RCTReloadNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
[notificationCenter addObserver:self
|
|
||||||
selector:@selector(dismiss)
|
|
||||||
name:RCTJavaScriptDidLoadNotification
|
|
||||||
object:nil];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,14 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
#import "RCTBridgeModule.h"
|
#import "RCTBridgeModule.h"
|
||||||
|
#import "RCTConvert.h"
|
||||||
|
|
||||||
|
@interface RCTConvert (UIStatusBar)
|
||||||
|
|
||||||
|
+ (UIStatusBarStyle)UIStatusBarStyle:(id)json;
|
||||||
|
+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface RCTStatusBarManager : NSObject <RCTBridgeModule>
|
@interface RCTStatusBarManager : NSObject <RCTBridgeModule>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,21 @@
|
|||||||
|
|
||||||
#import "RCTLog.h"
|
#import "RCTLog.h"
|
||||||
|
|
||||||
|
@implementation RCTConvert (UIStatusBar)
|
||||||
|
|
||||||
|
RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{
|
||||||
|
@"default": @(UIStatusBarStyleDefault),
|
||||||
|
@"light-content": @(UIStatusBarStyleLightContent),
|
||||||
|
}), UIStatusBarStyleDefault, integerValue);
|
||||||
|
|
||||||
|
RCT_ENUM_CONVERTER(UIStatusBarAnimation, (@{
|
||||||
|
@"none": @(UIStatusBarAnimationNone),
|
||||||
|
@"fade": @(UIStatusBarAnimationFade),
|
||||||
|
@"slide": @(UIStatusBarAnimationSlide),
|
||||||
|
}), UIStatusBarAnimationNone, integerValue);
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation RCTStatusBarManager
|
@implementation RCTStatusBarManager
|
||||||
|
|
||||||
static BOOL RCTViewControllerBasedStatusBarAppearance()
|
static BOOL RCTViewControllerBasedStatusBarAppearance()
|
||||||
@@ -18,7 +33,8 @@ static BOOL RCTViewControllerBasedStatusBarAppearance()
|
|||||||
static BOOL value;
|
static BOOL value;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
value = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"] ?: @YES boolValue];
|
value = [[[NSBundle mainBundle] objectForInfoDictionaryKey:
|
||||||
|
@"UIViewControllerBasedStatusBarAppearance"] ?: @YES boolValue];
|
||||||
});
|
});
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -55,19 +71,4 @@ RCT_EXPORT_METHOD(setHidden:(BOOL)hidden
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)constantsToExport
|
|
||||||
{
|
|
||||||
return @{
|
|
||||||
@"Style": @{
|
|
||||||
@"default": @(UIStatusBarStyleDefault),
|
|
||||||
@"lightContent": @(UIStatusBarStyleLightContent),
|
|
||||||
},
|
|
||||||
@"Animation": @{
|
|
||||||
@"none": @(UIStatusBarAnimationNone),
|
|
||||||
@"fade": @(UIStatusBarAnimationFade),
|
|
||||||
@"slide": @(UIStatusBarAnimationSlide),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -1397,11 +1397,6 @@ RCT_EXPORT_METHOD(clearJSResponder)
|
|||||||
NSMutableDictionary *allJSConstants = [@{
|
NSMutableDictionary *allJSConstants = [@{
|
||||||
@"customBubblingEventTypes": [self customBubblingEventTypes],
|
@"customBubblingEventTypes": [self customBubblingEventTypes],
|
||||||
@"customDirectEventTypes": [self customDirectEventTypes],
|
@"customDirectEventTypes": [self customDirectEventTypes],
|
||||||
@"NSTextAlignment": @{
|
|
||||||
@"Left": @(NSTextAlignmentLeft),
|
|
||||||
@"Center": @(NSTextAlignmentCenter),
|
|
||||||
@"Right": @(NSTextAlignmentRight),
|
|
||||||
},
|
|
||||||
@"Dimensions": @{
|
@"Dimensions": @{
|
||||||
@"window": @{
|
@"window": @{
|
||||||
@"width": @(RCTScreenSize().width),
|
@"width": @(RCTScreenSize().width),
|
||||||
@@ -1413,73 +1408,6 @@ RCT_EXPORT_METHOD(clearJSResponder)
|
|||||||
@"height": @(RCTScreenSize().height),
|
@"height": @(RCTScreenSize().height),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@"StyleConstants": @{
|
|
||||||
@"PointerEventsValues": @{
|
|
||||||
@"none": @(RCTPointerEventsNone),
|
|
||||||
@"box-none": @(RCTPointerEventsBoxNone),
|
|
||||||
@"box-only": @(RCTPointerEventsBoxOnly),
|
|
||||||
@"auto": @(RCTPointerEventsUnspecified),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
@"UIText": @{
|
|
||||||
@"AutocapitalizationType": @{
|
|
||||||
@"characters": @(UITextAutocapitalizationTypeAllCharacters),
|
|
||||||
@"sentences": @(UITextAutocapitalizationTypeSentences),
|
|
||||||
@"words": @(UITextAutocapitalizationTypeWords),
|
|
||||||
@"none": @(UITextAutocapitalizationTypeNone),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
@"UITextField": @{
|
|
||||||
@"clearButtonMode": @{
|
|
||||||
@"never": @(UITextFieldViewModeNever),
|
|
||||||
@"while-editing": @(UITextFieldViewModeWhileEditing),
|
|
||||||
@"unless-editing": @(UITextFieldViewModeUnlessEditing),
|
|
||||||
@"always": @(UITextFieldViewModeAlways),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
@"UIKeyboardType": @{
|
|
||||||
@"default": @(UIKeyboardTypeDefault),
|
|
||||||
@"ascii-capable": @(UIKeyboardTypeASCIICapable),
|
|
||||||
@"numbers-and-punctuation": @(UIKeyboardTypeNumbersAndPunctuation),
|
|
||||||
@"url": @(UIKeyboardTypeURL),
|
|
||||||
@"number-pad": @(UIKeyboardTypeNumberPad),
|
|
||||||
@"phone-pad": @(UIKeyboardTypePhonePad),
|
|
||||||
@"name-phone-pad": @(UIKeyboardTypeNamePhonePad),
|
|
||||||
@"decimal-pad": @(UIKeyboardTypeDecimalPad),
|
|
||||||
@"email-address": @(UIKeyboardTypeEmailAddress),
|
|
||||||
@"twitter": @(UIKeyboardTypeTwitter),
|
|
||||||
@"web-search": @(UIKeyboardTypeWebSearch),
|
|
||||||
},
|
|
||||||
@"UIReturnKeyType": @{
|
|
||||||
@"default": @(UIReturnKeyDefault),
|
|
||||||
@"go": @(UIReturnKeyGo),
|
|
||||||
@"google": @(UIReturnKeyGoogle),
|
|
||||||
@"join": @(UIReturnKeyJoin),
|
|
||||||
@"next": @(UIReturnKeyNext),
|
|
||||||
@"route": @(UIReturnKeyRoute),
|
|
||||||
@"search": @(UIReturnKeySearch),
|
|
||||||
@"send": @(UIReturnKeySend),
|
|
||||||
@"yahoo": @(UIReturnKeyYahoo),
|
|
||||||
@"done": @(UIReturnKeyDone),
|
|
||||||
@"emergency-call": @(UIReturnKeyEmergencyCall),
|
|
||||||
},
|
|
||||||
@"UIView": @{
|
|
||||||
@"ContentMode": @{
|
|
||||||
@"ScaleToFill": @(UIViewContentModeScaleToFill),
|
|
||||||
@"ScaleAspectFit": @(UIViewContentModeScaleAspectFit),
|
|
||||||
@"ScaleAspectFill": @(UIViewContentModeScaleAspectFill),
|
|
||||||
@"Redraw": @(UIViewContentModeRedraw),
|
|
||||||
@"Center": @(UIViewContentModeCenter),
|
|
||||||
@"Top": @(UIViewContentModeTop),
|
|
||||||
@"Bottom": @(UIViewContentModeBottom),
|
|
||||||
@"Left": @(UIViewContentModeLeft),
|
|
||||||
@"Right": @(UIViewContentModeRight),
|
|
||||||
@"TopLeft": @(UIViewContentModeTopLeft),
|
|
||||||
@"TopRight": @(UIViewContentModeTopRight),
|
|
||||||
@"BottomLeft": @(UIViewContentModeBottomLeft),
|
|
||||||
@"BottomRight": @(UIViewContentModeBottomRight),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} mutableCopy];
|
} mutableCopy];
|
||||||
|
|
||||||
[_viewManagers enumerateKeysAndObjectsUsingBlock:^(NSString *name, RCTViewManager *manager, BOOL *stop) {
|
[_viewManagers enumerateKeysAndObjectsUsingBlock:^(NSString *name, RCTViewManager *manager, BOOL *stop) {
|
||||||
|
|||||||
@@ -8,6 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "RCTViewManager.h"
|
#import "RCTViewManager.h"
|
||||||
|
#import "RCTConvert.h"
|
||||||
|
|
||||||
|
@interface RCTConvert(UIDatePicker)
|
||||||
|
|
||||||
|
+ (UIDatePickerMode)UIDatePickerMode:(id)json;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface RCTDatePickerManager : RCTViewManager
|
@interface RCTDatePickerManager : RCTViewManager
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#import "RCTDatePickerManager.h"
|
#import "RCTDatePickerManager.h"
|
||||||
|
|
||||||
#import "RCTBridge.h"
|
#import "RCTBridge.h"
|
||||||
#import "RCTConvert.h"
|
|
||||||
#import "RCTEventDispatcher.h"
|
#import "RCTEventDispatcher.h"
|
||||||
#import "UIView+React.h"
|
#import "UIView+React.h"
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ RCT_ENUM_CONVERTER(UIDatePickerMode, (@{
|
|||||||
@"time": @(UIDatePickerModeTime),
|
@"time": @(UIDatePickerModeTime),
|
||||||
@"date": @(UIDatePickerModeDate),
|
@"date": @(UIDatePickerModeDate),
|
||||||
@"datetime": @(UIDatePickerModeDateAndTime),
|
@"datetime": @(UIDatePickerModeDateAndTime),
|
||||||
//@"countdown": @(UIDatePickerModeCountDownTimer) // not supported yet
|
@"countdown": @(UIDatePickerModeCountDownTimer), // not supported yet
|
||||||
}), UIDatePickerModeTime, integerValue)
|
}), UIDatePickerModeTime, integerValue)
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -31,9 +30,12 @@ RCT_EXPORT_MODULE()
|
|||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
|
// TODO: we crash here if the RCTDatePickerManager is released
|
||||||
|
// while the UIDatePicker is still sending onChange events. To
|
||||||
|
// fix this we should maybe subclass UIDatePicker and make it
|
||||||
|
// be its own event target.
|
||||||
UIDatePicker *picker = [[UIDatePicker alloc] init];
|
UIDatePicker *picker = [[UIDatePicker alloc] init];
|
||||||
[picker addTarget:self
|
[picker addTarget:self action:@selector(onChange:)
|
||||||
action:@selector(onChange:)
|
|
||||||
forControlEvents:UIControlEventValueChanged];
|
forControlEvents:UIControlEventValueChanged];
|
||||||
return picker;
|
return picker;
|
||||||
}
|
}
|
||||||
@@ -56,17 +58,10 @@ RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone)
|
|||||||
|
|
||||||
- (NSDictionary *)constantsToExport
|
- (NSDictionary *)constantsToExport
|
||||||
{
|
{
|
||||||
UIDatePicker *dp = [[UIDatePicker alloc] init];
|
UIDatePicker *view = [[UIDatePicker alloc] init];
|
||||||
[dp layoutIfNeeded];
|
|
||||||
|
|
||||||
return @{
|
return @{
|
||||||
@"ComponentHeight": @(CGRectGetHeight(dp.frame)),
|
@"ComponentHeight": @(view.intrinsicContentSize.height),
|
||||||
@"ComponentWidth": @(CGRectGetWidth(dp.frame)),
|
@"ComponentWidth": @(view.intrinsicContentSize.width),
|
||||||
@"DatePickerModes": @{
|
|
||||||
@"time": @(UIDatePickerModeTime),
|
|
||||||
@"date": @(UIDatePickerModeDate),
|
|
||||||
@"datetime": @(UIDatePickerModeDateAndTime),
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger)
|
|||||||
|
|
||||||
- (NSDictionary *)constantsToExport
|
- (NSDictionary *)constantsToExport
|
||||||
{
|
{
|
||||||
RCTPicker *pv = [[RCTPicker alloc] init];
|
RCTPicker *view = [[RCTPicker alloc] init];
|
||||||
return @{
|
return @{
|
||||||
@"ComponentHeight": @(CGRectGetHeight(pv.frame)),
|
@"ComponentHeight": @(view.intrinsicContentSize.height),
|
||||||
@"ComponentWidth": @(CGRectGetWidth(pv.frame))
|
@"ComponentWidth": @(view.intrinsicContentSize.width)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "RCTViewManager.h"
|
#import "RCTViewManager.h"
|
||||||
|
#import "RCTConvert.h"
|
||||||
|
|
||||||
|
@interface RCTConvert (UIScrollView)
|
||||||
|
|
||||||
|
+ (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface RCTScrollViewManager : RCTViewManager
|
@interface RCTScrollViewManager : RCTViewManager
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,22 @@
|
|||||||
#import "RCTScrollViewManager.h"
|
#import "RCTScrollViewManager.h"
|
||||||
|
|
||||||
#import "RCTBridge.h"
|
#import "RCTBridge.h"
|
||||||
#import "RCTConvert.h"
|
|
||||||
#import "RCTScrollView.h"
|
#import "RCTScrollView.h"
|
||||||
#import "RCTSparseArray.h"
|
#import "RCTSparseArray.h"
|
||||||
#import "RCTUIManager.h"
|
#import "RCTUIManager.h"
|
||||||
|
|
||||||
|
@implementation RCTConvert (UIScrollView)
|
||||||
|
|
||||||
|
RCT_ENUM_CONVERTER(UIScrollViewKeyboardDismissMode, (@{
|
||||||
|
@"none": @(UIScrollViewKeyboardDismissModeNone),
|
||||||
|
@"on-drag": @(UIScrollViewKeyboardDismissModeOnDrag),
|
||||||
|
@"interactive": @(UIScrollViewKeyboardDismissModeInteractive),
|
||||||
|
// Backwards compatibility
|
||||||
|
@"onDrag": @(UIScrollViewKeyboardDismissModeOnDrag),
|
||||||
|
}), UIScrollViewKeyboardDismissModeNone, integerValue)
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation RCTScrollViewManager
|
@implementation RCTScrollViewManager
|
||||||
|
|
||||||
RCT_EXPORT_MODULE()
|
RCT_EXPORT_MODULE()
|
||||||
@@ -53,14 +64,10 @@ RCT_DEPRECATED_VIEW_PROPERTY(throttleScrollCallbackMS, scrollEventThrottle)
|
|||||||
- (NSDictionary *)constantsToExport
|
- (NSDictionary *)constantsToExport
|
||||||
{
|
{
|
||||||
return @{
|
return @{
|
||||||
|
// TODO: unused - remove these?
|
||||||
@"DecelerationRate": @{
|
@"DecelerationRate": @{
|
||||||
@"Normal": @(UIScrollViewDecelerationRateNormal),
|
@"normal": @(UIScrollViewDecelerationRateNormal),
|
||||||
@"Fast": @(UIScrollViewDecelerationRateFast),
|
@"fast": @(UIScrollViewDecelerationRateFast),
|
||||||
},
|
|
||||||
@"KeyboardDismissMode": @{
|
|
||||||
@"None": @(UIScrollViewKeyboardDismissModeNone),
|
|
||||||
@"Interactive": @(UIScrollViewKeyboardDismissModeInteractive),
|
|
||||||
@"OnDrag": @(UIScrollViewKeyboardDismissModeOnDrag),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ RCT_EXPORT_MODULE()
|
|||||||
|
|
||||||
RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
|
RCT_REMAP_VIEW_PROPERTY(editable, enabled, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
|
RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, UIColor)
|
RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, UIColor)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(text, NSString)
|
RCT_EXPORT_VIEW_PROPERTY(text, NSString)
|
||||||
@@ -36,6 +36,7 @@ RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType)
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(returnKeyType, UIReturnKeyType)
|
RCT_EXPORT_VIEW_PROPERTY(returnKeyType, UIReturnKeyType)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(enablesReturnKeyAutomatically, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(enablesReturnKeyAutomatically, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL)
|
||||||
|
RCT_REMAP_VIEW_PROPERTY(password, secureTextEntry, BOOL) // backwards compatibility
|
||||||
RCT_REMAP_VIEW_PROPERTY(color, textColor, UIColor)
|
RCT_REMAP_VIEW_PROPERTY(color, textColor, UIColor)
|
||||||
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, autocapitalizationType, UITextAutocapitalizationType)
|
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, autocapitalizationType, UITextAutocapitalizationType)
|
||||||
RCT_CUSTOM_VIEW_PROPERTY(fontSize, CGFloat, RCTTextField)
|
RCT_CUSTOM_VIEW_PROPERTY(fontSize, CGFloat, RCTTextField)
|
||||||
|
|||||||
Reference in New Issue
Block a user