Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c4be5e

Browse files
committed
Merge pull request facebook#2608 from facebook/Update_Tue_8_Sep
Update tue 8 sep
2 parents b9049ee + f9b2709 commit 1c4be5e

File tree

94 files changed

+4061
-819
lines changed

Some content is hidden

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

94 files changed

+4061
-819
lines changed

Examples/2048/2048/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3636
* on the same Wi-Fi network.
3737
*/
3838

39-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios"];
39+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios&dev=true"];
4040

4141
/**
4242
* OPTION 2

Examples/Movies/Movies.xcodeproj/project.pbxproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
83CBB9F71A601CBA00E9B192 /* Project object */ = {
217217
isa = PBXProject;
218218
attributes = {
219-
LastUpgradeCheck = 0610;
219+
LastUpgradeCheck = 0700;
220220
ORGANIZATIONNAME = Facebook;
221221
};
222222
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Movies" */;
@@ -358,6 +358,7 @@
358358
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
359359
LIBRARY_SEARCH_PATHS = "$(inherited)";
360360
OTHER_LDFLAGS = "-ObjC";
361+
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
361362
PRODUCT_NAME = Movies;
362363
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../Libraries/**";
363364
};
@@ -376,6 +377,7 @@
376377
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
377378
LIBRARY_SEARCH_PATHS = "$(inherited)";
378379
OTHER_LDFLAGS = "-ObjC";
380+
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
379381
PRODUCT_NAME = Movies;
380382
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../Libraries/**";
381383
};
@@ -401,6 +403,7 @@
401403
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
402404
COPY_PHASE_STRIP = NO;
403405
ENABLE_STRICT_OBJC_MSGSEND = YES;
406+
ENABLE_TESTABILITY = YES;
404407
GCC_C_LANGUAGE_STANDARD = gnu99;
405408
GCC_DYNAMIC_NO_PIC = NO;
406409
GCC_OPTIMIZATION_LEVEL = 0;

Examples/Movies/Movies.xcodeproj/xcshareddata/xcschemes/Movies.xcscheme

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0610"
3+
LastUpgradeVersion = "0700"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -38,6 +38,8 @@
3838
ReferencedContainer = "container:Movies.xcodeproj">
3939
</BuildableReference>
4040
</MacroExpansion>
41+
<AdditionalOptions>
42+
</AdditionalOptions>
4143
</TestAction>
4244
<LaunchAction
4345
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
@@ -47,8 +49,10 @@
4749
buildConfiguration = "Debug"
4850
ignoresPersistentStateOnLaunch = "NO"
4951
debugDocumentVersioning = "YES"
52+
debugServiceExtension = "internal"
5053
allowLocationSimulation = "YES">
51-
<BuildableProductRunnable>
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
5256
<BuildableReference
5357
BuildableIdentifier = "primary"
5458
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
@@ -66,7 +70,8 @@
6670
useCustomWorkingDirectory = "NO"
6771
buildConfiguration = "Release"
6872
debugDocumentVersioning = "YES">
69-
<BuildableProductRunnable>
73+
<BuildableProductRunnable
74+
runnableDebuggingMode = "0">
7075
<BuildableReference
7176
BuildableIdentifier = "primary"
7277
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"

Examples/Movies/Movies/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3737
* on the same Wi-Fi network.
3838
*/
3939

40-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle"];
40+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true"];
4141

4242
/**
4343
* OPTION 2

Examples/Movies/Movies/Info.plist

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIdentifier</key>
10-
<string>com.facebook.$(PRODUCT_NAME:rfc1034identifier)</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>
@@ -33,6 +33,11 @@
3333
<string>1</string>
3434
<key>LSRequiresIPhoneOS</key>
3535
<true/>
36+
<key>NSAppTransportSecurity</key>
37+
<dict>
38+
<key>NSAllowsArbitraryLoads</key>
39+
<true/>
40+
</dict>
3641
<key>UILaunchStoryboardName</key>
3742
<string>LaunchScreen</string>
3843
<key>UIRequiredDeviceCapabilities</key>
@@ -47,11 +52,5 @@
4752
</array>
4853
<key>UIViewControllerBasedStatusBarAppearance</key>
4954
<false/>
50-
<key>NSAppTransportSecurity</key>
51-
<dict>
52-
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
53-
<key>NSAllowsArbitraryLoads</key>
54-
<true/>
55-
</dict>
5655
</dict>
5756
</plist>

Examples/Movies/getStyleFromScore.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ var {
2222

2323
var MAX_VALUE = 200;
2424

25-
function getStyleFromScore(score: number): {color: string} {
25+
import type { StyleObj } from 'StyleSheetTypes';
26+
27+
function getStyleFromScore(score: number): StyleObj {
2628
if (score < 0) {
2729
return styles.noScore;
2830
}

Examples/SampleApp/iOS/SampleApp/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3131
* on the same Wi-Fi network.
3232
*/
3333

34-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.bundle"];
34+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.bundle?platform=ios&dev=true"];
3535

3636
/**
3737
* OPTION 2

Examples/TicTacToe/TicTacToe/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3636
* on the same Wi-Fi network.
3737
*/
3838

39-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios"];
39+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios&dev=true"];
4040

4141
/**
4242
* OPTION 2
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
/**
2+
* The examples provided by Facebook are for non-commercial testing and
3+
* evaluation purposes only.
4+
*
5+
* Facebook reserves all rights not expressly granted.
6+
*
7+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9+
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
10+
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
11+
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
12+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
*
14+
* @flow
15+
*/
16+
'use strict';
17+
18+
var React = require('react-native');
19+
var {
20+
Animated,
21+
Easing,
22+
StyleSheet,
23+
Text,
24+
View,
25+
} = React;
26+
var UIExplorerButton = require('./UIExplorerButton');
27+
28+
exports.framework = 'React';
29+
exports.title = 'Animated - Examples';
30+
exports.description = 'Animated provides a powerful ' +
31+
'and easy-to-use API for building modern, ' +
32+
'interactive user experiences.';
33+
34+
exports.examples = [
35+
{
36+
title: 'FadeInView',
37+
description: 'Uses a simple timing animation to ' +
38+
'bring opacity from 0 to 1 when the component ' +
39+
'mounts.',
40+
render: function() {
41+
class FadeInView extends React.Component {
42+
constructor(props) {
43+
super(props);
44+
this.state = {
45+
fadeAnim: new Animated.Value(0), // opacity 0
46+
};
47+
}
48+
componentDidMount() {
49+
Animated.timing( // Uses easing functions
50+
this.state.fadeAnim, // The value to drive
51+
{
52+
toValue: 1, // Target
53+
duration: 2000, // Configuration
54+
},
55+
).start(); // Don't forget start!
56+
}
57+
render() {
58+
return (
59+
<Animated.View // Special animatable View
60+
style={{
61+
opacity: this.state.fadeAnim, // Binds
62+
}}>
63+
{this.props.children}
64+
</Animated.View>
65+
);
66+
}
67+
}
68+
class FadeInExample extends React.Component {
69+
constructor(props) {
70+
super(props);
71+
this.state = {
72+
show: true,
73+
};
74+
}
75+
render() {
76+
return (
77+
<View>
78+
<UIExplorerButton onPress={() => {
79+
this.setState((state) => (
80+
{show: !state.show}
81+
));
82+
}}>
83+
Press to {this.state.show ?
84+
'Hide' : 'Show'}
85+
</UIExplorerButton>
86+
{this.state.show && <FadeInView>
87+
<View style={styles.content}>
88+
<Text>FadeInView</Text>
89+
</View>
90+
</FadeInView>}
91+
</View>
92+
);
93+
}
94+
}
95+
return <FadeInExample />;
96+
},
97+
},
98+
{
99+
title: 'Transform Bounce',
100+
description: 'One `Animated.Value` is driven by a ' +
101+
'spring with custom constants and mapped to an ' +
102+
'ordered set of transforms. Each transform has ' +
103+
'an interpolation to convert the value into the ' +
104+
'right range and units.',
105+
render: function() {
106+
this.anim = this.anim || new Animated.Value(0);
107+
return (
108+
<View>
109+
<UIExplorerButton onPress={() => {
110+
Animated.spring(this.anim, {
111+
toValue: 0, // Returns to the start
112+
velocity: 3, // Velocity makes it move
113+
tension: -10, // Slow
114+
friction: 1, // Oscillate a lot
115+
}).start(); }}>
116+
Press to Fling it!
117+
</UIExplorerButton>
118+
<Animated.View
119+
style={[styles.content, {
120+
transform: [ // Array order matters
121+
{scale: this.anim.interpolate({
122+
inputRange: [0, 1],
123+
outputRange: [1, 4],
124+
})},
125+
{translateX: this.anim.interpolate({
126+
inputRange: [0, 1],
127+
outputRange: [0, 500],
128+
})},
129+
{rotate: this.anim.interpolate({
130+
inputRange: [0, 1],
131+
outputRange: [
132+
'0deg', '360deg' // 'deg' or 'rad'
133+
],
134+
})},
135+
]}
136+
]}>
137+
<Text>Transforms!</Text>
138+
</Animated.View>
139+
</View>
140+
);
141+
},
142+
},
143+
{
144+
title: 'Composite Animations with Easing',
145+
description: 'Sequence, parallel, delay, and ' +
146+
'stagger with different easing functions.',
147+
render: function() {
148+
this.anims = this.anims || [1,2,3].map(
149+
() => new Animated.Value(0)
150+
);
151+
return (
152+
<View>
153+
<UIExplorerButton onPress={() => {
154+
var timing = Animated.timing;
155+
Animated.sequence([ // One after the other
156+
timing(this.anims[0], {
157+
toValue: 200,
158+
easing: Easing.linear,
159+
}),
160+
Animated.delay(400), // Use with sequence
161+
timing(this.anims[0], {
162+
toValue: 0,
163+
easing: Easing.elastic(2), // Springy
164+
}),
165+
Animated.delay(400),
166+
Animated.stagger(200,
167+
this.anims.map((anim) => timing(
168+
anim, {toValue: 200}
169+
)).concat(
170+
this.anims.map((anim) => timing(
171+
anim, {toValue: 0}
172+
))),
173+
),
174+
Animated.delay(400),
175+
Animated.parallel([
176+
Easing.inOut(Easing.quad), // Symmetric
177+
Easing.back(1.5), // Goes backwards first
178+
Easing.ease // Default bezier
179+
].map((easing, ii) => (
180+
timing(this.anims[ii], {
181+
toValue: 320, easing, duration: 3000,
182+
})
183+
))),
184+
Animated.delay(400),
185+
Animated.stagger(200,
186+
this.anims.map((anim) => timing(anim, {
187+
toValue: 0,
188+
easing: Easing.bounce, // Like a ball
189+
duration: 2000,
190+
})),
191+
),
192+
]).start(); }}>
193+
Press to Animate
194+
</UIExplorerButton>
195+
{['Composite', 'Easing', 'Animations!'].map(
196+
(text, ii) => (
197+
<Animated.View
198+
style={[styles.content, {
199+
left: this.anims[ii]
200+
}]}>
201+
<Text>{text}</Text>
202+
</Animated.View>
203+
)
204+
)}
205+
</View>
206+
);
207+
},
208+
},
209+
{
210+
title: 'Continuous Interactions',
211+
description: 'Gesture events, chaining, 2D ' +
212+
'values, interrupting and transitioning ' +
213+
'animations, etc.',
214+
render: () => (
215+
<Text>Checkout the Gratuitous Animation App!</Text>
216+
),
217+
}
218+
];
219+
220+
var styles = StyleSheet.create({
221+
content: {
222+
backgroundColor: 'deepskyblue',
223+
borderWidth: 1,
224+
borderColor: 'dodgerblue',
225+
padding: 20,
226+
margin: 20,
227+
borderRadius: 10,
228+
alignItems: 'center',
229+
},
230+
});

0 commit comments

Comments
 (0)