App wouldn't start with old code structure.
See original GitHub issueHi, @kanzitelli you have saved me from lot of troubles and i’m very grateful to u. Thank you for maintaining this starter kit. Here is my problem. After upgrading to the latest changes i can’t use this old following code structure. if i convert the old way to new way using ‘rnn-screens’ it works. but i have huge code base and conversion to ‘rnn-screens’ is not option for me right now. is there anyway i can run the app with the old following structure?
The error message says:
Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property ‘screens’ of undefined TypeError: Cannot read property ‘screens’ of undefined
index.js
import 'react-native-gesture-handler';
import { Navigation } from 'react-native-navigation';
import { start } from './src/app';
Navigation.events().registerAppLaunchedListener(start);
./src/app
import {hydrateStores} from './stores';
import {initServices, services} from './services';
import {configureDesignSystem} from './utils/designSystem';
export const start = async (): PVoid => {
const {nav, Noti} = services;
// 1. hydrate stores
await hydrateStores();
// 2. configure design system
configureDesignSystem();
// 3. init services
await initServices();
// 4. start app
nav.start();
};
./src/services/navigation/index.ts
start = async (): PVoid => {
const token = await AsyncStorage.getItem('@token');
token ? await this.startThreeTabsApp() : await this.startOneScreenApp();
await this.getConstants(); // needs to be called after setRoot()
};
private startOneScreenApp = async (): PVoid => {
await Navigation.setRoot(Root(Stack(Component(screensLayouts.ScreenOne))));
};
private startThreeTabsApp = async (): PVoid => {
await Navigation.setRoot(
Root(
BottomTabs([
Stack(Component(screensLayouts.HomeScreen)),
Stack(Component(screensLayouts.ScanScreen)),
Stack(Component(screensLayouts.MailScreen)),
]),
),
);
};
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
@Yasir5247 great to hear! probably it was a cache error or something. then I’m closing the issue.
Hi @Yasir5247! Well, it looks like you’ve done everything correct, but the script still can not be run because of the wrong directory. As I remember, this error
Cannot run program "/home/expo/Android/Sdk/cmdline-tools/latest/bin/sdkmanager"
comes from React Native Navigation app’sbuild.gradle
file. You can check it here - https://github.com/wix/react-native-navigation/blob/master/lib/android/app/build.gradle#L176. What I would recommend is to change that directory manually to yours fromnode_modules
of your project. And if that works, just create a patch file which will change it.