Sha256: 06e8a7cd126d01f037fa4a6a1203c998832d24f1347a233ea6f9b4bd0081246c

Contents?: true

Size: 956 Bytes

Versions: 34

Compression:

Stored size: 956 Bytes

Contents

package <%= package_name %>.features.native

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import dev.hotwire.turbo.fragments.TurboFragment
import <%= package_name %>.R
import <%= package_name %>.base.NavDestination

abstract class NativeFragment : TurboFragment(), NavDestination {
    fun setContent(inflater: LayoutInflater, container: ViewGroup?, content: @Composable () -> Unit): View? {
        val root = inflater.inflate(R.layout.fragment_native, container, false)
        val composeView = root.findViewById<ComposeView>(R.id.compose_view)

        composeView.apply {
            setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
            setContent { content.invoke() }
        }

        return root
    }
}

Version data entries

34 entries across 17 versions & 1 rubygems

Version Path
turbo-native-initializer-0.0.19 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.19 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.18 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.18 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.17 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.17 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.16 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.16 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.15 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.15 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.14 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.14 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.13 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.13 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.12 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.12 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.11 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.11 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.10 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt
turbo-native-initializer-0.0.10 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NativeFragment.kt.tt