- java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup #14
- Comments
- MunirAhmad commented Aug 16, 2016
- ReactTextView cannot be cast to android.view.ViewGroup #953
- Comments
- HikingDev commented Jan 15, 2018
- nitaliano commented Jan 15, 2018
- nitaliano commented Jan 17, 2018
- HikingDev commented Jan 17, 2018
- grantyi commented Jan 17, 2018
- nitaliano commented Jan 17, 2018
- HikingDev commented Jan 17, 2018 •
- nitaliano commented Jan 17, 2018
- HikingDev commented Jan 17, 2018
- nitaliano commented Jan 17, 2018 •
- HikingDev commented Jan 17, 2018
- nitaliano commented Jan 18, 2018
- HikingDev commented Jan 18, 2018
- nitaliano commented Jan 18, 2018
java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup #14
Comments
MunirAhmad commented Aug 16, 2016
Hi, I am using simple-side-drawer with fragment, first time its render contents but after pop fragment, when I again render that fragment that I have pop, its give me exception. you can see that exception below
syncDispatchLocalHits timed out: java.util.concurrent.TimeoutException
E/UncaughtException: java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
at com.navdrawer.SimpleSideDrawer.(SimpleSideDrawer.java:240)
at com.navdrawer.SimpleSideDrawer.(SimpleSideDrawer.java:193)
at browseactivitiesreeboks.BrowseActivitiesByCatagoryActivity.setUpViews(BrowseActivitiesByCatagoryActivity.java:127)
at browseactivitiesreeboks.BrowseActivitiesByCatagoryActivity.onCreateView(BrowseActivitiesByCatagoryActivity.java:104)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
throwable java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.istar.reebok.reeboks, PID: 2011
java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
at com.navdrawer.SimpleSideDrawer.(SimpleSideDrawer.java:240)
at com.navdrawer.SimpleSideDrawer.(SimpleSideDrawer.java:193)
at browseactivitiesreeboks.BrowseActivitiesByCatagoryActivity.setUpViews(BrowseActivitiesByCatagoryActivity.java:127)
at browseactivitiesreeboks.BrowseActivitiesByCatagoryActivity.onCreateView(BrowseActivitiesByCatagoryActivity.java:104)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)`
how to handle that exception, please help me
Regards
Munir Ahmad
The text was updated successfully, but these errors were encountered:
Источник
ReactTextView cannot be cast to android.view.ViewGroup #953
Comments
HikingDev commented Jan 15, 2018
the App works fine on IOS. For Android the App crashes and gives the following Stacktrace:
React-native-maps seem to have had a similar problem.
view inside Marker with
Unfortunately i can’t figure out where exactly the error is located.
The text was updated successfully, but these errors were encountered:
nitaliano commented Jan 15, 2018
We can solve it similar to what react-native-maps did this commit fixes it there react-native-maps/react-native-maps@6220583
nitaliano commented Jan 17, 2018
@roesneb what version of the repo are you using? and could you show me how you’re rendering the PointAnnotations? I’m able to render PointAnnotations with text on master without seeing a crash
HikingDev commented Jan 17, 2018
So the packages is: «@mapbox/react-native-mapbox-gl»: «^6.0.2»
My Point Features are rendered in the following way:
How do i debug the native code? Open it in Android Studio and run it?
How do you know its the Points?
I do have custom components inside my MapView.
grantyi commented Jan 17, 2018
I am running into the same issue when attempting to render text inside the MapView. The issue does not appear on iOS. @nitaliano using the fix you mentioned simply prevents it from being rendered at all.
nitaliano commented Jan 17, 2018
Are you guys saying you’re doing this?
HikingDev commented Jan 17, 2018 •
I do have View, TouchableOpacity, Icons and a Modal inside of MapView.
No
nitaliano commented Jan 17, 2018
The MapView should really only contain map layers. I get that it’s easier to have all of these in one component but I’ve always normally placed my views under the MapView. They don’t really belong in the MapViews view tree
I would be curious to know if react-native-maps supports this use case, @alvelig do you happen to know?
HikingDev commented Jan 17, 2018
I was not aware of that.
If that is the case, it should be somewhere in the docs mentioned.
But it seems that the improvement of the docs is already planned.
So the solution is than to rewrite my MapView?
I’ve put for example, additional control Buttons inside MapView,
what kind of made sense to me.
nitaliano commented Jan 17, 2018 •
One of the issues with it is then the native code in this repo will decide how to add/remove those views instead of flowing through react native the natural way and could lead to unforeseen bugs in the future.
When I first used react-native-maps I implemented my MapView the same way that you have implemented it and at that time adding views into your MapView was unsupported until I added code to it to allow map layers to be wrapped by views here is the example for it https://github.com/react-community/react-native-maps/blob/master/example/examples/CustomOverlayXMarksTheSpot.js so I started placing all of my Views(controls) under my MapView moving forward, this is also similar to how things would work on the web. That’s why I am curious if react-native-maps now supports this use case for adding support for controls
I think this topic should have some discussion. If we have enough people in the community that want this type of support we can look into adding it. I can see a benefit for it because we can have things like zoom, user tracking controls built in
HikingDev commented Jan 17, 2018
That is basically what i’ve put inside the MapView.
Center current location, open Drawer, layers.
I think the amount of work moving it outside of the MapView is reasonable.
Since i don’t really have much experience yet in React (native)
i don’t have a problem to listen and improve my App Design!
I’ll follow the discussion though!
nitaliano commented Jan 18, 2018
You might have an invisible view that is overlaying on top of the map that is causing it to intercept those views, try toggle your inspector and seeing which view it might be, if you’re doing things with flex:1 it’s going to be filling the containers.
HikingDev commented Jan 18, 2018
I used a view as a container for the controls.
Aren’t the views supposed to be used as containers?
nitaliano commented Jan 18, 2018
You can try messing with the pointerEvents on the View https://facebook.github.io/react-native/docs/view.html#pointerevents I think box-none will help out here.
Another way you can do it is absolutely position each View and have it wraps it’s children’s width and height so that it doesn’t intercept touch events
Источник