svbutko/react-native-template-strong

[QUESTION] Unexpectedly getting this error

asiflhr opened this issue · 5 comments

Unexpectedly getting this error, I also tried remove cache and reinstall node modules but nothing happened:
Error
error: src\navigation\navigators\mainStackNavigator.ts: [BABEL] C:\Users\CYRUS\Documents\work\ux-labs\MyApp\src\navigation\navigators\mainStackNavigator.ts: Unexpected token ',' (While processing: "C:\\Users\\CYRUS\\Documents\\work\\ux-labs\\MyApp\\node_modules\\nativewind\\babel.js")

mainStackNavigator.ts File:
`import {Navigation} from "react-native-navigation";
import {Pages} from "../pages";
import {reduxProvider} from "../../core/store/store";
import {PlatformColorsAndroid, PlatformColorsIOS} from "../../core/theme/colors";
import {platformNativeColor} from "../../common/helpers/colorHelpers";
import SplashScreen from "../../modules/screens/SplashScreen";
import AuthScreen from "../../modules/screens/AuthScreen";
import SignInScreen from "../../modules/screens/SignInScreen";
import SignUpScreen from "../../modules/screens/SignupScreen";
import TwoFAScreen from "../../modules/screens/TwoFAScreen";
import VerifySMSScreen from "../../modules/screens/VerifySMSScreen";
import SignupSuccessScreen from "../../modules/screens/SignupSuccessScreen";

export function setDefaultOptions() {
Navigation.setDefaultOptions({
animations: {
setRoot: {
waitForRender: true,
},
setStackRoot: {
waitForRender: true,
},
},
layout: {
componentBackgroundColor: platformNativeColor(PlatformColorsIOS.secondarySystemBackground, PlatformColorsAndroid.background),
},
statusBar: {
backgroundColor: platformNativeColor(undefined, PlatformColorsAndroid.statusbar),
visible: true,
},
});
}

export function registerComponents() {
Navigation.registerComponent(Pages.splash.name, () => reduxProvider(SplashScreen));
Navigation.registerComponent(Pages.auth.name, () => reduxProvider(AuthScreen));
Navigation.registerComponent(Pages.signIn.name, () => reduxProvider(SignInScreen));
Navigation.registerComponent(Pages.twoFA.name, () => reduxProvider(TwoFAScreen));
Navigation.registerComponent(Pages.signUp.name, () => reduxProvider(SignUpScreen));
Navigation.registerComponent(Pages.verifySMS.name, () => reduxProvider(VerifySMSScreen));
Navigation.registerComponent(Pages.signUpSuccess.name, () => reduxProvider(SignupSuccessScreen));
}
`

Was it happening before or after additions of new screens and changes to setDefaultOptions and registerComponents? Maybe there's an issue with one of the pages, try to remove it one by one, or remove some default options, maybe nativewind doesn't like something there

I registered all the screens:

export function registerComponents() {
  Navigation.registerComponent(Pages.auth.name, () => AuthScreen);
  Navigation.registerComponent(Pages.signIn.name, () => SignInScreen);
  Navigation.registerComponent(Pages.signUp.name, () => SignUpScreen);
  Navigation.registerComponent(Pages.twoFA.name, () => TwoFAScreen);
  Navigation.registerComponent(Pages.verifySMS.name, () => VerifySMSScreen);
  Navigation.registerComponent(Pages.signUpSuccess.name, () => SignupSuccessScreen);
}

And the navigation of 3 screens of them was working fine:

Navigation.registerComponent(Pages.auth.name, () => AuthScreen);
  Navigation.registerComponent(Pages.signIn.name, () => SignInScreen);
  Navigation.registerComponent(Pages.signUp.name, () => SignUpScreen);

And when I tried to navigate to SignIn Screen to TwoFAScreen, this error was started, I commented the navigation code from SignInScreen but still having this error.
I also tried to remove setDefaultOptions but nothing happened.

Only from one thing this error gone, When I'm commenting the nativewind from plugins. But this all nativewind styling effect was gone. But I need to use Nativewind:

module.exports = {
  presets: ["module:metro-react-native-babel-preset"],
  // plugins: ["nativewind/babel"],
};

image
image
image

I don't have experience working with Nativewind, I would ask this question to them, maybe there's an issue with it's combination with RNN or there are some specifics regarding its usage or something else

Closed due to no activity