Created
April 2, 2019 14:37
-
-
Save abdyer/d25f368640d7a72d65f466290260a8a0 to your computer and use it in GitHub Desktop.
Misleading error message when passing a Kotlin inline class as a @prop to a Litho component that also uses @State
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
import com.facebook.litho.Component | |
import com.facebook.litho.ComponentContext | |
import com.facebook.litho.StateValue | |
import com.facebook.litho.annotations.LayoutSpec | |
import com.facebook.litho.annotations.OnCreateInitialState | |
import com.facebook.litho.annotations.OnCreateLayout | |
import com.facebook.litho.annotations.Prop | |
import com.facebook.litho.annotations.State | |
import com.facebook.litho.widget.EmptyComponent | |
inline class BreaksBuild(val something: String) | |
@LayoutSpec | |
object InlineClassIssueComponentSpec { | |
@OnCreateInitialState | |
fun createInitialState(c: ComponentContext, text: StateValue<String>, @Prop initialText: String) { | |
text.set(initialText) | |
} | |
@OnCreateLayout | |
fun onCreateLayout( | |
c: ComponentContext, | |
@Prop inlineClass: BreaksBuild, | |
@State text: String | |
): Component = EmptyComponent.create(c).build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment