Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

Absolute import typescript react native works partially

$
0
0

I have followed this guide to set up absolute imports in my project..Did what the third comment of Lekhnath suggested here:Absolute module path resolution in TypeScript files in VSCodefound myself able to do this perfectly fine:

import { AppActions } from 'src/BL/redux/types/app-actions.types';

it did work. However this doesnt:

import { startLoading, stopLoading } from 'src/BL/redux/action-creators/app-action-creators';

I have to mention that the import is fine, it even autocomplets me and everything however when I run it fails in this component and says that it can't resolve module action-creators..This is the component:

import React, { FC } from 'react';import { AppState } from 'react-native';import { useSelector, useDispatch } from 'react-redux';import { useActions } from '../../../BL/redux/useActions';import { EAAccount } from './EAAccount.interfaces';import { isVerifiedCredentials } from './EAAccount.logic';import NewEAAccountForm from './newEAAccountForm.view';import { Dispatch } from 'redux';import { AppActions } from 'src/BL/redux/types/app-actions.types';import { startLoading, stopLoading } from 'src/BL/redux/action-creators/app-action-creators';    const ConnectEAAccount: FC = () => {      const dispatch = useDispatch<Dispatch<AppActions>>();      const onSubmit = async (credentials: EAAccount) => {        dispatch(startLoading());        const { isVerified, err } = await isVerifiedCredentials(credentials);        if (isVerified) {          alert('success');        } else alert(err);        dispatch(stopLoading());      };      return <NewEAAccountForm onSubmit={onSubmit} />;    };

When I change

import { startLoading, stopLoading } from 'src/BL/redux/action-creators/app-action-creators';

to a relative import it does work.Also has the same problem here where store is not resolved:

import store from 'src/BL/redux/configureStore';class App extends React.Component {  render() {    return (<Provider store={store}><IconRegistry icons={EvaIconsPack} /><ApplicationProvider {...eva} theme={eva.dark}><ConnectEAAccount /></ApplicationProvider></Provider>    );  }}

Thanks ahead for your help and time!


Viewing all articles
Browse latest Browse all 6212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>