Home > database >  react native custom framework, import is not working as it should when i try to import framework int
react native custom framework, import is not working as it should when i try to import framework int

Time:07-05

i am new to react native. i have created my custom framework. i am able to integrate and test it with demo app successfully. however the import path i have given is not proper. i think it should import framework with just import {} from 'frameworkname' but its not working that way. what can be reason? how to fix this path issue problem?

import ClassA from "myreact-native-framework/classes/ClassA";
import ClassB from "myreact-native-framework/classes/ClassB";

i think the way it should work is:

import {ClassA, ClassB} from "myreact-native-framework";

index.js looks like below:

import ClassA from "./classes/ClassA";
import ClassA from "./classes/ClassB";

export default { ClassA, ClassB};

CodePudding user response:

Modify your index.js like

export { default as ClassA } from "./classes/ClassA";
export { default as ClassB } from "./classes/ClassB";

If it has any issues, please ask in the comments section here

  • Related