@lodev09/react-native-true-sheet 3.4.2 → 3.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,29 +102,30 @@ class TrueSheetModule(reactContext: ReactApplicationContext) :
102
102
  Handler(Looper.getMainLooper()).post {
103
103
  try {
104
104
  // First try to get from registry (faster)
105
- val view = getSheetByTag(tag)
105
+ var view = getSheetByTag(tag)
106
106
 
107
- if (view != null) {
108
- closure(view)
109
- } else {
110
- // Fallback to UIManager resolution
107
+ // Fallback to UIManager resolution
108
+ if (view == null) {
111
109
  val manager = UIManagerHelper.getUIManagerForReactTag(reactApplicationContext, tag)
112
110
  val resolvedView = manager?.resolveView(tag)
113
111
 
114
- if (resolvedView == null) {
115
- promise.reject("VIEW_NOT_FOUND", "TrueSheetView with tag $tag not found")
116
- return@post
117
- }
118
-
119
112
  if (resolvedView is TrueSheetView) {
120
- closure(resolvedView)
121
- } else {
113
+ view = resolvedView
114
+ } else if (resolvedView != null) {
122
115
  promise.reject(
123
116
  "INVALID_VIEW_TYPE",
124
117
  "View with tag $tag is not a TrueSheetView (got ${resolvedView::class.simpleName})"
125
118
  )
119
+ return@post
126
120
  }
127
121
  }
122
+
123
+ if (view == null) {
124
+ promise.reject("VIEW_NOT_FOUND", "TrueSheetView with tag $tag not found")
125
+ return@post
126
+ }
127
+
128
+ closure(view)
128
129
  } catch (e: Exception) {
129
130
  promise.reject("OPERATION_FAILED", "Failed to execute operation: ${e.message}", e)
130
131
  }