Skip to content

Commit

Permalink
Merge pull request #1576 from sahrens/Update_Tue_9_Jun
Browse files Browse the repository at this point in the history
Update Tue June 9th
  • Loading branch information
sahrens committed Jun 10, 2015
2 parents 2f78b8a + 205e265 commit a5212c8
Show file tree
Hide file tree
Showing 104 changed files with 3,908 additions and 1,351 deletions.
4 changes: 2 additions & 2 deletions Examples/UIExplorer/NavigatorIOSColorsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var NavigatorIOSColors = React.createClass({

render: function() {
// Set StatusBar with light contents to get better contrast
StatusBarIOS.setStyle(StatusBarIOS.Style.lightContent);
StatusBarIOS.setStyle('light-content');

return (
<NavigatorIOS
Expand All @@ -55,7 +55,7 @@ var NavigatorIOSColors = React.createClass({
title: '<NavigatorIOS>',
rightButtonTitle: 'Done',
onRightButtonPress: () => {
StatusBarIOS.setStyle(StatusBarIOS.Style['default']);
StatusBarIOS.setStyle('default');
this.props.onExampleExit();
},
passProps: {
Expand Down
360 changes: 301 additions & 59 deletions Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "004D289D1AAF61C70097A701"
BuildableName = "UIExplorerTests.xctest"
BlueprintName = "UIExplorerTests"
BuildableName = "UIExplorerUnitTests.xctest"
BlueprintName = "UIExplorerUnitTests"
ReferencedContainer = "container:UIExplorer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "143BC5941B21E3E100462512"
BuildableName = "UIExplorerIntegrationTests.xctest"
BlueprintName = "UIExplorerIntegrationTests"
ReferencedContainer = "container:UIExplorer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -47,8 +61,18 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "004D289D1AAF61C70097A701"
BuildableName = "UIExplorerTests.xctest"
BlueprintName = "UIExplorerTests"
BuildableName = "UIExplorerUnitTests.xctest"
BlueprintName = "UIExplorerUnitTests"
ReferencedContainer = "container:UIExplorer.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "143BC5941B21E3E100462512"
BuildableName = "UIExplorerIntegrationTests.xctest"
BlueprintName = "UIExplorerIntegrationTests"
ReferencedContainer = "container:UIExplorer.xcodeproj">
</BuildableReference>
</TestableReference>
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorer/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* on the same Wi-Fi network.
*/

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerApp.includeRequire.runModule.bundle?dev=true"];
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerApp.ios.includeRequire.runModule.bundle?dev=true"];

/**
* OPTION 2
Expand Down
125 changes: 125 additions & 0 deletions Examples/UIExplorer/UIExplorerApp.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @providesModule UIExplorerApp
* @flow
*/
'use strict';

var React = require('react-native');
var Dimensions = require('Dimensions');
var DrawerLayoutAndroid = require('DrawerLayoutAndroid');
var ToolbarAndroid = require('ToolbarAndroid');
var UIExplorerList = require('./UIExplorerList');
var {
StyleSheet,
View,
} = React;

var DRAWER_WIDTH_LEFT = 56;

var UIExplorerApp = React.createClass({

getInitialState: function() {
return {
example: {
title: 'UIExplorer',
component: this._renderHome(),
},
};
},

render: function() {
return (
<DrawerLayoutAndroid
drawerPosition={DrawerLayoutAndroid.positions.Left}
drawerWidth={Dimensions.get('window').width - DRAWER_WIDTH_LEFT}
ref={(drawer) => { this.drawer = drawer; }}
renderNavigationView={this._renderNavigationView}>
{this._renderNavigation()}
</DrawerLayoutAndroid>
);
},

_renderNavigationView: function() {
return (
<UIExplorerList
onSelectExample={this.onSelectExample}
isInDrawer={true}
/>
);
},

onSelectExample: function(example) {
this.drawer.closeDrawer();
if (example.title === 'UIExplorer') {
example.component = this._renderHome();
}
this.setState({
example: {
title: example.title,
component: example.component,
},
});
},

_renderHome: function() {
var onSelectExample = this.onSelectExample;
return React.createClass({
render: function() {
return (
<UIExplorerList
onSelectExample={onSelectExample}
isInDrawer={false}
/>
);
}
});
},

_renderNavigation: function() {
var Component = this.state.example.component;
return (
<View style={styles.container}>
<ToolbarAndroid
logo={require('image!launcher_icon')}
navIcon={require('image!ic_menu_black_24dp')}
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title={this.state.example.title}
/>
<Component />
</View>
);
},

});

var styles = StyleSheet.create({
messageText: {
fontSize: 17,
fontWeight: '500',
padding: 15,
marginTop: 50,
marginLeft: 15,
},
container: {
flex: 1,
},
toolbar: {
backgroundColor: '#E9EAED',
height: 56,
},
});

module.exports = UIExplorerApp;
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ var UIExplorerApp = React.createClass({
/>
);
}
return (
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'UIExplorer',
component: UIExplorerList,
passProps: {
onExternalExampleRequested: (example) => {
this.setState({ openExternalExample: example, });
},
}
}}
itemWrapperStyle={styles.itemWrapper}
tintColor='#008888'
/>
);
return (
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'UIExplorer',
component: UIExplorerList,
passProps: {
onExternalExampleRequested: (example) => {
this.setState({ openExternalExample: example, });
},
}
}}
itemWrapperStyle={styles.itemWrapper}
tintColor="#008888"
/>
);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.facebook.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ - (void)setUp
#endif
NSString *version = [[UIDevice currentDevice] systemVersion];
RCTAssert([version integerValue] == 8, @"Tests should be run on iOS 8.x, found %@", version);
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp");
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp");

// If tests have changes, set recordMode = YES below and run the affected
// tests on an iPhone5, iOS 8.1 simulator.
// tests on an iPhone5, iOS 8.3 simulator.
_runner.recordMode = NO;
}

Expand Down Expand Up @@ -71,7 +71,7 @@ - (void)testAsyncStorage
[_runner runTest:_cmd module:@"AsyncStorageTest"];
}

- (void)testLayoutEvents
- (void)DISABLED_testLayoutEvents // #7149037
{
[_runner runTest:_cmd module:@"LayoutEventsTest"];
}
Expand All @@ -81,6 +81,11 @@ - (void)testAppEvents
[_runner runTest:_cmd module:@"AppEventsTest"];
}

