Skip to content

Commit 083943b

Browse files
kkafaralduzy
authored andcommitted
chore(Android): fix lint warning of CustomToolbar component (#2176)
## Description Just noticed while working on #2169 that we got a warning in CustomToolbar. Edit: followed review suggestions and suppressed lints for all our view, where this was requried. ## Changes Suppressed lint on missing constructors. We're safe to miss these there, as this view is constructed only programatically (we do not inflate any of our views). ## Test code and steps to reproduce N/A ## Checklist - [ ] Ensured that CI passes
1 parent 0e0768e commit 083943b

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.swmansion.rnscreens
22

3+
import android.annotation.SuppressLint
34
import android.content.Context
45
import androidx.activity.OnBackPressedCallback
56
import androidx.appcompat.widget.SearchView
67
import androidx.fragment.app.Fragment
78

9+
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
810
class CustomSearchView(context: Context, fragment: Fragment) : SearchView(context) {
911
/*
1012
CustomSearchView uses some variables from SearchView. They are listed below with links to documentation
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.swmansion.rnscreens
22

3+
import android.annotation.SuppressLint
34
import android.content.Context
45
import androidx.appcompat.widget.Toolbar
56

67
// This class is used to store config closer to search bar
8+
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
79
open class CustomToolbar(context: Context, val config: ScreenStackHeaderConfig) : Toolbar(context)

android/src/main/java/com/swmansion/rnscreens/Screen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import com.facebook.react.uimanager.UIManagerHelper
1818
import com.facebook.react.uimanager.UIManagerModule
1919
import com.swmansion.rnscreens.events.HeaderHeightChangeEvent
2020

21-
@SuppressLint("ViewConstructor")
21+
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
2222
class Screen(context: ReactContext?) : FabricEnabledViewGroup(context) {
2323
val fragment: Fragment?
2424
get() = fragmentWrapper?.fragment

0 commit comments

Comments
 (0)