React Native Cordova (remobile)
A cordova plugin defines for react native on ios and android
Installation
npm install @remobile/react-native-cordova --save
Installation (iOS)
-
Drag RCTCordova.xcodeproj to your project on Xcode.
-
Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRCTCordova.a from the Products folder inside the RCTCordova.xcodeproj.
-
Look for Header Search Paths and make sure it contains $(SRCROOT)/../../../react-native/React as recursive.
-
In your project, Look for Header Search Paths and make sure it contains $(SRCROOT)/../../react-native-cordova/ios/RCTCordova.
-
then you can #import "CDVPlugin.h"
Installation (Android)
- In Main project
build.gradle
...include ':react-native-cordova'project(':react-native-cordova').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-cordova/android/RCTCordova')
- In you project
build.gradle
...dependencies { ... compile project(':react-native-cordova')}
- then you can import com.remobile.cordova.* ;
Usage
IOS
#...@interface CustomClass : CDVPlugin@end... @implementation CustomClassRCT_EXPORT_MODULE(RCTCustomClass)RCT_EXPORT_CORDOVA_METHOD(test);...- (void) test:(CDVInvokedUrlCommand *)command {...}....@end
Android
...