5.2.0 • Published 6 years ago
react-native-chartbeat-cs v5.2.0
react-native-chartbeat-cs
Work in progress. Not for production use
Getting started
yarn add react-native-chartbeat-cs
react-native link react-native-chartbeat-cs # not needed for react-native >= 0.60.0or if you're using npm
npm install react-native-chartbeat-cs --save
react-native link react-native-chartbeat-cs # not needed for react-native >= 0.60.0Important
After running npm install and linking the library. You need to link the native "Chartbeat.framework" to your iOS project
Mostly automatic installation
$ react-native link react-native-chartbeat-cs
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-chartbeat-csand addRNChartbeat.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNChartbeat.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactnative.chartbeat.ChartbeatPackage;to the imports at the top of the file - Add
new ChartbeatPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-chartbeat-cs' project(':react-native-chartbeat-cs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-chartbeat-cs/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-chartbeat-cs')
Usage
import { Platform } from "react-native";
import Chartbeat from "react-native-chartbeat-cs";
function setupTracker(accountId: string, domain: string) {
if (Platform.OS === "ios") {
Chartbeat.setupTrackerWithAccountId(accountId, domain);
} else {
Chartbeat.setupTracker(accountId, domain);
}
}
function trackView(viewId: string, viewTitle: string) {
if (Platform.OS === "ios") {
Chartbeat.trackViewWithId(viewId, viewTitle);
} else {
Chartbeat.trackView(viewId, viewTitle);
}
}
function setSections(sections: Array<string>) {
Chartbeat.setSections(sections);
}
function setAuthors(authors: Array<string>) {
Chartbeat.setAuthors(authors);
}
function stopTracker() {
Chartbeat.stopTracker();
}5.2.0
6 years ago
5.1.2
6 years ago
5.1.1
6 years ago
5.1.0
6 years ago
4.3.3
6 years ago
4.3.2
6 years ago
4.3.1
6 years ago
4.4.0
6 years ago
4.3.0
6 years ago
4.2.0
6 years ago
4.1.0
6 years ago
4.0.1
6 years ago
5.0.3
7 years ago
5.0.2
7 years ago
5.0.1
7 years ago
5.0.0
7 years ago
4.0.0
7 years ago
2.0.0
7 years ago
1.0.14
7 years ago
1.0.13
7 years ago
1.0.12
7 years ago
1.0.11
7 years ago
1.0.10
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago