Skip to content
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

[cli] Expo router problem after installing axios #21

Closed
Revaycolizer opened this issue Oct 10, 2023 · 3 comments
Closed

[cli] Expo router problem after installing axios #21

Revaycolizer opened this issue Oct 10, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Revaycolizer
Copy link

Revaycolizer commented Oct 10, 2023

I initialized a new app using npx create-expo-stack@latest but when I installed axios using npm install axios I got this error Module '.. /.. /components/edit-screen-info was resolved to' d:/project/e-learning/components/edit-screen-infov.tsx' but '--jsx' is not set, i fixed it by adding jsx in my configuration file but now getting this error
expoerror

@Revaycolizer Revaycolizer changed the title I initialized a new app using npx create-expo-stack@latest but when I installed axios using npm install axios I got this error Module '.. /.. /components/edit-screen-info was resolved to' d:/project/e-learning/components/edit-screen-infov.tsx' but '--jsx' is not set Expo router problem after installing axios Oct 10, 2023
@danstepanov
Copy link
Owner

Hey I'll take a look at this on my flight today. Thanks for posting!

@Revaycolizer
Copy link
Author

Hey I'll take a look at this on my flight today. Thanks for posting!

Waiting

@danstepanov danstepanov changed the title Expo router problem after installing axios [cli] Expo router problem after installing axios Nov 6, 2023
@danstepanov danstepanov added bug Something isn't working good first issue Good for newcomers labels Nov 13, 2023
@danstepanov
Copy link
Owner

Just ran this command:

Your project configuration:
{
  projectName: 'my-expo-app',
  packages: [
    {
      name: 'expo-router',
      type: 'navigation',
      options: { type: 'tabs' }
    },
    { name: 'nativewind', type: 'styling' }
  ],
  flags: {
    noGit: false,
    noInstall: false,
    overwrite: false,
    importAlias: true,
    packageManager: 'npm'
  }
}

To recreate this project, run:
  npx create-expo-stack my-expo-app --expo-router --tabs --nativewind```
  
Then ran:

`npm install axios`

And lastly updated `./app/(tabs)/index.tsx` with the following code:

import * as React from 'react';
import { Text, View } from 'react-native';
import axios from 'axios';

import EditScreenInfo from '../../components/edit-screen-info';

export default function TabOneScreen() {
React.useEffect(() => {
fetchData();
}, []);

const fetchData = async () => {
try {
const response = await axios.get('https://jsonplaceholder.typicode.com/todos/1');
console.log(response.data);
} catch (error) {
console.error(error);
}
};

return (

Tab One



);
}

const styles = {
container: items-center flex-1 justify-center,
separator: h-[1px] my-7 w-4/5 bg-gray-200,
title: text-xl font-bold,
};


This properly returns the desired JSON object in the console.

Closing this issue as a non-issue until a proper repro is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants