Add ART library to UIExplorer for iOS, with sample and snapshot test

Summary:
**Motivation**

The ART library is part of the react-native repo, but is not included in UIExplorer and has no native testing.  This PR adds the ART library to UIExplorer, adds an example tab for it, and adds a snapshot test.

**Test plan**

New snapshot test.
Closes https://github.com/facebook/react-native/pull/13621

Differential Revision: D4954082

Pulled By: javache

fbshipit-source-id: 83e21c5df1b766ff6ca9f8914eb3382f7323627d
This commit is contained in:
Douglas Lowder 2017-05-25 08:37:55 -07:00 committed by Facebook Github Bot
parent 122b239ce0
commit 9e8a39ce2c
6 changed files with 187 additions and 0 deletions

View File

@ -86,6 +86,8 @@
2D4BD8E51DA2E20D005AC8A8 /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */; };
2D4BD8E61DA2E20D005AC8A8 /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */; };
2D4BD8E71DA2E20D005AC8A8 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14D6D7101B220EB3001FB087 /* libOCMock.a */; };
2D66FF8F1ECA406D00F0A767 /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF651ECA405900F0A767 /* libART.a */; };
2D66FF901ECA407E00F0A767 /* libART-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF671ECA405900F0A767 /* libART-tvOS.a */; };
2D8C2E321DA40403000EE098 /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */; };
2DD323DC1DA2DDBF000FE1B8 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; };
2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; };
@ -215,6 +217,34 @@
remoteGlobalIDString = 2DD3238F1DA2DD8A000FE1B8;
remoteInfo = "RNTester-tvOS";
};
2D66FF641ECA405900F0A767 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C;
remoteInfo = ART;
};
2D66FF661ECA405900F0A767 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 323A12871E5F266B004975B8;
remoteInfo = "ART-tvOS";
};
2D66FF8B1ECA405900F0A767 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
remoteInfo = "third-party-tvOS";
};
2D66FF8D1ECA405900F0A767 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
remoteInfo = "double-conversion-tvOS";
};
2DD323A61DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@ -445,6 +475,7 @@
27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlexibleSizeExampleView.m; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.m; sourceTree = "<group>"; };
27F441EA1BEBE5030039B79C /* FlexibleSizeExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlexibleSizeExampleView.h; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.h; sourceTree = "<group>"; };
2D4624E01DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-tvOSIntegrationTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = ../Libraries/ART/ART.xcodeproj; sourceTree = "<group>"; };
2DD323901DA2DD8A000FE1B8 /* RNTester-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RNTester-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2DD323A01DA2DD8B000FE1B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2DD323A51DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-tvOSUnitTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -495,6 +526,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2D66FF8F1ECA406D00F0A767 /* libART.a in Frameworks */,
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */,
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */,
134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */,
@ -532,6 +564,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2D66FF901ECA407E00F0A767 /* libART-tvOS.a in Frameworks */,
2DD323EA1DA2DE3F000FE1B8 /* libReact.a in Frameworks */,
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation.a in Frameworks */,
3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */,
@ -565,6 +598,7 @@
1316A21D1AA397F400C0188E /* Libraries */ = {
isa = PBXGroup;
children = (
2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */,
14AADEFF1AC3DB95002390C9 /* React.xcodeproj */,
14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */,
134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */,
@ -754,7 +788,9 @@
3D0574901DE6008900184BB4 /* libjschelpers.a */,
3D0574921DE6008900184BB4 /* libjschelpers.a */,
3D507F421EBC88B700B56834 /* libthird-party.a */,
2D66FF8C1ECA405900F0A767 /* libthird-party.a */,
3D507F441EBC88B700B56834 /* libdouble-conversion.a */,
2D66FF8E1ECA405900F0A767 /* libdouble-conversion.a */,
);
name = Products;
sourceTree = "<group>";
@ -802,6 +838,15 @@
name = NativeExampleViews;
sourceTree = "<group>";
};
2D66FF601ECA405900F0A767 /* Products */ = {
isa = PBXGroup;
children = (
2D66FF651ECA405900F0A767 /* libART.a */,
2D66FF671ECA405900F0A767 /* libART-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
};
2DD323911DA2DD8B000FE1B8 /* RNTester-tvOS */ = {
isa = PBXGroup;
children = (
@ -1056,6 +1101,10 @@
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 2D66FF601ECA405900F0A767 /* Products */;
ProjectRef = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */;
},
{
ProductGroup = 147CED471AB34F8C00DA3E4C /* Products */;
ProjectRef = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */;
@ -1208,6 +1257,34 @@
remoteRef = 14DC67F01AB71876001358AB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2D66FF651ECA405900F0A767 /* libART.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libART.a;
remoteRef = 2D66FF641ECA405900F0A767 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2D66FF671ECA405900F0A767 /* libART-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libART-tvOS.a";
remoteRef = 2D66FF661ECA405900F0A767 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2D66FF8C1ECA405900F0A767 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 2D66FF8B1ECA405900F0A767 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2D66FF8E1ECA405900F0A767 /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 2D66FF8D1ECA405900F0A767 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

View File

@ -39,6 +39,7 @@
RCT_TEST(ViewExample)
RCT_TEST(LayoutExample)
RCT_TEST(ARTExample)
RCT_TEST(ScrollViewExample)
RCT_TEST(TextExample)
#if !TARGET_OS_TV

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

104
RNTester/js/ARTExample.js Normal file
View File

@ -0,0 +1,104 @@
/**
* Copyright (c) 2013-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.
*
* 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.
*
* @flow
* @providesModule ARTExample
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
ART,
Platform,
View,
} = ReactNative;
const {
Surface,
Path,
Group,
Transform,
Shape,
} = ART;
var scale = Platform.isTVOS ? 4 : 1;
class ARTExample extends React.Component{
render(){
const pathRect = new Path()
.moveTo(scale * 0,scale * 0)
.lineTo(scale * 0,scale * 110)
.lineTo(scale * 110,scale * 110)
.lineTo(scale * 110,scale * 0)
.close();
const pathCircle0 = new Path()
.moveTo(scale * 30,scale * 5)
.arc(scale * 0,scale * 50,scale * 25)
.arc(scale * 0,-scale * 50,scale * 25)
.close();
const pathCircle1 = new Path()
.moveTo(scale * 30,scale * 55)
.arc(scale * 0,scale * 50,scale * 25)
.arc(scale * 0,-scale * 50,scale * 25)
.close();
const pathCircle2 = new Path()
.moveTo(scale * 55,scale * 30)
.arc(scale * 50,scale * 0,scale * 25)
.arc(-scale * 50,scale * 0,scale * 25)
.close();
const pathCircle3 = new Path()
.moveTo(scale * 55,scale * 80)
.arc(scale * 50,scale * 0,scale * 25)
.arc(-scale * 50,scale * 0,scale * 25)
.close();
return (
<View>
<Surface width={scale * 200} height={scale * 200}>
<Group>
<Shape d={pathRect} stroke="#000080" fill="#000080" strokeWidth={scale}/>
<Shape d={pathCircle0} stroke="#FF0000" fill="#FF0000" strokeWidth={scale}/>
<Shape d={pathCircle1} stroke="#00FF00" fill="#00FF00" strokeWidth={scale}/>
<Shape d={pathCircle2} stroke="#00FFFF" fill="#00FFFF" strokeWidth={scale}/>
<Shape d={pathCircle3} stroke="#FFFFFF" fill="#FFFFFF" strokeWidth={scale}/>
</Group>
</Surface>
</View>
);
}
}
exports.title = '<ART>';
exports.displayName = 'ARTExample';
exports.description = 'ART input for numeric values';
exports.examples = [
{
title: 'ART Example',
render(): React.Element<any> {
return <ARTExample />;
}
},
];

View File

@ -23,6 +23,11 @@ const ComponentExamples: Array<RNTesterExample> = [
module: require('./ActivityIndicatorExample'),
supportsTVOS: true,
},
{
key: 'ARTExample',
module: require('./ARTExample'),
supportsTVOS: true,
},
{
key: 'ButtonExample',
module: require('./ButtonExample'),