react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.49k stars 280 forks source link

This custom view should extend androidx.appcompat.widget.AppCompatCheckedTextView #387

Closed pe-johndpope closed 2 years ago

pe-johndpope commented 2 years ago

Task :react-native-picker_picker:lintDebug FAILED Lint found 2 errors, 4 warnings. First failure:

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/CheckedTextViewImpl.java:7: Error: This custom view should extend androidx.appcompat.widget.AppCompatCheckedTextView instead [AppCompatCustomView]

The full lint text report is located at: /Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt

ATTACHMENT

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/build.gradle:5: Warning: JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere [JcenterRepositoryObsolete] jcenter()

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/build.gradle:36: Warning: JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere [JcenterRepositoryObsolete]
  jcenter()

Explanation for issues of type "JcenterRepositoryObsolete": The JCenter Maven repository is no longer accepting submissions of Maven artifacts since 31st March 2021. Ensure that the project is configured to search in repositories with the latest versions of its dependencies.

https://developer.android.com/r/tools/jcenter-end-of-service

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/build.gradle:9: Warning: A newer version of com.android.tools.build:gradle than 3.2.1 is available: 7.1.2 [AndroidGradlePluginVersion] classpath 'com.android.tools.build:gradle:3.2.1'


   Explanation for issues of type "AndroidGradlePluginVersion":
   This detector looks for usage of the Android Gradle Plugin where the
   version you are using is not the current stable release. Using older
   versions is fine, and there are cases where you deliberately want to stick
   with an older version. However, you may simply not be aware that a more
   recent version is available, and that is what this lint check helps find.

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/CheckedTextViewImpl.java:7: Error: This custom view should extend androidx.appcompat.widget.AppCompatCheckedTextView instead [AppCompatCustomView]
public class CheckedTextViewImpl extends CheckedTextView {

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/TextViewImpl.java:7: Error: This custom view should extend androidx.appcompat.widget.AppCompatTextView instead [AppCompatCustomView] public class TextViewImpl extends TextView {


   Explanation for issues of type "AppCompatCustomView":
   In order to support features such as tinting, the appcompat library will
   automatically load special appcompat replacements for the builtin widgets.
   However, this does not work for your own custom views.

   Instead of extending the android.widget classes directly, you should
   instead extend one of the delegate classes in
   androidx.appcompat.widget.AppCompatTextView.

/Users/johndpope/Documents/gitWorkspace/customerpoolapp/node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/ReactPicker.java:203: Warning: Avoid object allocations during draw/layout operations (preallocate and reuse instead) [DrawAllocation]
        uiManager.setViewLocalData(getId(), new ReactPickerLocalData(elementSize));

Explanation for issues of type "DrawAllocation": You should avoid allocating objects during a drawing or layout operation. These are called frequently, so a smooth UI can be interrupted by garbage collection pauses caused by the object allocations.

The way this is generally handled is to allocate the needed objects up front and to reuse them for each drawing operation.

Some methods allocate memory on your behalf (such as Bitmap.create), and these should be handled in the same way.

2 errors, 4 warnings

pe-johndpope commented 2 years ago

app won't build due to errors in this - "@react-native-picker/picker": "^2.3.1",


buildscript {
    ext {
        minSdkVersion = 24
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.1.1")
        classpath 'com.google.gms:google-services:4.3.10'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

android { lint{ abortOnError false } lintOptions{ abortOnError false } }

FAILURE: Build failed with an exception.

pe-johndpope commented 2 years ago

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }

    afterEvaluate {
        if (it.hasProperty('android')) {
            android {

                lintOptions {
                    abortOnError false
                }
            }
        }
    }
}