mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 16:10:58 +00:00
commit
c08243d08a
@ -99,6 +99,15 @@ var SearchScreen = React.createClass({
|
|||||||
|
|
||||||
fetch(this._urlForQueryAndPage(query, 1))
|
fetch(this._urlForQueryAndPage(query, 1))
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
.catch((error) => {
|
||||||
|
LOADING[query] = false;
|
||||||
|
resultsCache.dataForQuery[query] = undefined;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
dataSource: this.getDataSource([]),
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
})
|
||||||
.then((responseData) => {
|
.then((responseData) => {
|
||||||
LOADING[query] = false;
|
LOADING[query] = false;
|
||||||
resultsCache.totalForQuery[query] = responseData.total;
|
resultsCache.totalForQuery[query] = responseData.total;
|
||||||
@ -115,15 +124,7 @@ var SearchScreen = React.createClass({
|
|||||||
dataSource: this.getDataSource(responseData.movies),
|
dataSource: this.getDataSource(responseData.movies),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.done();
|
||||||
LOADING[query] = false;
|
|
||||||
resultsCache.dataForQuery[query] = undefined;
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
dataSource: this.getDataSource([]),
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
hasMore: function(): boolean {
|
hasMore: function(): boolean {
|
||||||
@ -157,6 +158,13 @@ var SearchScreen = React.createClass({
|
|||||||
var page = resultsCache.nextPageNumberForQuery[query];
|
var page = resultsCache.nextPageNumberForQuery[query];
|
||||||
fetch(this._urlForQueryAndPage(query, page))
|
fetch(this._urlForQueryAndPage(query, page))
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
LOADING[query] = false;
|
||||||
|
this.setState({
|
||||||
|
isLoadingTail: false,
|
||||||
|
});
|
||||||
|
})
|
||||||
.then((responseData) => {
|
.then((responseData) => {
|
||||||
var moviesForQuery = resultsCache.dataForQuery[query].slice();
|
var moviesForQuery = resultsCache.dataForQuery[query].slice();
|
||||||
|
|
||||||
@ -182,13 +190,7 @@ var SearchScreen = React.createClass({
|
|||||||
dataSource: this.getDataSource(resultsCache.dataForQuery[query]),
|
dataSource: this.getDataSource(resultsCache.dataForQuery[query]),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.done();
|
||||||
console.error(error);
|
|
||||||
LOADING[query] = false;
|
|
||||||
this.setState({
|
|
||||||
isLoadingTail: false,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataSource: function(movies: Array<any>): ListView.DataSource {
|
getDataSource: function(movies: Array<any>): ListView.DataSource {
|
||||||
|
112
Examples/UIExplorer/ActionSheetIOSExample.js
Normal file
112
Examples/UIExplorer/ActionSheetIOSExample.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* * Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
* */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var React = require('react-native');
|
||||||
|
var {
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
} = React;
|
||||||
|
var ActionSheetIOS = require('ActionSheetIOS');
|
||||||
|
var BUTTONS = [
|
||||||
|
'Button Index: 0',
|
||||||
|
'Button Index: 1',
|
||||||
|
'Button Index: 2',
|
||||||
|
'Destruct',
|
||||||
|
'Cancel',
|
||||||
|
];
|
||||||
|
var DESTRUCTIVE_INDEX = 3;
|
||||||
|
var CANCEL_INDEX = 4;
|
||||||
|
|
||||||
|
var ActionSheetExample = React.createClass({
|
||||||
|
getInitialState() {
|
||||||
|
return {
|
||||||
|
clicked: 'none',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<Text onPress={this.showActionSheet} style={style.button}>
|
||||||
|
Click to show the ActionSheet
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
Clicked button at index: "{this.state.clicked}"
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
showActionSheet() {
|
||||||
|
ActionSheetIOS.showActionSheetWithOptions({
|
||||||
|
options: BUTTONS,
|
||||||
|
cancelButtonIndex: CANCEL_INDEX,
|
||||||
|
destructiveButtonIndex: DESTRUCTIVE_INDEX,
|
||||||
|
},
|
||||||
|
(buttonIndex) => {
|
||||||
|
this.setState({ clicked: BUTTONS[buttonIndex] });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var ShareActionSheetExample = React.createClass({
|
||||||
|
getInitialState() {
|
||||||
|
return {
|
||||||
|
text: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<Text onPress={this.showShareActionSheet} style={style.button}>
|
||||||
|
Click to show the Share ActionSheet
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
{this.state.text}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
showShareActionSheet() {
|
||||||
|
ActionSheetIOS.showShareActionSheetWithOptions({
|
||||||
|
url: 'https://code.facebook.com',
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error(error);
|
||||||
|
},
|
||||||
|
(success, method) => {
|
||||||
|
var text;
|
||||||
|
if (success) {
|
||||||
|
text = `Shared via ${method}`;
|
||||||
|
} else {
|
||||||
|
text = 'You didn\'t share';
|
||||||
|
}
|
||||||
|
this.setState({text})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var style = StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
marginBottom: 10,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.title = 'ActionSheetIOS';
|
||||||
|
exports.description = 'Interface to show iOS\' action sheets';
|
||||||
|
exports.examples = [
|
||||||
|
{
|
||||||
|
title: 'Show Action Sheet',
|
||||||
|
render() { return <ActionSheetExample />; }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Show Share Action Sheet',
|
||||||
|
render() { return <ShareActionSheetExample />; }
|
||||||
|
}
|
||||||
|
];
|
@ -29,23 +29,41 @@ var AdSupportIOSExample = React.createClass({
|
|||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
deviceID: 'No IDFA yet',
|
deviceID: 'No IDFA yet',
|
||||||
|
hasAdvertiserTracking: 'unset',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
AdSupportIOS.getAdvertisingId(
|
AdSupportIOS.getAdvertisingId(
|
||||||
this._onSuccess,
|
this._onDeviceIDSuccess,
|
||||||
this._onFailure
|
this._onDeviceIDFailure
|
||||||
|
);
|
||||||
|
|
||||||
|
AdSupportIOS.getAdvertisingTrackingEnabled(
|
||||||
|
this._onHasTrackingSuccess,
|
||||||
|
this._onHasTrackingFailure
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSuccess: function(deviceID) {
|
_onHasTrackingSuccess: function(hasTracking) {
|
||||||
|
this.setState({
|
||||||
|
'hasAdvertiserTracking': hasTracking,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_onHasTrackingFailure: function(e) {
|
||||||
|
this.setState({
|
||||||
|
'hasAdvertiserTracking': 'Error!',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_onDeviceIDSuccess: function(deviceID) {
|
||||||
this.setState({
|
this.setState({
|
||||||
'deviceID': deviceID,
|
'deviceID': deviceID,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFailure: function(e) {
|
_onDeviceIDFailure: function(e) {
|
||||||
this.setState({
|
this.setState({
|
||||||
'deviceID': 'Error!',
|
'deviceID': 'Error!',
|
||||||
});
|
});
|
||||||
@ -58,6 +76,10 @@ var AdSupportIOSExample = React.createClass({
|
|||||||
<Text style={styles.title}>Advertising ID: </Text>
|
<Text style={styles.title}>Advertising ID: </Text>
|
||||||
{JSON.stringify(this.state.deviceID)}
|
{JSON.stringify(this.state.deviceID)}
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text>
|
||||||
|
<Text style={styles.title}>Has Advertiser Tracking: </Text>
|
||||||
|
{JSON.stringify(this.state.hasAdvertiserTracking)}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
|
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
|
||||||
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
||||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||||
|
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -70,6 +71,13 @@
|
|||||||
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
||||||
remoteInfo = RCTGeolocation;
|
remoteInfo = RCTGeolocation;
|
||||||
};
|
};
|
||||||
|
147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
||||||
|
remoteInfo = RCTActionSheet;
|
||||||
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@ -89,6 +97,7 @@
|
|||||||
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||||
|
14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -103,6 +112,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */,
|
||||||
134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */,
|
134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */,
|
||||||
134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */,
|
134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */,
|
||||||
1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */,
|
1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */,
|
||||||
@ -135,6 +145,7 @@
|
|||||||
1316A21D1AA397F400C0188E /* Libraries */ = {
|
1316A21D1AA397F400C0188E /* Libraries */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */,
|
||||||
13417FFA1AA91531003F314A /* ReactKit.xcodeproj */,
|
13417FFA1AA91531003F314A /* ReactKit.xcodeproj */,
|
||||||
134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */,
|
134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */,
|
||||||
134A8A201AACED6A00945AAE /* RCTGeolocation.xcodeproj */,
|
134A8A201AACED6A00945AAE /* RCTGeolocation.xcodeproj */,
|
||||||
@ -206,6 +217,14 @@
|
|||||||
name = UIExplorer;
|
name = UIExplorer;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
147CED471AB34F8C00DA3E4C /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
83CBB9F61A601CBA00E9B192 = {
|
83CBB9F61A601CBA00E9B192 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -290,6 +309,10 @@
|
|||||||
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
|
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectReferences = (
|
projectReferences = (
|
||||||
|
{
|
||||||
|
ProductGroup = 147CED471AB34F8C00DA3E4C /* Products */;
|
||||||
|
ProjectRef = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ProductGroup = 134454561AAFCAAE003F0779 /* Products */;
|
ProductGroup = 134454561AAFCAAE003F0779 /* Products */;
|
||||||
ProjectRef = 134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */;
|
ProjectRef = 134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */;
|
||||||
@ -366,6 +389,13 @@
|
|||||||
remoteRef = 134A8A241AACED6A00945AAE /* PBXContainerItemProxy */;
|
remoteRef = 134A8A241AACED6A00945AAE /* PBXContainerItemProxy */;
|
||||||
sourceTree = BUILT_PRODUCTS_DIR;
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
};
|
};
|
||||||
|
147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libRCTActionSheet.a;
|
||||||
|
remoteRef = 147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
/* End PBXReferenceProxy section */
|
/* End PBXReferenceProxy section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
@ -43,6 +43,7 @@ var EXAMPLES = [
|
|||||||
require('./AppStateIOSExample'),
|
require('./AppStateIOSExample'),
|
||||||
require('./AdSupportIOSExample'),
|
require('./AdSupportIOSExample'),
|
||||||
require('./AppStateExample'),
|
require('./AppStateExample'),
|
||||||
|
require('./ActionSheetIOSExample'),
|
||||||
];
|
];
|
||||||
|
|
||||||
var UIExplorerList = React.createClass({
|
var UIExplorerList = React.createClass({
|
||||||
|
49
Libraries/ActionSheetIOS/ActionSheetIOS.js
Normal file
49
Libraries/ActionSheetIOS/ActionSheetIOS.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* @providesModule ActionSheetIOS
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var invariant = require('invariant');
|
||||||
|
var RCTActionSheetManager = require('NativeModulesDeprecated').RKActionSheetManager;
|
||||||
|
|
||||||
|
var ActionSheetIOS = {
|
||||||
|
showActionSheetWithOptions(options, callback) {
|
||||||
|
invariant(
|
||||||
|
typeof options === 'object' && options !== null,
|
||||||
|
'Options must a valid object'
|
||||||
|
);
|
||||||
|
invariant(
|
||||||
|
typeof callback === 'function',
|
||||||
|
'Must provide a valid callback'
|
||||||
|
);
|
||||||
|
RCTActionSheetManager.showActionSheetWithOptions(
|
||||||
|
options,
|
||||||
|
() => {}, // RKActionSheet compatibility hack
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
showShareActionSheetWithOptions(options, failureCallback, successCallback) {
|
||||||
|
invariant(
|
||||||
|
typeof options === 'object' && options !== null,
|
||||||
|
'Options must a valid object'
|
||||||
|
);
|
||||||
|
invariant(
|
||||||
|
typeof failureCallback === 'function',
|
||||||
|
'Must provide a valid failureCallback'
|
||||||
|
);
|
||||||
|
invariant(
|
||||||
|
typeof successCallback === 'function',
|
||||||
|
'Must provide a valid successCallback'
|
||||||
|
);
|
||||||
|
RCTActionSheetManager.showShareActionSheetWithOptions(
|
||||||
|
options,
|
||||||
|
failureCallback,
|
||||||
|
successCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = ActionSheetIOS;
|
@ -0,0 +1,250 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 46;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "include/$(PRODUCT_NAME)";
|
||||||
|
dstSubfolderSpec = 16;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
134814201AA4EA6300B7C361 /* libRCTActionSheet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTActionSheet.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTActionSheetManager.h; sourceTree = "<group>"; };
|
||||||
|
14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTActionSheetManager.m; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
134814211AA4EA7D00B7C361 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
134814201AA4EA6300B7C361 /* libRCTActionSheet.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
58B511D21A9E6C8500147676 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */,
|
||||||
|
14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */,
|
||||||
|
134814211AA4EA7D00B7C361 /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
58B511DA1A9E6C8500147676 /* RCTActionSheet */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */;
|
||||||
|
buildPhases = (
|
||||||
|
58B511D71A9E6C8500147676 /* Sources */,
|
||||||
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
||||||
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = RCTActionSheet;
|
||||||
|
productName = RCTDataManager;
|
||||||
|
productReference = 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */;
|
||||||
|
productType = "com.apple.product-type.library.static";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
58B511D31A9E6C8500147676 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
LastUpgradeCheck = 0610;
|
||||||
|
ORGANIZATIONNAME = Facebook;
|
||||||
|
TargetAttributes = {
|
||||||
|
58B511DA1A9E6C8500147676 = {
|
||||||
|
CreatedOnToolsVersion = 6.1.1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */;
|
||||||
|
compatibilityVersion = "Xcode 3.2";
|
||||||
|
developmentRegion = English;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
);
|
||||||
|
mainGroup = 58B511D21A9E6C8500147676;
|
||||||
|
productRefGroup = 58B511D21A9E6C8500147676;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
58B511DA1A9E6C8500147676 /* RCTActionSheet */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
58B511D71A9E6C8500147676 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
58B511ED1A9E6C8500147676 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
58B511EE1A9E6C8500147676 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = YES;
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||||
|
"$(SRCROOT)/../../ReactKit/**",
|
||||||
|
);
|
||||||
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = RCTActionSheet;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
58B511F11A9E6C8500147676 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||||
|
"$(SRCROOT)/../../ReactKit/**",
|
||||||
|
);
|
||||||
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = RCTActionSheet;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
58B511ED1A9E6C8500147676 /* Debug */,
|
||||||
|
58B511EE1A9E6C8500147676 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
58B511F01A9E6C8500147676 /* Debug */,
|
||||||
|
58B511F11A9E6C8500147676 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
||||||
|
}
|
9
Libraries/ActionSheetIOS/RCTActionSheetManager.h
Normal file
9
Libraries/ActionSheetIOS/RCTActionSheetManager.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
#import "RCTBridge.h"
|
||||||
|
|
||||||
|
@interface RCTActionSheetManager : NSObject <RCTBridgeModule>
|
||||||
|
|
||||||
|
@end
|
120
Libraries/ActionSheetIOS/RCTActionSheetManager.m
Normal file
120
Libraries/ActionSheetIOS/RCTActionSheetManager.m
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
#import "RCTActionSheetManager.h"
|
||||||
|
|
||||||
|
#import "RCTLog.h"
|
||||||
|
|
||||||
|
@interface RCTActionSheetManager() <UIActionSheetDelegate>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation RCTActionSheetManager {
|
||||||
|
NSMutableDictionary *_callbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)init
|
||||||
|
{
|
||||||
|
if ((self = [super init])) {
|
||||||
|
_callbacks = [[NSMutableDictionary alloc] init];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)showActionSheetWithOptions:(NSDictionary *)options
|
||||||
|
failureCallback:(RCTResponseSenderBlock)failureCallback
|
||||||
|
successCallback:(RCTResponseSenderBlock)successCallback
|
||||||
|
{
|
||||||
|
RCT_EXPORT();
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
|
||||||
|
|
||||||
|
actionSheet.title = options[@"title"];
|
||||||
|
|
||||||
|
for (NSString *option in options[@"options"]) {
|
||||||
|
[actionSheet addButtonWithTitle:option];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options[@"destructiveButtonIndex"]) {
|
||||||
|
actionSheet.destructiveButtonIndex = [options[@"destructiveButtonIndex"] integerValue];
|
||||||
|
}
|
||||||
|
if (options[@"cancelButtonIndex"]) {
|
||||||
|
actionSheet.cancelButtonIndex = [options[@"cancelButtonIndex"] integerValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
actionSheet.delegate = self;
|
||||||
|
|
||||||
|
_callbacks[keyForInstance(actionSheet)] = successCallback;
|
||||||
|
|
||||||
|
UIWindow *appWindow = [[[UIApplication sharedApplication] delegate] window];
|
||||||
|
if (appWindow == nil) {
|
||||||
|
RCTLogError(@"Tried to display action sheet but there is no application window. options: %@", options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[actionSheet showInView:appWindow];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)showShareActionSheetWithOptions:(NSDictionary *)options
|
||||||
|
failureCallback:(RCTResponseSenderBlock)failureCallback
|
||||||
|
successCallback:(RCTResponseSenderBlock)successCallback
|
||||||
|
{
|
||||||
|
RCT_EXPORT();
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
NSMutableArray *items = [NSMutableArray array];
|
||||||
|
id message = options[@"message"];
|
||||||
|
id url = options[@"url"];
|
||||||
|
if ([message isKindOfClass:[NSString class]]) {
|
||||||
|
[items addObject:message];
|
||||||
|
}
|
||||||
|
if ([url isKindOfClass:[NSString class]]) {
|
||||||
|
[items addObject:[NSURL URLWithString:url]];
|
||||||
|
}
|
||||||
|
if ([items count] == 0) {
|
||||||
|
failureCallback(@[@"No `url` or `message` to share"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UIActivityViewController *share = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
|
||||||
|
UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
|
||||||
|
if ([share respondsToSelector:@selector(setCompletionWithItemsHandler:)]) {
|
||||||
|
share.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
|
||||||
|
if (activityError) {
|
||||||
|
failureCallback(@[[activityError localizedDescription]]);
|
||||||
|
} else {
|
||||||
|
successCallback(@[@(completed), (activityType ?: [NSNull null])]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
share.completionHandler = ^(NSString *activityType, BOOL completed) {
|
||||||
|
successCallback(@[@(completed), (activityType ?: [NSNull null])]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
[ctrl presentViewController:share animated:YES completion:nil];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark UIActionSheetDelegate Methods
|
||||||
|
|
||||||
|
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||||
|
{
|
||||||
|
NSString *key = keyForInstance(actionSheet);
|
||||||
|
RCTResponseSenderBlock callback = _callbacks[key];
|
||||||
|
if (callback) {
|
||||||
|
callback(@[@(buttonIndex)]);
|
||||||
|
[_callbacks removeObjectForKey:key];
|
||||||
|
} else {
|
||||||
|
RCTLogWarn(@"No callback registered for action sheet: %@", actionSheet.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[[[UIApplication sharedApplication] delegate] window] makeKeyWindow];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark Private
|
||||||
|
|
||||||
|
static NSString *keyForInstance(id instance)
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"%p", instance];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -11,4 +11,8 @@ module.exports = {
|
|||||||
getAdvertisingId: function(onSuccess, onFailure) {
|
getAdvertisingId: function(onSuccess, onFailure) {
|
||||||
AdSupport.getAdvertisingId(onSuccess, onFailure);
|
AdSupport.getAdvertisingId(onSuccess, onFailure);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAdvertisingTrackingEnabled: function(onSuccess, onFailure) {
|
||||||
|
AdSupport.getAdvertisingTrackingEnabled(onSuccess, onFailure);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -15,4 +15,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)getAdvertisingTrackingEnabled:(RCTResponseSenderBlock)callback withErrorCallback:(RCTResponseSenderBlock)errorCallback
|
||||||
|
{
|
||||||
|
RCT_EXPORT();
|
||||||
|
|
||||||
|
if ([ASIdentifierManager class]) {
|
||||||
|
bool hasTracking = [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled];
|
||||||
|
callback(@[@(hasTracking)]);
|
||||||
|
} else {
|
||||||
|
return errorCallback(@[@"as_identifier_unavailable"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -47,17 +47,6 @@ var keyboardDismissModeConstants = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var ScrollView = React.createClass({
|
var ScrollView = React.createClass({
|
||||||
|
|
||||||
// Only for compatibility with Android which is not yet up to date,
|
|
||||||
// DO NOT ADD NEW CALL SITES!
|
|
||||||
statics: {
|
|
||||||
keyboardDismissMode: {
|
|
||||||
None: 'none',
|
|
||||||
Interactive: 'interactive',
|
|
||||||
OnDrag: 'onDrag',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
automaticallyAdjustContentInsets: PropTypes.bool, // true
|
automaticallyAdjustContentInsets: PropTypes.bool, // true
|
||||||
contentInset: EdgeInsetsPropType, // zeros
|
contentInset: EdgeInsetsPropType, // zeros
|
||||||
@ -194,7 +183,7 @@ var ScrollView = React.createClass({
|
|||||||
|
|
||||||
scrollTo: function(destY, destX) {
|
scrollTo: function(destY, destX) {
|
||||||
RKUIManager.scrollTo(
|
RKUIManager.scrollTo(
|
||||||
ReactIOSTagHandles.rootNodeIDToTag[this._rootNodeID],
|
this.getNodeHandle(),
|
||||||
destX || 0,
|
destX || 0,
|
||||||
destY || 0
|
destY || 0
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||||
var RCTLocationObserver = require('NativeModulesDeprecated').RKLocationObserver;
|
var RCTLocationObserver = require('NativeModules').RCTLocationObserver;
|
||||||
|
|
||||||
var invariant = require('invariant');
|
var invariant = require('invariant');
|
||||||
var logError = require('logError');
|
var logError = require('logError');
|
||||||
@ -34,9 +34,9 @@ var Geolocation = {
|
|||||||
'Must provide a valid geo_success callback.'
|
'Must provide a valid geo_success callback.'
|
||||||
);
|
);
|
||||||
RCTLocationObserver.getCurrentPosition(
|
RCTLocationObserver.getCurrentPosition(
|
||||||
|
geo_options || {},
|
||||||
geo_success,
|
geo_success,
|
||||||
geo_error || logError,
|
geo_error || logError
|
||||||
geo_options || {}
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -180,9 +180,9 @@ static NSDictionary *RCTPositionError(RCTPositionErrorCode code, NSString *msg /
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getCurrentPosition:(RCTResponseSenderBlock)successBlock
|
- (void)getCurrentPosition:(NSDictionary *)optionsJSON
|
||||||
withErrorCallback:(RCTResponseSenderBlock)errorBlock
|
withSuccessCallback:(RCTResponseSenderBlock)successBlock
|
||||||
options:(NSDictionary *)optionsJSON
|
errorCallback:(RCTResponseSenderBlock)errorBlock
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ function setupDocumentShim() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sourceMapPromise;
|
||||||
|
|
||||||
function handleErrorWithRedBox(e) {
|
function handleErrorWithRedBox(e) {
|
||||||
var RKExceptionsManager = require('NativeModules').RKExceptionsManager;
|
var RKExceptionsManager = require('NativeModules').RKExceptionsManager;
|
||||||
var errorToString = require('errorToString');
|
var errorToString = require('errorToString');
|
||||||
@ -73,13 +75,14 @@ function handleErrorWithRedBox(e) {
|
|||||||
if (RKExceptionsManager) {
|
if (RKExceptionsManager) {
|
||||||
RKExceptionsManager.reportUnhandledException(e.message, errorToString(e));
|
RKExceptionsManager.reportUnhandledException(e.message, errorToString(e));
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
try {
|
(sourceMapPromise = sourceMapPromise || loadSourceMap())
|
||||||
var sourceMapInstance = loadSourceMap();
|
.then(map => {
|
||||||
var prettyStack = errorToString(e, sourceMapInstance);
|
var prettyStack = errorToString(e, map);
|
||||||
RKExceptionsManager.updateExceptionMessage(e.message, prettyStack);
|
RKExceptionsManager.updateExceptionMessage(e.message, prettyStack);
|
||||||
} catch (ee) {
|
})
|
||||||
GLOBAL.console.error('#CLOWNTOWN (error while displaying error): ' + ee.message);
|
.then(null, error => {
|
||||||
}
|
GLOBAL.console.error('#CLOWNTOWN (error while displaying error): ' + error.message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,42 @@
|
|||||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* @providesModule loadSourceMap
|
* @providesModule loadSourceMap
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var Promise = require('Promise');
|
||||||
|
var RCTSourceCode = require('NativeModules').RCTSourceCode;
|
||||||
var SourceMapConsumer = require('SourceMap').SourceMapConsumer;
|
var SourceMapConsumer = require('SourceMap').SourceMapConsumer;
|
||||||
|
var SourceMapURL = require('./source-map-url');
|
||||||
|
|
||||||
var sourceMapInstance;
|
var fetch = require('fetch');
|
||||||
|
|
||||||
function loadSourceMap() {
|
function loadSourceMap(): Promise {
|
||||||
if (sourceMapInstance !== undefined) {
|
return fetchSourceMap()
|
||||||
return sourceMapInstance;
|
.then(map => new SourceMapConsumer(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchSourceMap(): Promise {
|
||||||
|
if (global.RAW_SOURCE_MAP) {
|
||||||
|
return Promise.resolve(global.RAW_SOURCE_MAP);
|
||||||
}
|
}
|
||||||
if (!global.RAW_SOURCE_MAP) {
|
|
||||||
return null;
|
if (!RCTSourceCode) {
|
||||||
|
return Promise.reject(new Error('RCTSourceCode module is not available'));
|
||||||
}
|
}
|
||||||
sourceMapInstance = new SourceMapConsumer(global.RAW_SOURCE_MAP);
|
|
||||||
return sourceMapInstance;
|
return new Promise(RCTSourceCode.getScriptText)
|
||||||
|
.then(extractSourceMapURL)
|
||||||
|
.then(fetch)
|
||||||
|
.then(response => response.text())
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractSourceMapURL({url, text}): string {
|
||||||
|
var mapURL = SourceMapURL.getFrom(text);
|
||||||
|
var baseURL = url.match(/(.+:\/\/.*?)\//)[1];
|
||||||
|
return baseURL + mapURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = loadSourceMap;
|
module.exports = loadSourceMap;
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This is a third-party micro-library grabbed from:
|
||||||
|
* https://github.com/lydell/source-map-url
|
||||||
|
*
|
||||||
|
* @nolint
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var define = null; // Hack to make it work with our packager
|
||||||
|
|
||||||
|
// Copyright 2014 Simon Lydell
|
||||||
|
// X11 (“MIT”) Licensed. (See LICENSE.)
|
||||||
|
|
||||||
|
void (function(root, factory) {
|
||||||
|
if (typeof define === "function" && define.amd) {
|
||||||
|
define(factory)
|
||||||
|
} else if (typeof exports === "object") {
|
||||||
|
module.exports = factory()
|
||||||
|
} else {
|
||||||
|
root.sourceMappingURL = factory()
|
||||||
|
}
|
||||||
|
}(this, function() {
|
||||||
|
|
||||||
|
var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/
|
||||||
|
|
||||||
|
var regex = RegExp(
|
||||||
|
"(?:" +
|
||||||
|
"/\\*" +
|
||||||
|
"(?:\\s*\r?\n(?://)?)?" +
|
||||||
|
"(?:" + innerRegex.source + ")" +
|
||||||
|
"\\s*" +
|
||||||
|
"\\*/" +
|
||||||
|
"|" +
|
||||||
|
"//(?:" + innerRegex.source + ")" +
|
||||||
|
")" +
|
||||||
|
"\\s*$"
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
regex: regex,
|
||||||
|
_innerRegex: innerRegex,
|
||||||
|
|
||||||
|
getFrom: function(code) {
|
||||||
|
var match = code.match(regex)
|
||||||
|
return (match ? match[1] || match[2] || "" : null)
|
||||||
|
},
|
||||||
|
|
||||||
|
existsIn: function(code) {
|
||||||
|
return regex.test(code)
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFrom: function(code) {
|
||||||
|
return code.replace(regex, "")
|
||||||
|
},
|
||||||
|
|
||||||
|
insertBefore: function(code, string) {
|
||||||
|
var match = code.match(regex)
|
||||||
|
if (match) {
|
||||||
|
return code.slice(0, match.index) + string + code.slice(match.index)
|
||||||
|
} else {
|
||||||
|
return code + string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
/** End of the third-party code */
|
||||||
|
|
||||||
|
})();
|
@ -8,6 +8,7 @@
|
|||||||
#import "RCTKeyCommands.h"
|
#import "RCTKeyCommands.h"
|
||||||
#import "RCTLog.h"
|
#import "RCTLog.h"
|
||||||
#import "RCTRedBox.h"
|
#import "RCTRedBox.h"
|
||||||
|
#import "RCTSourceCode.h"
|
||||||
#import "RCTTouchHandler.h"
|
#import "RCTTouchHandler.h"
|
||||||
#import "RCTUIManager.h"
|
#import "RCTUIManager.h"
|
||||||
#import "RCTUtils.h"
|
#import "RCTUtils.h"
|
||||||
@ -200,6 +201,10 @@ static Class _globalExecutorClass;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
|
RCTSourceCode *sourceCodeModule = _bridge.modules[NSStringFromClass([RCTSourceCode class])];
|
||||||
|
sourceCodeModule.scriptURL = _scriptURL;
|
||||||
|
sourceCodeModule.scriptText = rawText;
|
||||||
|
|
||||||
[_bridge enqueueApplicationScript:rawText url:_scriptURL onComplete:^(NSError *error) {
|
[_bridge enqueueApplicationScript:rawText url:_scriptURL onComplete:^(NSError *error) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self bundleFinishedLoading:error];
|
[self bundleFinishedLoading:error];
|
||||||
|
12
ReactKit/Modules/RCTSourceCode.h
Normal file
12
ReactKit/Modules/RCTSourceCode.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#import "RCTBridgeModule.h"
|
||||||
|
|
||||||
|
@interface RCTSourceCode : NSObject <RCTBridgeModule>
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *scriptText;
|
||||||
|
@property (nonatomic, copy) NSURL *scriptURL;
|
||||||
|
|
||||||
|
@end
|
21
ReactKit/Modules/RCTSourceCode.m
Normal file
21
ReactKit/Modules/RCTSourceCode.m
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
#import "RCTSourceCode.h"
|
||||||
|
|
||||||
|
#import "RCTAssert.h"
|
||||||
|
#import "RCTUtils.h"
|
||||||
|
|
||||||
|
@implementation RCTSourceCode
|
||||||
|
|
||||||
|
- (void)getScriptText:(RCTResponseSenderBlock)successCallback failureCallback:(RCTResponseSenderBlock)failureCallback
|
||||||
|
{
|
||||||
|
RCT_EXPORT();
|
||||||
|
if (self.scriptText && self.scriptURL) {
|
||||||
|
successCallback(@[@{@"text": self.scriptText, @"url":[self.scriptURL absoluteString]}]);
|
||||||
|
} else {
|
||||||
|
failureCallback(@[RCTMakeError(@"Source code is not available", nil, nil)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -7,6 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */; };
|
||||||
134FCB361A6D42D900051CC8 /* RCTSparseArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */; };
|
134FCB361A6D42D900051CC8 /* RCTSparseArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */; };
|
||||||
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTContextExecutor.m */; };
|
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTContextExecutor.m */; };
|
||||||
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3C1A6E7F0800051CC8 /* RCTWebViewExecutor.m */; };
|
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3C1A6E7F0800051CC8 /* RCTWebViewExecutor.m */; };
|
||||||
@ -42,8 +43,8 @@
|
|||||||
14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */; };
|
14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */; };
|
||||||
58114A161AAE854800E7D092 /* RCTPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A131AAE854800E7D092 /* RCTPicker.m */; };
|
58114A161AAE854800E7D092 /* RCTPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A131AAE854800E7D092 /* RCTPicker.m */; };
|
||||||
58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A151AAE854800E7D092 /* RCTPickerManager.m */; };
|
58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A151AAE854800E7D092 /* RCTPickerManager.m */; };
|
||||||
58C571C11AA56C1900CDF9C8 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; };
|
|
||||||
58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; };
|
58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; };
|
||||||
|
58C571C11AA56C1900CDF9C8 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; };
|
||||||
830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; };
|
830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; };
|
||||||
830BA4551A8E3BDA00D53203 /* RCTCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 830BA4541A8E3BDA00D53203 /* RCTCache.m */; };
|
830BA4551A8E3BDA00D53203 /* RCTCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 830BA4541A8E3BDA00D53203 /* RCTCache.m */; };
|
||||||
832348161A77A5AA00B55238 /* Layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FC71A68125100A75B9A /* Layout.c */; };
|
832348161A77A5AA00B55238 /* Layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FC71A68125100A75B9A /* Layout.c */; };
|
||||||
@ -72,6 +73,8 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSourceCode.h; sourceTree = "<group>"; };
|
||||||
|
000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSourceCode.m; sourceTree = "<group>"; };
|
||||||
13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimationType.h; sourceTree = "<group>"; };
|
13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimationType.h; sourceTree = "<group>"; };
|
||||||
13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointerEvents.h; sourceTree = "<group>"; };
|
13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointerEvents.h; sourceTree = "<group>"; };
|
||||||
13442BF41AA90E0B0037E5B0 /* RCTViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTViewControllerProtocol.h; sourceTree = "<group>"; };
|
13442BF41AA90E0B0037E5B0 /* RCTViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTViewControllerProtocol.h; sourceTree = "<group>"; };
|
||||||
@ -149,10 +152,10 @@
|
|||||||
58114A131AAE854800E7D092 /* RCTPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPicker.m; sourceTree = "<group>"; };
|
58114A131AAE854800E7D092 /* RCTPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPicker.m; sourceTree = "<group>"; };
|
||||||
58114A141AAE854800E7D092 /* RCTPickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPickerManager.h; sourceTree = "<group>"; };
|
58114A141AAE854800E7D092 /* RCTPickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPickerManager.h; sourceTree = "<group>"; };
|
||||||
58114A151AAE854800E7D092 /* RCTPickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPickerManager.m; sourceTree = "<group>"; };
|
58114A151AAE854800E7D092 /* RCTPickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPickerManager.m; sourceTree = "<group>"; };
|
||||||
58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDatePickerManager.m; sourceTree = "<group>"; };
|
|
||||||
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
|
|
||||||
58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAsyncLocalStorage.m; sourceTree = "<group>"; };
|
58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAsyncLocalStorage.m; sourceTree = "<group>"; };
|
||||||
58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAsyncLocalStorage.h; sourceTree = "<group>"; };
|
58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAsyncLocalStorage.h; sourceTree = "<group>"; };
|
||||||
|
58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDatePickerManager.m; sourceTree = "<group>"; };
|
||||||
|
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
|
||||||
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
|
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
|
||||||
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
|
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
|
||||||
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
|
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
|
||||||
@ -227,6 +230,8 @@
|
|||||||
58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */,
|
58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */,
|
||||||
13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */,
|
13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */,
|
||||||
13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */,
|
13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */,
|
||||||
|
000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */,
|
||||||
|
000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */,
|
||||||
13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */,
|
13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */,
|
||||||
13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */,
|
13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */,
|
||||||
13B07FED1A69327A00A75B9A /* RCTTiming.h */,
|
13B07FED1A69327A00A75B9A /* RCTTiming.h */,
|
||||||
@ -440,6 +445,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */,
|
13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */,
|
||||||
|
000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */,
|
||||||
13B0801E1A69489C00A75B9A /* RCTTextField.m in Sources */,
|
13B0801E1A69489C00A75B9A /* RCTTextField.m in Sources */,
|
||||||
13B07FEF1A69327A00A75B9A /* RCTAlertManager.m in Sources */,
|
13B07FEF1A69327A00A75B9A /* RCTAlertManager.m in Sources */,
|
||||||
83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */,
|
83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#import "RCTMap.h"
|
#import "RCTMap.h"
|
||||||
|
|
||||||
|
#import "RCTConvert.h"
|
||||||
#import "RCTEventDispatcher.h"
|
#import "RCTEventDispatcher.h"
|
||||||
#import "RCTLog.h"
|
#import "RCTLog.h"
|
||||||
#import "RCTUtils.h"
|
#import "RCTUtils.h"
|
||||||
@ -90,18 +91,9 @@ const CGFloat RCTMapZoomBoundBuffer = 0.01;
|
|||||||
{
|
{
|
||||||
if (region) {
|
if (region) {
|
||||||
MKCoordinateRegion coordinateRegion = self.region;
|
MKCoordinateRegion coordinateRegion = self.region;
|
||||||
if ([region[@"latitude"] isKindOfClass:[NSNumber class]]) {
|
coordinateRegion.center.latitude = [RCTConvert double:region[@"latitude"]];
|
||||||
coordinateRegion.center.latitude = [region[@"latitude"] doubleValue];
|
coordinateRegion.center.longitude = [RCTConvert double:region[@"longitude"]];
|
||||||
} else {
|
|
||||||
RCTLogError(@"region must include numeric latitude, got: %@", region);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ([region[@"longitude"] isKindOfClass:[NSNumber class]]) {
|
|
||||||
coordinateRegion.center.longitude = [region[@"longitude"] doubleValue];
|
|
||||||
} else {
|
|
||||||
RCTLogError(@"region must include numeric longitude, got: %@", region);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ([region[@"latitudeDelta"] isKindOfClass:[NSNumber class]]) {
|
if ([region[@"latitudeDelta"] isKindOfClass:[NSNumber class]]) {
|
||||||
coordinateRegion.span.latitudeDelta = [region[@"latitudeDelta"] doubleValue];
|
coordinateRegion.span.latitudeDelta = [region[@"latitudeDelta"] doubleValue];
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,11 @@ RCT_REMAP_VIEW_PROPERTY(region, JSONRegion)
|
|||||||
|
|
||||||
- (void)mapView:(RCTMap *)mapView regionDidChangeAnimated:(BOOL)animated
|
- (void)mapView:(RCTMap *)mapView regionDidChangeAnimated:(BOOL)animated
|
||||||
{
|
{
|
||||||
[self _regionChanged:mapView];
|
|
||||||
[self _emitRegionChangeEvent:mapView continuous:NO];
|
|
||||||
|
|
||||||
[mapView.regionChangeObserveTimer invalidate];
|
[mapView.regionChangeObserveTimer invalidate];
|
||||||
mapView.regionChangeObserveTimer = nil;
|
mapView.regionChangeObserveTimer = nil;
|
||||||
|
|
||||||
|
[self _regionChanged:mapView];
|
||||||
|
[self _emitRegionChangeEvent:mapView continuous:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Private
|
#pragma mark Private
|
||||||
|
@ -47,7 +47,7 @@ function setLinterTransform(transformSource) {
|
|||||||
eslint.linter.verify = function(text, config, filename, saveState) {
|
eslint.linter.verify = function(text, config, filename, saveState) {
|
||||||
var transformedText;
|
var transformedText;
|
||||||
try {
|
try {
|
||||||
transformedText = transformSource(text);
|
transformedText = transformSource(text, filename);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [{
|
return [{
|
||||||
severity: 2,
|
severity: 2,
|
||||||
|
@ -100,6 +100,20 @@ var APIDoc = React.createClass({
|
|||||||
.join('\n');
|
.join('\n');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderTypehint: function(typehint) {
|
||||||
|
try {
|
||||||
|
var typehint = JSON.parse(typehint);
|
||||||
|
} catch(e) {
|
||||||
|
return typehint;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typehint.type === 'simple') {
|
||||||
|
return typehint.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ':(' + JSON.stringify(typehint);
|
||||||
|
},
|
||||||
|
|
||||||
renderMethod: function(method) {
|
renderMethod: function(method) {
|
||||||
return (
|
return (
|
||||||
<div className="prop" key={method.name}>
|
<div className="prop" key={method.name}>
|
||||||
@ -110,15 +124,10 @@ var APIDoc = React.createClass({
|
|||||||
{method.name}(
|
{method.name}(
|
||||||
<span className="propType">
|
<span className="propType">
|
||||||
{method.params
|
{method.params
|
||||||
.map(function(param) {
|
.map((param) => {
|
||||||
var res = param.name;
|
var res = param.name;
|
||||||
if (param.typehint) {
|
if (param.typehint) {
|
||||||
try {
|
res += ': ' + this.renderTypehint(param.typehint);
|
||||||
var typehint = JSON.parse(param.typehint).value;
|
|
||||||
} catch(e) {
|
|
||||||
var typehint = param.typehint;
|
|
||||||
}
|
|
||||||
res += ': ' + typehint;
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
@ -126,6 +135,9 @@ var APIDoc = React.createClass({
|
|||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
</Header>
|
</Header>
|
||||||
|
{method.docblock && <Marked>
|
||||||
|
{this.removeCommentsFromDocblock(method.docblock)}
|
||||||
|
</Marked>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@ var docs = require('../react-docgen');
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var slugify = require('../core/slugify');
|
var slugify = require('../core/slugify');
|
||||||
var jsDocs = require('../jsdocs/jsdocs.js')
|
var jsDocs = require('../jsdocs/jsdocs.js');
|
||||||
|
|
||||||
function getNameFromPath(filepath) {
|
function getNameFromPath(filepath) {
|
||||||
var ext = null;
|
var ext = null;
|
||||||
@ -41,7 +41,9 @@ var components = [
|
|||||||
'../Libraries/Text/ExpandingText.js',
|
'../Libraries/Text/ExpandingText.js',
|
||||||
'../Libraries/Image/Image.ios.js',
|
'../Libraries/Image/Image.ios.js',
|
||||||
'../Libraries/Components/ListView/ListView.js',
|
'../Libraries/Components/ListView/ListView.js',
|
||||||
|
'../Libraries/Components/MapView/MapView.js',
|
||||||
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
|
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
|
||||||
|
'../Libraries/Picker/PickerIOS.ios.js',
|
||||||
'../Libraries/Components/ScrollView/ScrollView.js',
|
'../Libraries/Components/ScrollView/ScrollView.js',
|
||||||
'../Libraries/Components/Slider/Slider.js',
|
'../Libraries/Components/Slider/Slider.js',
|
||||||
'../Libraries/Components/SwitchIOS/SwitchIOS.ios.js',
|
'../Libraries/Components/SwitchIOS/SwitchIOS.ios.js',
|
||||||
@ -55,8 +57,11 @@ var components = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
var apis = [
|
var apis = [
|
||||||
'../Libraries/AppRegistry/AppRegistry.js',
|
|
||||||
'../Libraries/Animation/Animation.js',
|
'../Libraries/Animation/Animation.js',
|
||||||
|
'../Libraries/AppRegistry/AppRegistry.js',
|
||||||
|
'../Libraries/AppState/AppState.js',
|
||||||
|
'../Libraries/AppStateIOS/AppStateIOS.ios.js',
|
||||||
|
'../Libraries/Storage/AsyncStorage.ios.js',
|
||||||
'../Libraries/CameraRoll/CameraRoll.js',
|
'../Libraries/CameraRoll/CameraRoll.js',
|
||||||
'../Libraries/Animation/LayoutAnimation.js',
|
'../Libraries/Animation/LayoutAnimation.js',
|
||||||
'../Libraries/Utilities/PixelRatio.js',
|
'../Libraries/Utilities/PixelRatio.js',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user