-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix - TextInput Drawable to avoid Null Pointer Exception RuntimeError #17530 #29452
Closed
+131
−1
Commits on Jul 21, 2020
-
Fix Drawable Runtime - More Info in Description
The AppCompat Theme Theme.AppCompat.Light.NoActionBar provides a default Drawable resource for AppCompatEditText. The resource is located in @drawable/abc_edit_text_material.xml https://chromium.googlesource.com/android_tools/+/7200281446186c7192cb02f54dc2b38e02d705e5/sdk/extras/android/support/v7/appcompat/res/drawable/abc_edit_text_material.xml A Runtime Error is triggered in a scenario with the following conditions: 1) Rendering a large number of TextInputs in the screen with a key prop 2) Triggering re-render with setInterval The scenario is also experienced with FlatList and ONLY using TextInput component. The following Runtime Error is triggered: NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources) It is caused from the following line from abc_edit_text_material.xml <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/> I posted a Minimal Reproducible Example at facebook#17530 (comment) This commit simply changes RNTester to use a custom drawable resource for TextInput named @drawable/edit_text.
Configuration menu - View commit details
-
Copy full SHA for 0858d41 - Browse repository at this point
Copy the full SHA 0858d41View commit details -
RNTester Minimum Reproducible Example
A Minimum Reproducible Example that triggers the Null Pointer Exception Runtime Error NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' The following are the conditions that trigger the runtime error: 1) a large list (>100) TextInputs with key prop 2) with FlatList passing prop data=[{key: 1, key:2,.., key:5000]] 3) trigger re-render to ensure the NPE Runtime Error is triggered The example is built using hooks useEffect similar to componentDidMount. Original post is here facebook#17530 (comment)
Configuration menu - View commit details
-
Copy full SHA for 4a414e2 - Browse repository at this point
Copy the full SHA 4a414e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for e488a41 - Browse repository at this point
Copy the full SHA e488a41View commit details -
Configuration menu - View commit details
-
Copy full SHA for bddfcf6 - Browse repository at this point
Copy the full SHA bddfcf6View commit details -
updating template with custom drawable - more info
Adding the edit_text.xml custom drawable to the android template to fix Null Pointer Exception Runtime Error from facebook#17530 The template will include the following settings in new reactnative applications, more info on the issue, the cause of the error and the solution in commit 0858d41
Configuration menu - View commit details
-
Copy full SHA for f349308 - Browse repository at this point
Copy the full SHA f349308View commit details
Commits on Jul 23, 2020
-
Configuration menu - View commit details
-
Copy full SHA for a6d8c3d - Browse repository at this point
Copy the full SHA a6d8c3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0784187 - Browse repository at this point
Copy the full SHA 0784187View commit details -
Configuration menu - View commit details
-
Copy full SHA for b94aee8 - Browse repository at this point
Copy the full SHA b94aee8View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7951b7 - Browse repository at this point
Copy the full SHA a7951b7View commit details
Commits on Aug 20, 2020
-
Configuration menu - View commit details
-
Copy full SHA for b6ca5d3 - Browse repository at this point
Copy the full SHA b6ca5d3View commit details
Commits on Aug 12, 2021
-
Configuration menu - View commit details
-
Copy full SHA for c801edc - Browse repository at this point
Copy the full SHA c801edcView commit details
Commits on Sep 15, 2021
-
Configuration menu - View commit details
-
Copy full SHA for d4bc8dd - Browse repository at this point
Copy the full SHA d4bc8ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 73ffe69 - Browse repository at this point
Copy the full SHA 73ffe69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9a544a0 - Browse repository at this point
Copy the full SHA 9a544a0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a6cd589 - Browse repository at this point
Copy the full SHA a6cd589View commit details
Commits on Sep 22, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 6c7b3d0 - Browse repository at this point
Copy the full SHA 6c7b3d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1da8a14 - Browse repository at this point
Copy the full SHA 1da8a14View commit details -
Configuration menu - View commit details
-
Copy full SHA for c447b25 - Browse repository at this point
Copy the full SHA c447b25View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.