Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Wrap Yoga in a generic module
Browse files Browse the repository at this point in the history
Reviewed By: mikearmstrong001

Differential Revision: D8000748

fbshipit-source-id: 125a54744d19f359021748d6d36ef1cb809570fc
  • Loading branch information
andrewimm authored and facebook-github-bot committed May 15, 2018
1 parent 31076be commit 9a6b2f3
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 138 deletions.
8 changes: 4 additions & 4 deletions React360/js/Modules/UIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import RCTPrefetch from '../Views/Prefetch';
import Module from './Module';
import * as THREE from 'three';
import * as SDFFont from '../OVRUI/SDFFont/SDFFont';
import * as Yoga from '../Utils/Yoga.bundle';
import * as Flexbox from '../Utils/FlexboxImplementation';

import type GuiSys from '../OVRUI/UIView/GuiSys';
import type {ReactNativeContext} from '../ReactNativeContext';
Expand Down Expand Up @@ -611,9 +611,9 @@ export default class UIManager extends Module {
const rootView = this._rootViews[tag];
// use css-layout flex box to apply new flow
rootView.YGNode.calculateLayout(
Yoga.UNDEFINED,
Yoga.UNDEFINED,
Yoga.DIRECTION_LTR,
Flexbox.UNDEFINED,
Flexbox.UNDEFINED,
Flexbox.DIRECTION_LTR,
);
// present the layout to the view implementations from root to child
this.presentLayout(rootView);
Expand Down
16 changes: 16 additions & 0 deletions React360/js/Utils/FlexboxImplementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 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.
*
* @flow
*/

/**
* Singular entry point for Flexbox implementation, so that the backing
* library can be switched out as needed.
*/
module.exports = require('./Yoga.bundle');
4 changes: 2 additions & 2 deletions React360/js/Views/BaseMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {Geometry, Texture, Material, ShaderMaterial} from 'three';
import UIView from '../OVRUI/UIView/UIView';
import extractURL from '../Utils/extractURL';
import merge from '../Utils/merge';
import * as Yoga from '../Utils/Yoga.bundle';
import * as Flexbox from '../Utils/FlexboxImplementation';

import type GuiSys from '../OVRUI/UIView/GuiSys';
import type {ReactNativeContext} from '../ReactNativeContext';
Expand Down Expand Up @@ -317,7 +317,7 @@ export default class RCTBaseMesh extends RCTBaseView {
super.presentLayout();
if (this.mesh && this.mesh.geometry) {
this.mesh.geometry.visible =
this.YGNode.getDisplay() !== Yoga.DISPLAY_NONE;
this.YGNode.getDisplay() !== Flexbox.DISPLAY_NONE;
}
}

Expand Down
Loading

0 comments on commit 9a6b2f3

Please sign in to comment.