Git Product home page Git Product logo

Comments (6)

grisaitis avatar grisaitis commented on May 25, 2024

I made a repo where I demo this issue: https://github.com/grisaitis/issue-rn-native-module-import

from react-native-create-library.

kitty7756 avatar kitty7756 commented on May 25, 2024

Can confirm, same issue happens even without importing any native library. If I try exporting a simple method and import it in another project, it is also undefined.

from react-native-create-library.

firofame avatar firofame commented on May 25, 2024

you need a podspec file in the root of your project. Here is an example - https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec

from react-native-create-library.

dsyne avatar dsyne commented on May 25, 2024

@grisaitis Did you ever make any progress with this? I've been having the exact same issue on iOS as the lib doesn't export any methods :/

from react-native-create-library.

drewandre avatar drewandre commented on May 25, 2024

I just had to export a dummy function to get my new native module to work/importable

RCT_EXPORT_METHOD(getModuleList: (RCTResponseSenderBlock)callback)
{
   NSArray *nativeModuleList = @[@"react-native-fbsdk", @"react-native-camera", @"react-native-maps"];
   callback(@[nativeModuleList]);
}

// call function in js like so
import MyModule from "MyModule"
MyModule.getModuleList(list => console.log(list))

from react-native-create-library.

EnasAhmedZaki avatar EnasAhmedZaki commented on May 25, 2024

@grisaitis I have the same issue, were you able to fix it and how?

from react-native-create-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.