Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Commit

Permalink
Podspec file added and installation process simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Yarulin committed Sep 9, 2015
1 parent ec2a95e commit a49371a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ React has a good [tutorial](http://facebook.github.io/react-native/docs/embedded

# Installation

- `npm init` if it is your first module and you don't have `package.json` yet
- Make sure that npm and cocoapods initialized: `npm init && pod init`
- `npm install --save react-native-eval`
- Drag `react-native-eval.xcodeproj` from the `node_modules/react-native-eval` folder into your XCode project
- Click on the your project in XCode, goto Build Phases then Link Binary With Libraries and add `libreact-native-eval.a`
- Add `node_modules/react-native-eval` to `Header search path`
- If you cannot compile `react-native-eval` because of `RCTBridgeModule.h` missing - open `react-native-eval.xcodeproject` that you've just added and append `Header search path` with React-Native location
- Add following line to Podfile: `pod 'react-native-eval',:path => 'node_modules/react-native-eval'`
- `pod install`

# Usage
- Get a referenct to `RCTBridge`, by getting it from `RCTRootView.bridge` that you have created (if you have any React Native view) or by creating `RCTBridge` manually:
Expand All @@ -29,7 +27,7 @@ RCTRootView* view = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"app"
else
NSLog(@"Function returned: %@", returnValue);
}];

// You can call async function as well. It has to have callback as a last argument.
// If callback would be called with Error object then it will be converted to
// NSString and passed as a first argument of native callback. Otherwise callback
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "./node_modules/react-native/packager/packager.sh --reset-cache --root react-native-eval",
"update": "wget -O react-native-eval/js/app.js http://localhost:8081/index.ios.bundle"
},
"version": "0.0.9",
"version": "0.1.0",
"description": "Call any JS functions from your native code",
"main": "react-native-eval/RNMEvaluator.js",
"author": "Artem Yarulin <artem.yarulin@fessguid.com>",
Expand Down
15 changes: 15 additions & 0 deletions react-native-eval.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pod::Spec.new do |s|
s.name = "react-native-eval"
s.version = "0.1.0"
s.summary = "Call any JS functions from your native code"
s.description = "React has a good tutorial how to integrate React View to alrady existsing application, but it doesn't provide a good way if you decided to migrate some of your business logic to JS first while maintaining the same UI"
s.homepage = "https://github.com/artemyarulin/react-native-eval"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Artem Yarulin" => "artem.yarulin@fessguid.com" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/artemyarulin/react-native-eval.git", :tag => s.version.to_s }
s.source_files = ["react-native-eval/RNMEvaluator.{h,m}"]
s.public_header_files = "react-native-eval/RNMEvaluator.h"
s.requires_arc = true
s.dependency "React", "> 0.8.0"
end

0 comments on commit a49371a

Please sign in to comment.