-
-
Notifications
You must be signed in to change notification settings - Fork 31
[2.0.0] java.lang.NullPointerException: null cannot be cast to non-null type android.view.ViewGroup #145
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
Closed
3 tasks done
Labels
bug
Something isn't working
Comments
@lodev09 smells like a race condition, sometimes the app boots sometimes it crashes on boot. |
I think this fixed it, testing it now
diff --git a/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt b/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt
index cf3e99a..b42aa3d 100644
--- a/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt
+++ b/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt
@@ -70,12 +70,12 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
var backgroundColor: Int = Color.WHITE
// 1st child is the content view
- val contentView: ViewGroup
- get() = containerView.getChildAt(0) as ViewGroup
+ val contentView: ViewGroup?
+ get() = containerView.getChildAt(0) as? ViewGroup
// 2nd child is the footer view
- val footerView: ViewGroup
- get() = containerView.getChildAt(1) as ViewGroup
+ val footerView: ViewGroup?
+ get() = containerView.getChildAt(1) as? ViewGroup
var sizes: Array<Any> = arrayOf("medium", "large")
@@ -196,7 +196,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
}
fun positionFooter() {
- footerView.apply {
+ footerView?.apply {
y = (maxScreenHeight - sheetContainerView.top - footerHeight).toFloat()
}
}
diff --git a/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt b/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt
index 90d4023..5627a42 100644
--- a/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt
+++ b/node_modules/@lodev09/react-native-true-sheet/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt
@@ -178,8 +178,8 @@ class TrueSheetView(context: Context) :
// Initialize content
UiThreadUtil.runOnUiThread {
- setContentHeight(sheetDialog.contentView.height)
- setFooterHeight(sheetDialog.footerView.height)
+ sheetDialog.contentView?.height?.let { setContentHeight(it) }
+ sheetDialog.footerView?.height?.let { setFooterHeight(it) }
if (initialIndex >= 0) {
currentSizeIndex = initialIndex |
@efstathiosntonas yep! that should fix it. If you don't mind submitting PR :) |
fixed via #146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Before submitting a new issue
Bug summary
Hi, just upgraded to
2.0.0
and got this in release mode on app boot:Library version
2.0.0
Environment info
info Fetching system and libraries information...
System:
OS: macOS 15.3.1
CPU: (20) arm64 Apple M1 Ultra
Memory: 401.20 MB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.18.2
path: ~/.nvm/versions/node/v20.18.2/bin/node
Yarn:
version: 4.6.0
path: /opt/homebrew/bin/yarn
npm:
version: 11.1.0
path: ~/.nvm/versions/node/v20.18.2/bin/npm
Watchman:
version: 2025.02.17.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/stathis/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "31"
- "33"
- "34"
- "35"
Build Tools:
- 30.0.3
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
- 35.0.0
System Images:
- android-25 | Google APIs ARM 64 v8a
- android-27 | Google APIs ARM 64 v8a
- android-28 | Google APIs ARM 64 v8a
- android-29 | Google APIs ARM 64 v8a
- android-30 | Google APIs ARM 64 v8a
- android-31 | Google APIs ARM 64 v8a
- android-33 | Google APIs ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
- android-34 | Google Play ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
- android-35 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.13016713
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby:
version: 3.2.2
path: /Users/stathis/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Steps to reproduce
Reproducible example repository
no-repo-sorry
The text was updated successfully, but these errors were encountered: