diff --git a/README.md b/README.md index 33cf366..58f4869 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/package.json b/package.json index ef8a324..7c9fcc9 100644 --- a/package.json +++ b/package.json @@ -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 ", diff --git a/react-native-eval.podspec b/react-native-eval.podspec new file mode 100644 index 0000000..c0bf8c8 --- /dev/null +++ b/react-native-eval.podspec @@ -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