Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

yoga

Yoga is a cross-platform layout engine which implements Flexbox. Follow https://twitter.com/yogalayout for updates.

Subscribe to updates I use yoga


Statistics on yoga

Number of watchers on Github 9438
Number of open issues 118
Average time to close an issue 4 days
Main language C++
Open pull requests 25+
Closed pull requests 169+
Last commit over 1 year ago
Repo Created over 5 years ago
Repo Last Updated over 1 year ago
Size 16.8 MB
Homepage https://yogalayou...
Organization / Authorfacebook
Latest Release1.8.0
Contributors67
Page Updated
Do you use yoga? Leave a review!
View open issues (118)
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating yoga for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Yoga CocoaPods npm bintray NuGet

Building

Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.

Testing

For testing we rely on gtest as a submodule. After cloning Yoga run git submodule init followed by git submodule update.

For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the tests directory. Run the tests by executing buck test //:yoga.

Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run gentest/gentest.rb to generated a test for you. You can write html which you want to verify in Yoga, in gentest/fixtures folder, such as the following.

<div id="my_test" style="width: 100px; height: 100px; align-items: center;">
  <div style="width: 50px; height: 50px;"></div>
</div>

Run gentest/gentest.rb to generate test code and re-run buck test //:yoga to validate the behavior. One test case will be generated for every root div in the input html.

You may need to install the latest watir-webdriver gem (gem install watir-webdriver) and ChromeDriver to run gentest/gentest.rb Ruby script.

.NET

.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, csharp/tests/Facebook.Yoga/test_macos.sh.

Benchmarks

Benchmarks are located in benchmark/YGBenchmark.c and can be run with buck run //benchmark:benchmark. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.

JavaScript

Installing through NPM

npm install yoga-layout

By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.

npm config set yoga-layout:platform standalone

This will now only run the standalone webpack build upon install.

Build Platforms

name description
all (default) Builds all of these platforms.
browser Builds asm js browser version.
node Builds node js version.
standalone Runs webpack.
none Does nothing. You can use the prepackaged libs.
yoga open issues Ask a question     (View All Issues)
  • over 2 years Support for flex-wrap: wrap-reverse
  • over 2 years JavaScript: setDisplay is not a function
  • over 2 years how to make the yoga behavior like Html flexbox?
  • over 2 years Yoga breaks the Android TextView's TextAlignment
  • over 2 years Percent values not settable through YogaKit
  • over 2 years Carthage Support
  • over 2 years NDK Support Version
  • over 2 years Adding Building Steps inside Wiki
  • over 2 years flex initial value not compatible with css standards(chrome/firefox at least)
  • over 2 years NoClassDefFoundError: com/facebook/jni/Countable when load liblib_fb_fbjni.so in Andorid 4.2
  • over 2 years Nuget for csharp
  • over 2 years how to generate libyoga.so for android
  • over 2 years Provide release signatures
  • over 2 years How to integrate CSS-Layout in an Android Studio project?
yoga open pull requests (View All Pulls)
  • Changes for nuget and CI support
  • Improve JS Travis testing
  • Implemented percentage values in YogaKit
  • [YogaKit] Implemented auto-detection of dirtying
  • Added view-less flex containers to YogaKit
  • Normalize newlines for Visual Studio project files
  • Fixed rounding issues with YGRoundValueToPixelGrid and negative floats
  • support C++17 compilers
  • Set data for YogaLayout child in case of removed by its parent before
  • Avoid using UIView::frame in favor of bounds/center
  • Fix negative value rounding issue for nodes across an axis
  • YogaKit UIScrollview crash
  • Transfer current layout before calling baseline function
  • Add iOS carthage support
  • Separate the Objc and Swift sources in YogaKit.podspec.
  • Android - Fix subview display wrong order
  • #614 Fix Views not visible when added programmatically
  • Fixes #606
  • Dividied YogaKit.podspec into Core and SwiftExtension for YogaKit.
  • A spelling mistake and an Assertion failure
  • removing cocoapods from the to be supported list
  • Fixes compilation for react-native-windows.
  • solves the Android pixel bug
  • Update pod spec to 1.8.0, set explicit public header files
  • Fix issue when view that not used Yoga layout
yoga questions on Stackoverflow (View All Questions)
  • Gnome 3.22.2 touch screen delay lenovo yoga 710
  • yoga/Yoga.h header file not found after react-native(0.40.0) integration in the existing iOS app
  • Facebook yoga/react-native flexbox css-layout position: "fixed" support
  • Error: 'The version of ROM file is not newer than that of BIOS' when udpating Lenovo Yoga 900 13ISK2 to allow Linux installation
  • My app crashes on lenevo yoga 900 while sending sms android?
  • App crash with Lenovo Yoga tab 3 but not with emulator
  • Detect Lid Rotation - Lenovo Thinkpad Yoga 15
  • Android Studio Can Not Find My Device - Lenovo Yoga
  • Eclipse icons are very small on high resolution screen - Windows 8.1, Lenovo Yoga Pro 2
  • How to get Yoga places nearby me in android
  • Controlling fan speed on lenovo yoga 2.13 with linux mint
  • Adb does not detect android device on Windows - Lenovo Yoga Tablet 2
  • ImageView gets blurry on lenovo yoga
  • lenovo yoga pad actionbar icon issue in android
  • Yoga framework partial response default response without selector parameter
Other projects in C++