Skip to content

Commit 2c803b0

Browse files
committed
Merge pull request #775 from vjeux/up22
Updates from Thu 9 Apr
2 parents 83fbef5 + 0686b01 commit 2c803b0

File tree

82 files changed

+1166
-736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1166
-736
lines changed

Examples/2048/Game2048.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,29 @@ class Tile extends React.Component {
7373
if (tile.isNew()) {
7474
offset.opacity = 0;
7575
} else {
76-
var point = [
77-
animationPosition(tile.toColumn()),
78-
animationPosition(tile.toRow()),
79-
];
80-
AnimationExperimental.startAnimation(this.refs['this'], 100, 0, 'easeInOutQuad', {position: point});
76+
var point = {
77+
x: animationPosition(tile.toColumn()),
78+
y: animationPosition(tile.toRow()),
79+
};
80+
AnimationExperimental.startAnimation({
81+
node: this.refs['this'],
82+
duration: 100,
83+
easing: 'easeInOutQuad',
84+
property: 'position',
85+
toValue: point,
86+
});
8187
}
82-
8388
return offset;
8489
}
8590

86-
8791
componentDidMount() {
88-
AnimationExperimental.startAnimation(this.refs['this'], 100, 0, 'easeInOutQuad', {opacity: 1});
92+
AnimationExperimental.startAnimation({
93+
node: this.refs['this'],
94+
duration: 100,
95+
easing: 'easeInOutQuad',
96+
property: 'opacity',
97+
toValue: 1,
98+
});
8999
}
90100

91101
render() {

Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/* Begin PBXBuildFile section */
1010
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; };
11-
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE91AC0C89D00671115 /* libicucore.dylib */; };
1211
008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; };
1312
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1413
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; };
@@ -116,7 +115,6 @@
116115
isa = PBXFrameworksBuildPhase;
117116
buildActionMask = 2147483647;
118117
files = (
119-
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */,
120118
146834051AC3E58100842450 /* libReact.a in Frameworks */,
121119
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */,
122120
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,

Examples/SampleApp/iOS/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@
3636
</array>
3737
<key>UIViewControllerBasedStatusBarAppearance</key>
3838
<false/>
39+
<key>NSLocationWhenInUseUsageDescription</key>
40+
<string></string>
3941
</dict>
4042
</plist>

Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
004D28A31AAF61C70097A701 /* UIExplorerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 004D28A21AAF61C70097A701 /* UIExplorerTests.m */; };
1111
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D277131AB8C2C700DC1E48 /* libRCTWebSocketDebugger.a */; };
12-
00D2771C1AB8C55500DC1E48 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D2771B1AB8C55500DC1E48 /* libicucore.dylib */; };
1312
13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; };
1413
134180011AA9153C003F314A /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; };
1514
1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; };
@@ -118,7 +117,6 @@
118117
004D28A11AAF61C70097A701 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
119118
004D28A21AAF61C70097A701 /* UIExplorerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIExplorerTests.m; sourceTree = "<group>"; };
120119
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = ../../Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = "<group>"; };
121-
00D2771B1AB8C55500DC1E48 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
122120
13417FE31AA91428003F314A /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
123121
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
124122
134180261AA91779003F314A /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
@@ -150,7 +148,6 @@
150148
isa = PBXFrameworksBuildPhase;
151149
buildActionMask = 2147483647;
152150
files = (
153-
00D2771C1AB8C55500DC1E48 /* libicucore.dylib in Frameworks */,
154151
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */,
155152
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */,
156153
58005BF21ABA80A60062E044 /* libRCTTest.a in Frameworks */,
@@ -207,7 +204,6 @@
207204
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */,
208205
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */,
209206
D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */,
210-
00D2771B1AB8C55500DC1E48 /* libicucore.dylib */,
211207
);
212208
name = Libraries;
213209
sourceTree = "<group>";

