Skip to content

Commit f189439

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Initial Kotlin setup and migrate YogaConstants (#53133)
Summary: Pull Request resolved: #53133 # Changelog: [Internal] - As part of the ongoing effort to migrate the React Native codebase to Kotlin, this PR introduces the initial setup required for Kotlin support in Yoga. - Added initial basic Kotlin configuration to the project. - Migrated `YogaConstants` as an initial file to try out the first migration steps. X-link: react/yoga#1829 Test Plan: - Tested the migrated class directly against facebook/react-native, see the PR [here](#52998). - Run: `./gradlew :yoga:assembleDebug` & `./gradlew :yoga:compileDebugSources` I am not able to run the Java tests in this repo (even before the initial Kotlin setup) – not sure if I am missing something there but any pointers are welcome – it seems like there is some missing configuration. Currently trying with `./gradlew :yoga:test` Reviewed By: cortinico Differential Revision: D79545992 Pulled By: rshest fbshipit-source-id: 8257ff53e6b6f2436980be98b6c94e1ac526b207
1 parent 77ee24d commit f189439

2 files changed

Lines changed: 18 additions & 25 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.yoga
9+
10+
public object YogaConstants {
11+
@JvmField public val UNDEFINED: Float = Float.NaN
12+
13+
@JvmStatic public fun isUndefined(value: Float): Boolean = value.compareTo(UNDEFINED) == 0
14+
15+
@JvmStatic public fun isUndefined(value: YogaValue): Boolean = value.unit == YogaUnit.UNDEFINED
16+
17+
@JvmStatic public fun getUndefined(): Float = UNDEFINED
18+
}

0 commit comments

Comments
 (0)