diff --git a/.gitignore b/.gitignore index e20152e..b1d4ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ android/.projectfilesbackup node_modules/ npm-debug.log yarn-error.log - + # Xcode # @@ -43,7 +43,7 @@ DerivedData *.ipa *.xcuserstate project.xcworkspace - + # Android/IntelliJ # diff --git a/README.md b/README.md index 99d5f4e..93c7fda 100644 --- a/README.md +++ b/README.md @@ -15,35 +15,64 @@ As `@wootric/react-native-wootric` contains native codes so requires your projec `$ react-native link` +### CocoaPods installation + +Add the dependency to your `ios/Podfile` file: + +```diff +platform :ios, '9.0' + +target 'Podfile' do + # React installation from CocoaPods + pod 'React', :path => '../node_modules/react-native', :subspecs => [ + 'Core', + 'CxxBridge', + 'DevSupport', + 'RCTText', + ... + ] + pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' + ++ pod 'react-native-wootric', :path => '../node_modules/react-native-wootric' +end +``` + +Then, run `pod install`. + ### Manual installation + [Linking Libraries](https://facebook.github.io/react-native/docs/linking-libraries-ios) #### Windows + Support for Windows is currently not available. ## Usage + ```javascript import RNWootric from '@wootric/react-native-wootric'; -RNWootric.configureWithClientID("client_id", "NPS-1234asdf"); -RNWootric.setEndUserEmail("react_example@wootric.com"); +RNWootric.configureWithClientID('client_id', 'NPS-1234asdf'); +RNWootric.setEndUserEmail('react_example@wootric.com'); RNWootric.setSurveyImmediately(true); RNWootric.setEndUserCreatedAt(1234567890); -RNWootric.setEndUserExternalId("external_id_1234"); -RNWootric.setEndUserPhoneNumber("+17865551234"); -RNWootric.setEndUserProperties({first_name: "React", last_name: "Native"}); +RNWootric.setEndUserExternalId('external_id_1234'); +RNWootric.setEndUserPhoneNumber('+17865551234'); +RNWootric.setEndUserProperties({ first_name: 'React', last_name: 'Native' }); RNWootric.showOptOut(true); RNWootric.setFirstSurveyAfter(5); -RNWootric.setCustomLanguage("ES"); -RNWootric.setCustomProductName("Wootric React Native"); -RNWootric.setCustomAudience("un amigo"); +RNWootric.setCustomLanguage('ES'); +RNWootric.setCustomProductName('Wootric React Native'); +RNWootric.setCustomAudience('un amigo'); RNWootric.showSurvey(); ``` ## Possbile Errors and Solutions + 1. If link fails then please delete node_modules dir and package-lock.json from your react native project and run `npm install` again. 2. If you get `Error:Execution failed for task ':app:processDebugResources'. > java.io.IOException: Could not delete folder “”` while running your react native for android (ex. react-native run-android) then please clean your android project (ex. gradlew clean) and run project again. ## License -[MIT License](https://choosealicense.com/licenses/mit/) \ No newline at end of file + +[MIT License](https://choosealicense.com/licenses/mit/) diff --git a/ios/RNWootric.podspec b/ios/RNWootric.podspec deleted file mode 100644 index 5ff3503..0000000 --- a/ios/RNWootric.podspec +++ /dev/null @@ -1,24 +0,0 @@ - -Pod::Spec.new do |s| - s.name = "RNWootric" - s.version = "1.0.0" - s.summary = "RNWootric" - s.description = <<-DESC - RNWootric - DESC - s.homepage = "" - s.license = "MIT" - # s.license = { :type => "MIT", :file => "FILE_LICENSE" } - s.author = { "author" => "author@domain.cn" } - s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/author/RNWootric.git", :tag => "master" } - s.source_files = "RNWootric/**/*.{h,m}" - s.requires_arc = true - - - s.dependency "React" - s.dependency "WootricSDK" - -end - - diff --git a/react-native-wootric.podspec b/react-native-wootric.podspec new file mode 100644 index 0000000..4d858aa --- /dev/null +++ b/react-native-wootric.podspec @@ -0,0 +1,22 @@ +require 'json' + +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + +Pod::Spec.new do |s| + s.name = "react-native-wootric" + s.version = package['version'] + s.summary = "React Native package for Wootric SDK" + s.homepage = "https://github.com/Wootric/react-native-wootric" + s.license = { :type => "MIT", :file => "LICENSE" } + s.author = { "author" => "author@domain.cn" } + s.platform = :ios, "8.0" + s.source = { :git => "https://github.com/Wootric/react-native-wootric.git" } + s.source_files = "ios/**/*.{h,m}" + s.requires_arc = true + + s.dependency "React" + s.dependency "WootricSDK" + +end + +