Skip to content

Commit

Permalink
Yoga Podspec: Export YGNode and YGStyle headers (#997)
Browse files Browse the repository at this point in the history
Summary:
This pull request adds `YGNode.h` and `YGStyle.h` to the headers exported by Yoga's podspec. They are required by the new Fabric architecture of React Native.

The modulemap and its umbrella header automatically generated by Cocoapods adds all exported headers to the `modulemap`. Having YGNode and YGStyle exported through here has problems, because they are only available in environments that have C++ available, and will produce errors otherwise.

This pull request fences off the contents of those headers in an `#ifdef __cplusplus` block, so they will not cause errors when imported into environments where C++ isn't available.

I had considered adding a custom modulemap to the podspec as part of this pull request, but this way seems the least "invasive", and this way you are able to add and remove exported headers in the podspec without needing to worry about updating the umbrella header at the same time.

Changelog:

[Internal] - Yoga Podspec: Export YGNore and YGStyle headers

Pull Request resolved: facebook/yoga#997

Reviewed By: hramos

Differential Revision: D20966075

Pulled By: mdvacca

fbshipit-source-id: 5f5caa6b639d11e660b968d681da9a4de6c0eb8e
  • Loading branch information
empyrical authored and facebook-github-bot committed Apr 14, 2020
1 parent e6ed5b2 commit eaba383
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ReactCommon/yoga/yoga/YGNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

#pragma once

#ifdef __cplusplus

#include <cstdint>
#include <stdio.h>
#include "BitUtils.h"
Expand Down Expand Up @@ -330,3 +333,5 @@ struct YOGA_EXPORT YGNode {
bool isLayoutTreeEqualToNode(const YGNode& node) const;
void reset();
};

#endif
5 changes: 5 additions & 0 deletions ReactCommon/yoga/yoga/YGStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

#pragma once

#ifdef __cplusplus

#include <algorithm>
#include <array>
#include <cstdint>
Expand Down Expand Up @@ -229,3 +232,5 @@ YOGA_EXPORT bool operator==(const YGStyle& lhs, const YGStyle& rhs);
YOGA_EXPORT inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) {
return !(lhs == rhs);
}

#endif

0 comments on commit eaba383

Please sign in to comment.