Merge branch 'master' into yogakit-edge-bugs
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -7,6 +7,10 @@
|
|||||||
/gentest/test.html
|
/gentest/test.html
|
||||||
.buckversion
|
.buckversion
|
||||||
|
|
||||||
|
# Jekyll
|
||||||
|
/.sass-cache/
|
||||||
|
/_site/
|
||||||
|
|
||||||
# Visual studio code
|
# Visual studio code
|
||||||
.vscode
|
.vscode
|
||||||
*.pdb
|
*.pdb
|
||||||
|
58
.hgignore
58
.hgignore
@@ -1,58 +0,0 @@
|
|||||||
.DS_STORE
|
|
||||||
|
|
||||||
/buck-cache/
|
|
||||||
/buck-out/
|
|
||||||
/.buckconfig.local
|
|
||||||
/.buckd
|
|
||||||
/gentest/test.html
|
|
||||||
.buckversion
|
|
||||||
|
|
||||||
# Visual studio code
|
|
||||||
.vscode
|
|
||||||
*.pdb
|
|
||||||
*.tlog
|
|
||||||
*.obj
|
|
||||||
*.pch
|
|
||||||
*.log
|
|
||||||
*.orig
|
|
||||||
|
|
||||||
# Xcode
|
|
||||||
## Build generated
|
|
||||||
build/
|
|
||||||
DerivedData/
|
|
||||||
|
|
||||||
## Various settings
|
|
||||||
*.pbxuser
|
|
||||||
!default.pbxuser
|
|
||||||
*.mode1v3
|
|
||||||
!default.mode1v3
|
|
||||||
*.mode2v3
|
|
||||||
!default.mode2v3
|
|
||||||
*.perspectivev3
|
|
||||||
!default.perspectivev3
|
|
||||||
xcuserdata/
|
|
||||||
|
|
||||||
## Other
|
|
||||||
*.moved-aside
|
|
||||||
*.xcuserstate
|
|
||||||
|
|
||||||
## Obj-C/Swift specific
|
|
||||||
*.hmap
|
|
||||||
*.ipa
|
|
||||||
*.dSYM.zip
|
|
||||||
*.dSYM
|
|
||||||
|
|
||||||
# CocoaPods
|
|
||||||
#
|
|
||||||
# We recommend against adding the Pods directory to your .gitignore. However
|
|
||||||
# you should judge for yourself, the pros and cons are mentioned at:
|
|
||||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
||||||
#
|
|
||||||
Pods/
|
|
||||||
|
|
||||||
# Carthage
|
|
||||||
#
|
|
||||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
|
||||||
# Carthage/Checkouts
|
|
||||||
|
|
||||||
Carthage/Build
|
|
@@ -89,10 +89,6 @@ namespace Facebook.Yoga
|
|||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);
|
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool YGValueIsUndefined(float value);
|
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode);
|
public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode);
|
||||||
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<CompileDependsOn>CopyInNativeLib;$(CompileDependsOn)</CompileDependsOn>
|
<CompileDependsOn>NativeLibrary;$(CompileDependsOn)</CompileDependsOn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<Target Name="NativeLibrary" Outputs="$(ProjectDir)libyoga.dylib">
|
||||||
<!-- The # and , in this path does not play nice with the binding project logic, so make a copy -->
|
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)buck-build.sh //csharp:yoganet#default,shared" />
|
||||||
<Target Name="CopyInNativeLib" Inputs="..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" Outputs="$(ProjectDir)libyoga.dylib">
|
<Copy SourceFiles="$(ProjectDir)..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" DestinationFiles="$(ProjectDir)libyoga.dylib" SkipUnchangedFiles="true" />
|
||||||
<Copy SourceFiles="..\..\buck-out\gen\csharp\yoganet#default,shared\libyoga.dylib" DestinationFiles="$(ProjectDir)/libyoga.dylib" />
|
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
using AppKit;
|
using AppKit;
|
||||||
using Foundation;
|
using Foundation;
|
||||||
|
|
||||||
namespace Facebook.Yoga.Mac.Test
|
namespace Facebook.Yoga.Mac.Sample
|
||||||
{
|
{
|
||||||
[Register("AppDelegate")]
|
[Register("AppDelegate")]
|
||||||
public class AppDelegate : NSApplicationDelegate
|
public class AppDelegate : NSApplicationDelegate
|
@@ -6,8 +6,8 @@
|
|||||||
<ProjectGuid>{64E0AB97-A904-4607-A535-EEA5A966C09E}</ProjectGuid>
|
<ProjectGuid>{64E0AB97-A904-4607-A535-EEA5A966C09E}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>Facebook.Yoga.Mac.Test</RootNamespace>
|
<RootNamespace>Facebook.Yoga.Mac.Sample</RootNamespace>
|
||||||
<AssemblyName>Facebook.Yoga.Mac.Test</AssemblyName>
|
<AssemblyName>Facebook.Yoga.Mac.Sample</AssemblyName>
|
||||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||||
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
|
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
|
||||||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
@@ -3,9 +3,9 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>Facebook.Yoga.Mac.Test</string>
|
<string>Facebook.Yoga.Mac.Sample</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.companyname.facebook-yoga-mac-test</string>
|
<string>com.facebook.facebook-yoga-mac-sample</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
using AppKit;
|
using AppKit;
|
||||||
|
|
||||||
namespace Facebook.Yoga.Mac.Test
|
namespace Facebook.Yoga.Mac.Sample
|
||||||
{
|
{
|
||||||
static class MainClass
|
static class MainClass
|
||||||
{
|
{
|
@@ -10,11 +10,11 @@
|
|||||||
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||||
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Facebook.Yoga.Mac.Test" id="1Xt-HY-uBw">
|
<menuItem title="Facebook.Yoga.Mac.Sample" id="1Xt-HY-uBw">
|
||||||
<modifierMask key="keyEquivalentModifierMask" />
|
<modifierMask key="keyEquivalentModifierMask" />
|
||||||
<menu key="submenu" title="Facebook.Yoga.Mac.Test" systemMenu="apple" id="uQy-DD-JDr">
|
<menu key="submenu" title="Facebook.Yoga.Mac.Sample" systemMenu="apple" id="uQy-DD-JDr">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="About Facebook.Yoga.Mac.Test" id="5kV-Vb-QxS">
|
<menuItem title="About Facebook.Yoga.Mac.Sample" id="5kV-Vb-QxS">
|
||||||
<modifierMask key="keyEquivalentModifierMask" />
|
<modifierMask key="keyEquivalentModifierMask" />
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem" />
|
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem" />
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5" />
|
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5" />
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R" />
|
<menuItem isSeparatorItem="YES" id="4je-JR-u6R" />
|
||||||
<menuItem title="Hide Facebook.Yoga.Mac.Test" keyEquivalent="h" id="Olw-nP-bQN">
|
<menuItem title="Hide Facebook.Yoga.Mac.Sample" keyEquivalent="h" id="Olw-nP-bQN">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68" />
|
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68" />
|
||||||
</connections>
|
</connections>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT" />
|
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT" />
|
||||||
<menuItem title="Quit Facebook.Yoga.Mac.Test" keyEquivalent="q" id="4sb-4s-VLi">
|
<menuItem title="Quit Facebook.Yoga.Mac.Sample" keyEquivalent="q" id="4sb-4s-VLi">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF" />
|
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF" />
|
||||||
</connections>
|
</connections>
|
||||||
@@ -627,7 +627,7 @@
|
|||||||
<modifierMask key="keyEquivalentModifierMask" />
|
<modifierMask key="keyEquivalentModifierMask" />
|
||||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Facebook.Yoga.Mac.Test Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
<menuItem title="Facebook.Yoga.Mac.Sample Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no" />
|
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no" />
|
||||||
</connections>
|
</connections>
|
@@ -13,7 +13,7 @@ using AppKit;
|
|||||||
using Foundation;
|
using Foundation;
|
||||||
using CoreGraphics;
|
using CoreGraphics;
|
||||||
|
|
||||||
namespace Facebook.Yoga.Mac.Test
|
namespace Facebook.Yoga.Mac.Sample
|
||||||
{
|
{
|
||||||
public static class NSViewYogaExtensions
|
public static class NSViewYogaExtensions
|
||||||
{
|
{
|
@@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
using Foundation;
|
using Foundation;
|
||||||
|
|
||||||
namespace Facebook.Yoga.Mac.Test
|
namespace Facebook.Yoga.Mac.Sample
|
||||||
{
|
{
|
||||||
[Register("ViewController")]
|
[Register("ViewController")]
|
||||||
partial class ViewController
|
partial class ViewController
|
6
csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist
Normal file
6
csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>Facebook.Yoga.Mac.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Facebook.Yoga.Mac.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||||
|
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
|
||||||
|
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<EnableCodeSigning>false</EnableCodeSigning>
|
||||||
|
<CodeSigningKey>Mac Developer</CodeSigningKey>
|
||||||
|
<CreatePackage>false</CreatePackage>
|
||||||
|
<EnablePackageSigning>false</EnablePackageSigning>
|
||||||
|
<IncludeMonoRuntime>false</IncludeMonoRuntime>
|
||||||
|
<UseSGen>true</UseSGen>
|
||||||
|
<UseRefCounting>true</UseRefCounting>
|
||||||
|
<Profiling>true</Profiling>
|
||||||
|
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
|
||||||
|
<TlsProvider>Default</TlsProvider>
|
||||||
|
<LinkMode>None</LinkMode>
|
||||||
|
<XamMacArch>x86_64</XamMacArch>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<EnableCodeSigning>false</EnableCodeSigning>
|
||||||
|
<CreatePackage>true</CreatePackage>
|
||||||
|
<EnablePackageSigning>false</EnablePackageSigning>
|
||||||
|
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
||||||
|
<UseSGen>true</UseSGen>
|
||||||
|
<UseRefCounting>true</UseRefCounting>
|
||||||
|
<LinkMode>SdkOnly</LinkMode>
|
||||||
|
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
|
||||||
|
<TlsProvider>Default</TlsProvider>
|
||||||
|
<XamMacArch></XamMacArch>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="nunit.framework">
|
||||||
|
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Info.plist" />
|
||||||
|
<None Include="Entitlements.plist" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Facebook.Yoga.Mac.csproj">
|
||||||
|
<Project>{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}</Project>
|
||||||
|
<Name>Facebook.Yoga.Mac</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
|
||||||
|
</Project>
|
30
csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist
Normal file
30
csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Facebook.Yoga.Mac.Tests</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.facebook.facebook-yoga-mac-tests</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.11</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${AuthorCopyright}</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSMainStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
20
csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs
Normal file
20
csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the
|
||||||
|
* LICENSE-examples file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga.Mac.Tests
|
||||||
|
{
|
||||||
|
static class MainClass
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config
Normal file
4
csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NUnit" version="2.6.4" targetFramework="xamarinmac20" />
|
||||||
|
</packages>
|
@@ -1,25 +1,39 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Test", "Facebook.Yoga.Mac.Test\Facebook.Yoga.Mac.Test.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Sample", "Facebook.Yoga.Mac.Sample\Facebook.Yoga.Mac.Sample.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9352A9B6-F93B-45DD-8BCE-4696A62B3789}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Tests", "Facebook.Yoga.Mac.Tests\Facebook.Yoga.Mac.Tests.csproj", "{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU
|
{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{91C42D32-291D-4B72-90B4-551663D60B8B} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789}
|
||||||
|
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
6
csharp/Mac/buck-build.sh
Executable file
6
csharp/Mac/buck-build.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if buck --version >/dev/null 2>&1; then true; else
|
||||||
|
echo "SKIP: Need to install buck https://buckbuild.com/setup/getting_started.html"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
buck build $1
|
2
csharp/iOS/.gitignore
vendored
Normal file
2
csharp/iOS/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
libyoga.a
|
||||||
|
*.userprefs
|
6
csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist
Normal file
6
csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||||
|
<ProjectGuid>{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>Facebook.Yoga.iOS.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Facebook.Yoga.iOS.Tests</AssemblyName>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchFastDev>true</MtouchFastDev>
|
||||||
|
<MtouchProfiling>true</MtouchProfiling>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<IOSDebuggerPort>28871</IOSDebuggerPort>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||||
|
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||||
|
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<MtouchLink>SdkOnly</MtouchLink>
|
||||||
|
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||||
|
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||||
|
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||||
|
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchFastDev>true</MtouchFastDev>
|
||||||
|
<MtouchProfiling>true</MtouchProfiling>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<MtouchLink>SdkOnly</MtouchLink>
|
||||||
|
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||||
|
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||||
|
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
<Reference Include="MonoTouch.NUnitLite" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Info.plist" />
|
||||||
|
<None Include="Entitlements.plist" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="UnitTestAppDelegate.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||||
|
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||||
|
<Name>Facebook.Yoga.iOS</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
|
</Project>
|
36
csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist
Normal file
36
csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Facebook.Yoga.iOS.Tests</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.xamarin.facebook-yoga-ios-tests</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true/>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>9.0</string>
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
27
csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard
Normal file
27
csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS" />
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="EHf-IW-A2E">
|
||||||
|
<objects>
|
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="53" y="375" />
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
28
csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs
Normal file
28
csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the
|
||||||
|
* LICENSE-examples file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga.iOS.Tests
|
||||||
|
{
|
||||||
|
public class Application
|
||||||
|
{
|
||||||
|
// This is the main entry point of the application.
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
|
||||||
|
// you can specify it here.
|
||||||
|
UIApplication.Main(args, null, "UnitTestAppDelegate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs
Normal file
53
csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the
|
||||||
|
* LICENSE-examples file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
using UIKit;
|
||||||
|
using MonoTouch.NUnit.UI;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga.iOS.Tests
|
||||||
|
{
|
||||||
|
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||||
|
// User Interface of the application, as well as listening (and optionally responding) to
|
||||||
|
// application events from iOS.
|
||||||
|
[Register("UnitTestAppDelegate")]
|
||||||
|
public partial class UnitTestAppDelegate : UIApplicationDelegate
|
||||||
|
{
|
||||||
|
// class-level declarations
|
||||||
|
UIWindow window;
|
||||||
|
TouchRunner runner;
|
||||||
|
|
||||||
|
//
|
||||||
|
// This method is invoked when the application has loaded and is ready to run. In this
|
||||||
|
// method you should instantiate the window, load the UI into it and then make the window
|
||||||
|
// visible.
|
||||||
|
//
|
||||||
|
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||||
|
//
|
||||||
|
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||||
|
{
|
||||||
|
// create a new window instance based on the screen size
|
||||||
|
window = new UIWindow(UIScreen.MainScreen.Bounds);
|
||||||
|
runner = new TouchRunner(window);
|
||||||
|
|
||||||
|
// register every tests included in the main application/assembly
|
||||||
|
runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
|
||||||
|
|
||||||
|
window.RootViewController = new UINavigationController(runner.GetViewController());
|
||||||
|
|
||||||
|
// make the window visible
|
||||||
|
window.MakeKeyAndVisible();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
81
csharp/iOS/Facebook.Yoga.iOS.sln
Normal file
81
csharp/iOS/Facebook.Yoga.iOS.sln
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2012
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{89A39C6B-6A7B-4458-872B-A0456550CAA6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Tests", "Facebook.Yoga.iOS.Tests\Facebook.Yoga.iOS.Tests.csproj", "{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||||
|
Release|iPhone = Release|iPhone
|
||||||
|
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||||
|
Debug|iPhone = Debug|iPhone
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.Build.0 = Release|iPhone
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.Build.0 = Release|iPhone
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||||
|
{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{91C42D32-291D-4B72-90B4-551663D60B8B} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
|
||||||
|
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
|
Policies = $0
|
||||||
|
$0.TextStylePolicy = $1
|
||||||
|
$1.inheritsSet = VisualStudio
|
||||||
|
$1.inheritsScope = text/plain
|
||||||
|
$1.scope = text/x-csharp
|
||||||
|
$0.CSharpFormattingPolicy = $2
|
||||||
|
$2.IndentSwitchSection = True
|
||||||
|
$2.NewLinesForBracesInProperties = True
|
||||||
|
$2.NewLinesForBracesInAccessors = True
|
||||||
|
$2.NewLinesForBracesInAnonymousMethods = True
|
||||||
|
$2.NewLinesForBracesInControlBlocks = True
|
||||||
|
$2.NewLinesForBracesInAnonymousTypes = True
|
||||||
|
$2.NewLinesForBracesInObjectCollectionArrayInitializers = True
|
||||||
|
$2.NewLinesForBracesInLambdaExpressionBody = True
|
||||||
|
$2.NewLineForElse = True
|
||||||
|
$2.NewLineForCatch = True
|
||||||
|
$2.NewLineForFinally = True
|
||||||
|
$2.NewLineForMembersInObjectInit = True
|
||||||
|
$2.NewLineForMembersInAnonymousTypes = True
|
||||||
|
$2.NewLineForClausesInQuery = True
|
||||||
|
$2.SpacingAfterMethodDeclarationName = False
|
||||||
|
$2.SpaceAfterMethodCallName = False
|
||||||
|
$2.SpaceBeforeOpenSquareBracket = False
|
||||||
|
$2.inheritsSet = Mono
|
||||||
|
$2.inheritsScope = text/x-csharp
|
||||||
|
$2.scope = text/x-csharp
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
20
csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs
Normal file
20
csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2014-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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using UIKit;
|
||||||
|
using Foundation;
|
||||||
|
using ObjCRuntime;
|
||||||
|
using CoreGraphics;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga.iOS
|
||||||
|
{
|
||||||
|
//this is needed
|
||||||
|
}
|
10
csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets
Normal file
10
csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<CompileDependsOn>NativeLibrary;$(CompileDependsOn)</CompileDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="NativeLibrary" Outputs="$(ProjectDir)libyoga.a">
|
||||||
|
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)../../Mac/buck-build.sh //csharp:yoganet-ios" />
|
||||||
|
<Copy SourceFiles="$(ProjectDir)..\..\..\buck-out\gen\csharp\yoganet-ios\libyoga.a" DestinationFiles="$(ProjectDir)libyoga.a" SkipUnchangedFiles="true" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
50
csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj
Normal file
50
csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Facebook.Yoga.iOS</RootNamespace>
|
||||||
|
<AssemblyName>Facebook.Yoga.iOS</AssemblyName>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="CustomBuildAction.targets" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<NativeReference Include="libyoga.a">
|
||||||
|
<Kind>Static</Kind>
|
||||||
|
<SmartLink>False</SmartLink>
|
||||||
|
</NativeReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems" Label="Shared" Condition="Exists('..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
|
||||||
|
<Import Project="CustomBuildAction.targets" />
|
||||||
|
</Project>
|
@@ -22,7 +22,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)YGMinMaxDimensionTest.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YGMinMaxDimensionTest.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YGPaddingTest.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YGPaddingTest.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YGRoundingTest.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YGRoundingTest.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeCreateTest.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeSpacingTest.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeTest.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaNodeTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -19,7 +19,7 @@
|
|||||||
- title: API
|
- title: API
|
||||||
items:
|
items:
|
||||||
- id: c
|
- id: c
|
||||||
- id: objc
|
- id: yogakit
|
||||||
- id: java
|
- id: java
|
||||||
- id: csharp
|
- id: csharp
|
||||||
- id: javascript
|
- id: javascript
|
||||||
|
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
docid: objc
|
|
||||||
title: Objective-C
|
|
||||||
layout: docs
|
|
||||||
permalink: /docs/api/objc/
|
|
||||||
---
|
|
||||||
|
|
||||||
> The Objective-C API is very new and still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues). We hope to stabilize the API over the next couple weeks / months.
|
|
||||||
|
|
||||||
Yoga for Objective-C is implemented as a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview). We try to rely on the existing `UIView` properties and initializers where possible, making the Yoga API smaller for Objective-C than for other languages.
|
|
||||||
|
|
||||||
### Lifecycle
|
|
||||||
|
|
||||||
As with any `UIView` instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. With Yoga for Objective-C the frame is actually how you set the width and the height of the Yoga node, just like any other `UIView`.
|
|
||||||
|
|
||||||
Because Yoga is implemented as a category we need some way to mark the view as using Yoga as you might not want Yoga to control layout of your whole app, this is especially important if you are migrating an existing app to use Yoga. The property decides during layout/sizing whether or not `yg_*` properties should be applied. Defaults to `NO`.
|
|
||||||
|
|
||||||
<script src="https://gist.github.com/emilsjolander/b95467f51b945e906d39b66e44999806.js"></script>
|
|
||||||
|
|
||||||
### Children
|
|
||||||
|
|
||||||
Yoga relies on `UIView` subviews to build up its internal layout tree. However using properties such as `yg_includeInLayout` a View can exclude itself from layout. Therefor we provide the following method to query the number of children which are laid out using Yoga.
|
|
||||||
|
|
||||||
<script src="https://gist.github.com/emilsjolander/253d69b12bef2ee1ec899ace81b768a6.js"></script>
|
|
||||||
|
|
||||||
### Style setters
|
|
||||||
|
|
||||||
The large part of Yoga's API consists of setters for styles. These all follow the same general structure. Bellow are the function and enums used to control the various styles. For an in depth guide to how each style works see the getting started guide.
|
|
||||||
|
|
||||||
<script src="https://gist.github.com/emilsjolander/e7c7732b9465173335d2e019a6bc5941.js"></script>
|
|
||||||
|
|
||||||
### Layout
|
|
||||||
- `yg_includeInLayout` decides if we should include this view when calculating layout. Defaults to `YES`.
|
|
||||||
- `yg_intrinsicSize` returns the size of the view if no constraints were given. This is equivalent to calling `[view sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]`.
|
|
||||||
- `yg_applyLayout` performs layout calculation and update the frames of the views in the hierarchy with the results.
|
|
||||||
- `yg_resolvedDirection` returns the resolved layout direction of this view. Either `YGDirectionRTL` or `YGDirectionLTR`.
|
|
||||||
|
|
||||||
<script src="https://gist.github.com/emilsjolander/437661e872c1f9106b728419d5ea49e9.js"></script>
|
|
27
docs/_docs/api/yogakit.md
Normal file
27
docs/_docs/api/yogakit.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
docid: yogakit
|
||||||
|
title: YogaKit
|
||||||
|
layout: docs
|
||||||
|
permalink: /docs/api/yogakit/
|
||||||
|
---
|
||||||
|
|
||||||
|
> The YogaKit API is still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues).
|
||||||
|
|
||||||
|
YogaKit is a Objective-C (and Swift-compatible) wrapper for Yoga. It allows iOS Developers to manage the layout of their views using the power of Yoga.
|
||||||
|
|
||||||
|
Layout configuration is done via the [YGLayout](https://github.com/facebook/yoga/blob/master/YogaKit/YGLayout.h) object. YogaKit exposes `YGLayout` via a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview).
|
||||||
|
|
||||||
|
### Lifecycle
|
||||||
|
|
||||||
|
As with any `UIView`, instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. YogaKit uses the frame of the parent view to determine the space that is available for children in layout.
|
||||||
|
|
||||||
|
### Children
|
||||||
|
|
||||||
|
Yoga relies on `UIView` subviews to build up its internal layout tree. However, a subview can exclude itself from layout by setting the `isIncludedInLayout` property on `YGLayout` to `NO`.
|
||||||
|
|
||||||
|
It is also possible to query the number of children **included** in layout via `numberOfChildren`.
|
||||||
|
|
||||||
|
### Layout
|
||||||
|
To apply a layout to a view (and its' subviews) you need to call `[view.yoga applyLayout]`. This will do a layout calculation (if needed) and apply the calculated frames to every view included in the layout.
|
||||||
|
|
||||||
|
In the event that you need to another layout pass on a view you can mark it dirty via `[view.yoga markDirty]`.
|
@@ -5,32 +5,30 @@ layout: docs
|
|||||||
permalink: /docs/aspect-ratio/
|
permalink: /docs/aspect-ratio/
|
||||||
---
|
---
|
||||||
|
|
||||||
`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined. `AspectRatio` can apply to either the width or the height of an item, it depends on which dimension is fixed. `AspectRatio` Also respects the `Min` and `Max` dimensions of an item.
|
`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined.
|
||||||
|
|
||||||
- If an item has a `Width` set then `AspectRatio` controls the item's height.
|
- `AspectRatio` is defined as the ratio between the width and the height of a node e.g. if a node has an aspect ratio of 2 then its width is twice the size of its height.
|
||||||
- If an item has a `Height` set then `AspectRatio` controls the item's width.
|
- `AspectRatio` respects the `Min` and `Max` dimensions of an item.
|
||||||
- If an item has a `FlexBasis` set then `AspectRatio` controls the item's cross axis dimension.
|
- `AspectRatio` has higher priority than `FlexGrow`
|
||||||
- If an item's alignment is `Stretch` and its main axis is undefined then `AspectRatio` controls the item's main axis dimension.
|
- If `AspectRatio`, `Width`, and `Height` are set then the cross dimension is overridden.
|
||||||
- If an item has `FlexGrow` or `FlexShrink` set then `AspectRatio` controls the item's cross axis dimension if it is undefined.
|
|
||||||
- If both dimensions of an item are fixed then `AspectRatio` is ignored.
|
|
||||||
|
|
||||||
#### Width = 100; AspectRatio = 2;
|
#### Width = 100; AspectRatio = 2;
|
||||||
|
|
||||||
<div class="yoga" style="align-items: flex-start;">
|
|
||||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
|
||||||
<div class="yoga" style="background-color: #303846; width: 100px; height: 200px;"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
#### Width = 100; AspectRatio = 0.5;
|
|
||||||
|
|
||||||
<div class="yoga" style="align-items: flex-start;">
|
<div class="yoga" style="align-items: flex-start;">
|
||||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
||||||
<div class="yoga" style="background-color: #303846; width: 100px; height: 50px;"></div>
|
<div class="yoga" style="background-color: #303846; width: 100px; height: 50px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 0.5;
|
#### Width = 100; AspectRatio = 0.5;
|
||||||
|
|
||||||
|
<div class="yoga" style="align-items: flex-start;">
|
||||||
|
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px;">
|
||||||
|
<div class="yoga" style="background-color: #303846; width: 100px; height: 200px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 2;
|
||||||
|
|
||||||
<div class="yoga" style="align-items: flex-start;">
|
<div class="yoga" style="align-items: flex-start;">
|
||||||
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px; flex-direction: row;">
|
<div class="yoga sample" style="background-color: white; width: 300px; height: 300px; flex-direction: row;">
|
||||||
|
@@ -29,7 +29,7 @@ id: home
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="blockContent gistsample">
|
<div class="blockContent gistsample">
|
||||||
<script src="https://gist.github.com/emilsjolander/56c2ea1167dafdc996a2527aa4c8ec7c.js"></script>
|
<script src="https://gist.github.com/dshahidehpour/a426c443a1e02c5432b22b09c457ede0.js"></script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
22
java/com/facebook/yoga/YogaBaselineFunction.java
Normal file
22
java/com/facebook/yoga/YogaBaselineFunction.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2014-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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public interface YogaBaselineFunction {
|
||||||
|
/**
|
||||||
|
* Return the baseline of the node in pixels. When no baseline function is set the baseline
|
||||||
|
* default to the computed height of the node.
|
||||||
|
*/
|
||||||
|
@DoNotStrip
|
||||||
|
float baseline(YogaNodeAPI node, float width, float height);
|
||||||
|
}
|
@@ -52,6 +52,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private YogaNode mParent;
|
private YogaNode mParent;
|
||||||
private List<YogaNode> mChildren;
|
private List<YogaNode> mChildren;
|
||||||
private YogaMeasureFunction mMeasureFunction;
|
private YogaMeasureFunction mMeasureFunction;
|
||||||
|
private YogaBaselineFunction mBaselineFunction;
|
||||||
private long mNativePointer;
|
private long mNativePointer;
|
||||||
private Object mData;
|
private Object mData;
|
||||||
|
|
||||||
@@ -623,6 +624,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
YogaMeasureMode.values()[heightMode]);
|
YogaMeasureMode.values()[heightMode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
|
@Override
|
||||||
|
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||||
|
mBaselineFunction = baselineFunction;
|
||||||
|
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public final float baseline(float width, float height) {
|
||||||
|
return mBaselineFunction.baseline(this, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMeasureDefined() {
|
public boolean isMeasureDefined() {
|
||||||
return mMeasureFunction != null;
|
return mMeasureFunction != null;
|
||||||
|
@@ -18,6 +18,7 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
|||||||
YogaNodeType getParent();
|
YogaNodeType getParent();
|
||||||
int indexOf(YogaNodeType child);
|
int indexOf(YogaNodeType child);
|
||||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||||
|
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
||||||
boolean isMeasureDefined();
|
boolean isMeasureDefined();
|
||||||
void calculateLayout();
|
void calculateLayout();
|
||||||
boolean isDirty();
|
boolean isDirty();
|
||||||
|
@@ -19,7 +19,7 @@ public class YogaValue {
|
|||||||
public final float value;
|
public final float value;
|
||||||
public final YogaUnit unit;
|
public final YogaUnit unit;
|
||||||
|
|
||||||
YogaValue(float value, YogaUnit unit) {
|
public YogaValue(float value, YogaUnit unit) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,14 @@ static void YGPrint(YGNodeRef node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) {
|
||||||
|
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
||||||
|
return findClassLocal("com/facebook/yoga/YogaNode")->getMethod<jfloat(jfloat, jfloat)>("baseline")(obj, width, height);
|
||||||
|
} else {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static YGSize YGJNIMeasureFunc(YGNodeRef node,
|
static YGSize YGJNIMeasureFunc(YGNodeRef node,
|
||||||
float width,
|
float width,
|
||||||
YGMeasureMode widthMode,
|
YGMeasureMode widthMode,
|
||||||
@@ -203,6 +211,10 @@ void jni_YGNodeSetHasMeasureFunc(alias_ref<jobject>, jlong nativePointer, jboole
|
|||||||
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>, jlong nativePointer, jboolean hasBaselineFunc) {
|
||||||
|
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer), hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
||||||
return (jboolean) YGNodeGetHasNewLayout(_jlong2YGNodeRef(nativePointer));
|
return (jboolean) YGNodeGetHasNewLayout(_jlong2YGNodeRef(nativePointer));
|
||||||
}
|
}
|
||||||
@@ -332,6 +344,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||||
YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen),
|
YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen),
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
||||||
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
||||||
|
@@ -23,6 +23,35 @@ public class YogaNodeTest {
|
|||||||
assertEquals(refCount + 1, YogaNode.jni_YGNodeGetInstanceCount());
|
assertEquals(refCount + 1, YogaNode.jni_YGNodeGetInstanceCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBaseline() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setAlignItems(YogaAlign.BASELINE);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
final YogaNode child1 = new YogaNode();
|
||||||
|
child1.setWidth(40);
|
||||||
|
child1.setHeight(40);
|
||||||
|
root.addChildAt(child1, 0);
|
||||||
|
|
||||||
|
final YogaNode child2 = new YogaNode();
|
||||||
|
child2.setWidth(40);
|
||||||
|
child2.setHeight(40);
|
||||||
|
child2.setBaselineFunction(new YogaBaselineFunction() {
|
||||||
|
public float baseline(YogaNodeAPI node, float width, float height) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
root.addChildAt(child2, 1);
|
||||||
|
|
||||||
|
root.calculateLayout();
|
||||||
|
|
||||||
|
assertEquals(0, (int) child1.getLayoutY());
|
||||||
|
assertEquals(40, (int) child2.getLayoutY());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMeasure() {
|
public void testMeasure() {
|
||||||
final YogaNode node = new YogaNode();
|
final YogaNode node = new YogaNode();
|
||||||
|
@@ -676,3 +676,24 @@ TEST(YogaTest, aspect_ratio_height_overrides_align_stretch_column) {
|
|||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, aspect_ratio_allow_child_overflow_parent_size) {
|
||||||
|
const YGNodeRef root = YGNodeNew();
|
||||||
|
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNew();
|
||||||
|
YGNodeStyleSetHeight(root_child0, 50);
|
||||||
|
YGNodeStyleSetAspectRatio(root_child0, 4);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_EQ(50, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
}
|
||||||
|
@@ -181,8 +181,6 @@ YGCalloc gYGCalloc = &calloc;
|
|||||||
YGRealloc gYGRealloc = &realloc;
|
YGRealloc gYGRealloc = &realloc;
|
||||||
YGFree gYGFree = &free;
|
YGFree gYGFree = &free;
|
||||||
|
|
||||||
static YGValue YGValueUndefined = YG_UNDEFINED_VALUES;
|
|
||||||
|
|
||||||
static YGValue YGValueZero = {.value = 0, .unit = YGUnitPixel};
|
static YGValue YGValueZero = {.value = 0, .unit = YGUnitPixel};
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
@@ -2237,8 +2235,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
availableInnerWidth));
|
availableInnerWidth));
|
||||||
childHeightMeasureMode = YGMeasureModeExactly;
|
childHeightMeasureMode = YGMeasureModeExactly;
|
||||||
|
|
||||||
|
// Parent size constraint should have higher priority than flex
|
||||||
|
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||||
childHeight = fminf(childHeight, availableInnerHeight);
|
childHeight = fminf(childHeight, availableInnerHeight);
|
||||||
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
|
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
|
||||||
YGNodePaddingAndBorderForAxis(currentRelativeChild,
|
YGNodePaddingAndBorderForAxis(currentRelativeChild,
|
||||||
@@ -2246,10 +2247,13 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
availableInnerWidth));
|
availableInnerWidth));
|
||||||
childWidthMeasureMode = YGMeasureModeExactly;
|
childWidthMeasureMode = YGMeasureModeExactly;
|
||||||
|
|
||||||
|
// Parent size constraint should have higher priority than flex
|
||||||
|
if (YGNodeIsFlex(currentRelativeChild)) {
|
||||||
childWidth = fminf(childWidth, availableInnerWidth);
|
childWidth = fminf(childWidth, availableInnerWidth);
|
||||||
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
YGConstrainMaxSizeForMode(
|
YGConstrainMaxSizeForMode(
|
||||||
YGValueResolve(¤tRelativeChild->style.maxDimensions[YGDimensionWidth],
|
YGValueResolve(¤tRelativeChild->style.maxDimensions[YGDimensionWidth],
|
||||||
|
@@ -43,6 +43,8 @@ typedef struct YGValue {
|
|||||||
YGUnit unit;
|
YGUnit unit;
|
||||||
} YGValue;
|
} YGValue;
|
||||||
|
|
||||||
|
static const YGValue YGValueUndefined = { YGUndefined, YGUnitUndefined };
|
||||||
|
|
||||||
typedef struct YGNode *YGNodeRef;
|
typedef struct YGNode *YGNodeRef;
|
||||||
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
||||||
float width,
|
float width,
|
||||||
|
Reference in New Issue
Block a user