Examples/UIExplorer/UIExplorer.xcodeproj/xcshareddata/xcschemes/UIExplorer.xcscheme

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
ignoresPersistentStateOnLaunch = "NO"
7373
debugDocumentVersioning = "YES"
7474
allowLocationSimulation = "YES">
75-
<BuildableProductRunnable>
75+
<BuildableProductRunnable
76+
runnableDebuggingMode = "0">
7677
<BuildableReference
7778
BuildableIdentifier = "primary"
7879
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
@@ -90,7 +91,8 @@
9091
useCustomWorkingDirectory = "NO"
9192
buildConfiguration = "Release"
9293
debugDocumentVersioning = "YES">
93-
<BuildableProductRunnable>
94+
<BuildableProductRunnable
95+
runnableDebuggingMode = "0">
9496
<BuildableReference
9597
BuildableIdentifier = "primary"
9698
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"

Libraries/ActionSheetIOS/RCTActionSheetManager.m

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@
1111

1212
#import "RCTLog.h"
1313

14-
@interface RCTActionSheetManager() <UIActionSheetDelegate>
14+
@interface RCTActionSheetManager () <UIActionSheetDelegate>
1515

1616
@end
1717

18-
@implementation RCTActionSheetManager {
18+
@implementation RCTActionSheetManager
19+
{
1920
NSMutableDictionary *_callbacks;
2021
}
2122

23+
RCT_EXPORT_MODULE()
24+
2225
- (instancetype)init
2326
{
2427
if ((self = [super init])) {
@@ -27,12 +30,10 @@ - (instancetype)init
2730
return self;
2831
}
2932

30-
- (void)showActionSheetWithOptions:(NSDictionary *)options
31-
failureCallback:(RCTResponseSenderBlock)failureCallback
32-
successCallback:(RCTResponseSenderBlock)successCallback
33+
RCT_EXPORT_METHOD(showActionSheetWithOptions:(NSDictionary *)options
34+
failureCallback:(RCTResponseSenderBlock)failureCallback
35+
successCallback:(RCTResponseSenderBlock)successCallback)
3336
{
34-
RCT_EXPORT();
35-
3637
dispatch_async(dispatch_get_main_queue(), ^{
3738
UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
3839

@@ -62,12 +63,10 @@ - (void)showActionSheetWithOptions:(NSDictionary *)options
6263
});
6364
}
6465

65-
- (void)showShareActionSheetWithOptions:(NSDictionary *)options
66-
failureCallback:(RCTResponseSenderBlock)failureCallback
67-
successCallback:(RCTResponseSenderBlock)successCallback
66+
RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options
67+
failureCallback:(RCTResponseSenderBlock)failureCallback
68+
successCallback:(RCTResponseSenderBlock)successCallback)
6869
{
69-
RCT_EXPORT();
70-
7170
dispatch_async(dispatch_get_main_queue(), ^{
7271
NSMutableArray *items = [NSMutableArray array];
7372
id message = options[@"message"];
@@ -134,7 +133,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger
134133

135134
#pragma mark Private
136135

137-
static NSString *keyForInstance(id instance)
136+
NS_INLINE NSString *keyForInstance(id instance)
138137
{
139138
return [NSString stringWithFormat:@"%p", instance];
140139
}

Libraries/AdSupport/RCTAdSupport.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111

1212
@implementation RCTAdSupport
1313

14-
- (void)getAdvertisingId:(RCTResponseSenderBlock)callback withErrorCallback:(RCTResponseSenderBlock)errorCallback
15-
{
16-
RCT_EXPORT();
14+
RCT_EXPORT_MODULE()
1715

16+
RCT_EXPORT_METHOD(getAdvertisingId:(RCTResponseSenderBlock)callback
17+
withErrorCallback:(RCTResponseSenderBlock)errorCallback)
18+
{
1819
if ([ASIdentifierManager class]) {
1920
callback(@[[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]);
2021
} else {
2122
return errorCallback(@[@"as_identifier_unavailable"]);
2223
}
2324
}
2425

25-
- (void)getAdvertisingTrackingEnabled:(RCTResponseSenderBlock)callback withErrorCallback:(RCTResponseSenderBlock)errorCallback
26+
RCT_EXPORT_METHOD(getAdvertisingTrackingEnabled:(RCTResponseSenderBlock)callback
27+
withErrorCallback:(RCTResponseSenderBlock)errorCallback)
2628
{
27-
RCT_EXPORT();
28-
2929
if ([ASIdentifierManager class]) {
30-
bool hasTracking = [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled];
30+
BOOL hasTracking = [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled];
3131
callback(@[@(hasTracking)]);
3232
} else {
3333
return errorCallback(@[@"as_identifier_unavailable"]);

Libraries/Animation/AnimationExperimental.js

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ var AnimationUtils = require('AnimationUtils');
1616

1717
type EasingFunction = (t: number) => number;
1818

19+
var Properties = {
20+
opacity: true,
21+
position: true,
22+
positionX: true,
23+
positionY: true,
24+
rotation: true,
25+
scaleXY: true,
26+
};
27+
28+
type ValueType = number | Array<number> | {[key: string]: number};
29+
1930
/**
2031
* This is an experimental module that is under development, incomplete,
2132
* potentially buggy, not used in any production apps, and will probably change
@@ -24,24 +35,34 @@ type EasingFunction = (t: number) => number;
2435
* Use at your own risk.
2536
*/
2637
var AnimationExperimental = {
27-
Mixin: require('AnimationExperimentalMixin'),
28-
2938
startAnimation: function(
30-
node: any,
31-
duration: number,
32-
delay: number,
33-
easing: (string | EasingFunction),
34-
properties: {[key: string]: any}
39+
anim: {
40+
node: any;
41+
duration: number;
42+
easing: ($Enum<typeof AnimationUtils.Defaults> | EasingFunction);
43+
property: $Enum<typeof Properties>;
44+
toValue: ValueType;
45+
fromValue?: ValueType;
46+
delay?: number;
47+
},
48+
callback?: ?(finished: bool) => void
3549
): number {
36-
var nodeHandle = +node.getNodeHandle();
37-
var easingSample = AnimationUtils.evaluateEasingFunction(duration, easing);
38-
var tag: number = RCTAnimationManager.startAnimation(
50+
var nodeHandle = anim.node.getNodeHandle();
51+
var easingSample = AnimationUtils.evaluateEasingFunction(
52+
anim.duration,
53+
anim.easing
54+
);
55+
var tag: number = AnimationUtils.allocateTag();
56+
var props = {};
57+
props[anim.property] = {to: anim.toValue};
58+
RCTAnimationManager.startAnimation(
3959
nodeHandle,
40-
AnimationUtils.allocateTag(),
41-
duration,
42-
delay,
60+
tag,
61+
anim.duration,
62+
anim.delay,
4363
easingSample,
44-
properties
64+
props,
65+
callback
4566
);
4667
return tag;
4768
},
@@ -51,4 +72,18 @@ var AnimationExperimental = {
5172
},
5273
};
5374

75+
if (__DEV__) {
76+
if (RCTAnimationManager && RCTAnimationManager.Properties) {
77+
var a = Object.keys(Properties);
78+
var b = RCTAnimationManager.Properties;
79+
var diff = a.filter((i) => b.indexOf(i) < 0).concat(
80+
b.filter((i) => a.indexOf(i) < 0)
81+
);
82+
if (diff.length > 0) {
83+
throw new Error('JS animation properties don\'t match native properties.' +
84+
JSON.stringify(diff, null, ' '));
85+
}
86+
}
87+
}
88+
5489
module.exports = AnimationExperimental;

Libraries/Animation/AnimationExperimentalMixin.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)