Open Martyneris opened 9 months ago
@Martyneris can you please try the latest version? 7.38.0
Getting the same error 'com.lanch.MainActivity cannot be cast to com.reactnativenavigation.NavigationActivity' in 7.38.3
@asafkorem
same issue
Switching to .java fixed issues for me
@aneena-thomas do you have error in ios?
No errors. Keep the old MainActivity.java and MainApplication.java as it is.
@aneena-thomas I get errors on iOS
What are the errors you got? @ombogdanJoinToIt
I think this error does not belong to this thread @aneena-thomas Error: Component "myProjectID" does not have a componentId!
This error is located at: in WrappedComponent in RCTView in Unknown in RCTView in Unknown in AppContainer, js engine: hermes
This one is working for me:
package xx.xxx.xx
import com.facebook.react.ReactActivityDelegate
import com.reactnativenavigation.NavigationActivity
import com.facebook.react.ReactRootView
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
class MainActivity : NavigationActivity() {
class MainActivityDelegate(activity: NavigationActivity?, mainComponentName: String?) :
ReactActivityDelegate(activity, mainComponentName) {
override fun createRootView(): ReactRootView {
val reactRootView = ReactRootView(context)
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
reactRootView.setIsFabric(fabricEnabled)
return reactRootView
}
}
}
I am experiencing the same problem. @rashidul0405 Can you elaborate a bit more how you solved it?
I am experiencing the same problem. @rashidul0405 Can you elaborate a bit more how you solved it?
This is MainActivity.kt
. What else do you need?
I am experiencing the same problem. @rashidul0405 Can you elaborate a bit more how you solved it?
This is
MainActivity.kt
. What else do you need?
I was able to get it to work in the end. Thanks anyway.
What happened?
I've installed the latest (7.37.2) version of react-native-navigation in my 0.73.2 react-native project, Android version builds but upon running the project I get the
com.appName.mainActivity can not be cast to com.reactnativenavigation.NavigationActivity
error. I want to emphasize that with the new 0.73.2 react-native version files I wasn't able to fully follow through with your installation. In react-native 0.73.2MainActivity.java
andMainApplication.java
files are replaced withMainActivity.kt
andMainApplication.kt
respectively and they do not include any of the code that is described in react-native-navigation's installation guide, therefore I didn't know where or what to add.What was the expected behaviour?
The project runs without any errors
Was it tested on latest react-native-navigation?
Help us reproduce this issue!
No response
In what environment did this happen?
React Native Navigation version: 7.37.2 React Native version: 0.73.2 Has Fabric (React Native's new rendering system) enabled: no Node version: 18.18.0 Device model: Emulator Android version: 14