-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
...es/react-native-nitro-modules/android/src/main/java/com/margelo/nitro/views/HybridView.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.margelo.nitro.views | ||
|
||
import android.view.View | ||
import androidx.annotation.Keep | ||
import com.facebook.jni.HybridData | ||
import com.facebook.proguard.annotations.DoNotStrip | ||
import com.margelo.nitro.core.HybridObject | ||
|
||
/** | ||
* A base class for all Kotlin-based HybridViews. | ||
*/ | ||
@Keep | ||
@DoNotStrip | ||
abstract class HybridView: HybridObject { | ||
/** | ||
* Get the view that this HybridView holds. | ||
* | ||
* @example | ||
* ```kotlin | ||
* override val view: View = ImageView() | ||
* ``` | ||
*/ | ||
@get:DoNotStrip | ||
@get:Keep | ||
abstract val view: View | ||
} |
28 changes: 28 additions & 0 deletions
28
packages/react-native-nitro-modules/ios/views/HybridView.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// HybridView.swift | ||
// NitroModules | ||
// | ||
// Created by Marc Rousavy on 23.07.24. | ||
// | ||
|
||
#if canImport(UIKit) | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
/** | ||
* A base protocol for all Swift-based Hybrid Views. | ||
*/ | ||
public protocol HybridView: HybridObjectSpec { | ||
/** | ||
* Get the view that this HybridView holds. | ||
* | ||
* @example | ||
* ```swift | ||
* let view: UIView = UIImageView() | ||
* ``` | ||
*/ | ||
var view: UIView { get } | ||
} | ||
|
||
#endif |