Skip to content

lizhming/readium-react-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

readium-react-bridge

Usage

import {NativeModules} from 'react-native';

// XCode
NativeModules.RNReadiumReactBridge.navigateToReadium("file:///User/.../Documents/1.epub");

// Android
NativeModules.RNReadiumReactBridge.navigateToReadium("/storage/emulated/0/2.epub");

iOS

  1. npm install --save readium-react-bridge

  2. open the xCode Project .xcworkspace

  3. Select the Project on xCode, Add Files to "Project"

Add "node_modules/readium-react-bridge/ios/RNReadiumReactBridge.xcodeproj" into the Project.

  1. 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".

  1. Project Setting/General/Linked Frameworks and Libraries

Insert the libRNReadiumReactBridge.a into Linked Frameworks and Libraries

Foundation.framework

  1. Project Setting/Build Phases/Copy Bundle Resources

Add the RNReadiumReactBridgeBundle.bundle there.

  1. 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.

  1. Change Pods/DevelopmentPods/React-Core/Base/RCBridgeModule.h
    #Import <React/RCTDefines.h> => #Import "RCTDefines.h"

Android

  1. Create a new react-native project (or use an existing one)
  2. npm install --save readium-react-bridge
  3. 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" }
  1. In "android/app/src/main/AndroidManifest.xml"
    • add "tools" tag like this:
    • change tools:replace="android:allowBackup,android:name,android:theme"
  2. 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());

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published