Skip to content

Commit

Permalink
chore(Android): fix lint warning of CustomToolbar component (#2176)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
kkafar committed Jun 17, 2024
1 parent 1a54e22 commit cd2dbe9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.swmansion.rnscreens

import android.annotation.SuppressLint
import android.content.Context
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.widget.SearchView
import androidx.fragment.app.Fragment

@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
class CustomSearchView(context: Context, fragment: Fragment) : SearchView(context) {
/*
CustomSearchView uses some variables from SearchView. They are listed below with links to documentation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.swmansion.rnscreens

import android.annotation.SuppressLint
import android.content.Context
import androidx.appcompat.widget.Toolbar

// This class is used to store config closer to search bar
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
open class CustomToolbar(context: Context, val config: ScreenStackHeaderConfig) : Toolbar(context)
2 changes: 1 addition & 1 deletion android/src/main/java/com/swmansion/rnscreens/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.react.uimanager.UIManagerModule
import com.swmansion.rnscreens.events.HeaderHeightChangeEvent

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

0 comments on commit cd2dbe9

Please sign in to comment.