This file contains 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
override fun onCreate() { | |
reactNativeHost.reactInstanceManager.addReactInstanceEventListener { | |
val nativeModulesMessageQueueThread = ReactContext::class.java.getDeclaredField("mNativeModulesMessageQueueThread") | |
.apply { isAccessible = true } | |
.get(it) as MessageQueueThreadImpl | |
val messageHandlerField = MessageQueueThreadImpl::class.java.getDeclaredField("mHandler") | |
.apply { isAccessible = true } |
This file contains 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
typealias ViewStateReducer<STATE, EVENT> = (STATE, EVENT) -> STATE | |
typealias SideEffect<EVENT, STATE> = suspend (EVENT, STATE) -> EVENT? | |
fun <STATE, EVENT> CoroutineScope.viewStateFlow(reduce: ViewStateReducer<STATE, EVENT>) = ViewStateFlow.Builder( | |
scope = this, | |
reduce = reduce | |
) | |
interface Subscription { |
This file contains 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.shopify.coroutine.sample | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.runBlocking | |
import kotlin.coroutines.coroutineContext | |
fun main(vararg args: String) { | |
// suspendFunc1() //- won't compile outside coroutine or another suspend function |