- (void)testPromises
{
[_runner runTest:_cmd module:@"PromiseTest"];
}

#pragma mark Snapshot Tests

- (void)testSimpleSnapshot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (void)setUp
#endif
NSString *version = [[UIDevice currentDevice] systemVersion];
RCTAssert([version isEqualToString:@"8.3"], @"Snapshot tests should be run on iOS 8.3, found %@", version);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp");
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios");

// If tests have changes, set recordMode = YES below and run the affected
// tests on an iPhone5, iOS 8.1 simulator.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var TESTS = [
require('./LayoutEventsTest'),
require('./AppEventsTest'),
require('./SimpleSnapshotTest'),
require('./PromiseTest'),
];

TESTS.forEach(
Expand Down
File renamed without changes.
50 changes: 50 additions & 0 deletions Examples/UIExplorer/UIExplorerIntegrationTests/js/PromiseTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PromiseTest
*/
'use strict';

var RCTTestModule = require('NativeModules').TestModule;
var React = require('react-native');

var PromiseTest = React.createClass({

shouldResolve: false,
shouldReject: false,

componentDidMount() {
Promise.all([
this.testShouldResolve(),
this.testShouldReject(),
]).then(() => RCTTestModule.finish(
this.shouldResolve && this.shouldReject
));
},

testShouldResolve() {
return RCTTestModule
.shouldResolve()
.then(() => this.shouldResolve = true)
.catch(() => this.shouldResolve = false);
},

testShouldReject() {
return RCTTestModule
.shouldReject()
.then(() => this.shouldReject = false)
.catch(() => this.shouldReject = true);
},

render() {
return <React.View />;
}

});

module.exports = PromiseTest;
File renamed without changes.
File renamed without changes.

0 comments on commit a5212c8

Please sign in to comment.