0.0.4 • Published 5 years ago
react-native-line-anchors v0.0.4
react-native-line-anchors
Getting started
$ npm install react-native-line-anchors --save
Mostly automatic installation
$ react-native link react-native-line-anchors
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-line-anchors
and addreact-native-line-anchors.xcodeproj
- In XCode, in the project navigator, select your project. Add
librnlineanchors.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.gustavogenovese.rnlineanchors.RNTLinePackage;
to the imports at the top of the file - Add
new RNTLinePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-line-anchors' project(':react-native-line-anchors').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-line-anchors/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-line-anchors')
Usage
import Line from 'react-native-line-anchors';
...
render() {
return (
<Line x0={100} y0={100} x1={200} y1={200} color={"red"} />
<Line x0={200} y0={220} x1={100} y1={320} lineWidth={15} />
<Line x0={100} y0={340} x1={200} y1={440} color={"blue"} lineWidth={20} drawAnchors drawMiddleAnchor />
<Line x0={200} y0={460} x1={100} y1={560} color={"violet"} drawMiddleAnchor />
);
}