0.0.4 • Published 5 years ago

react-native-line-anchors v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-line-anchors and add react-native-line-anchors.xcodeproj
  3. In XCode, in the project navigator, select your project. Add librnlineanchors.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

Android

  1. 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 the getPackages() method
  1. 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')
  2. 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 />
  );
}

Sample

npm.io