import {NativeModules} from 'react-native';
// XCode
NativeModules.RNReadiumReactBridge.navigateToReadium("file:///User/.../Documents/1.epub");
// Android
NativeModules.RNReadiumReactBridge.navigateToReadium("/storage/emulated/0/2.epub");
-
npm install --save readium-react-bridge
-
open the xCode Project .xcworkspace
-
Select the Project on xCode, Add Files to "Project"
Add "node_modules/readium-react-bridge/ios/RNReadiumReactBridge.xcodeproj" into the Project.
- Project Setting/General/Embedded Binaries
Insert the RNReadiumReactBridgeBundle.bundle into Embedded Binaries.
"node_modules/readium-react-bridge/ios/*.framework" When it's Choosing options for adding these files dialogs, You need to check Destination : "Copy items if needed".
- Project Setting/General/Linked Frameworks and Libraries
Insert the libRNReadiumReactBridge.a into Linked Frameworks and Libraries
Foundation.framework
- Project Setting/Build Phases/Copy Bundle Resources
Add the RNReadiumReactBridgeBundle.bundle there.
- New file with "File.swift"
Add new file on the main project.
when the xCode ask the "Create Bridging Header", click on "Create Bridging Header" button.
- Change Pods/DevelopmentPods/React-Core/Base/RCBridgeModule.h
#Import <React/RCTDefines.h> => #Import "RCTDefines.h"
- Create a new react-native project (or use an existing one)
- npm install --save readium-react-bridge
- In "android/build.gradle":
- set "minSdkVersion" to 21 (or greater)
- add the following into "allprojects.repositories":
maven { url 'https://jitpack.io' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
- In "android/app/src/main/AndroidManifest.xml"
- add "tools" tag like this:
- change tools:replace="android:allowBackup,android:name,android:theme"
- In "android\app\src\main\java\com"ProjectName"\MainApplication.java":
- add the following getPackages function:
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new com.readium_react_bridge.ActivityStarterReactPackage());