0.0.8 • Published 2 years ago

react-native-drag-text v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Native Drag Text Editor

React Native Draggable & Editable & Resizable Text Component,still in early development for photo editing / manipulation cases.

:star: If this project has helped you out, please support with a star.

Showcase IOS13 / AndroidAPI30

Check https://github.com/eneskarpuz/TextEditorPlus for full Example in Readme.

  • Drag and Drop Text
  • Resize Text
  • Edit & Type

Installation

$ npm install @toryshadow/react-native-drag-text-editor --save

Usage

import React, { Component } from "react";
import {Dimensions} from "react-native";
import {DragTextEditor} from 'react-native-drag-text-editor';
const WINDOW = Dimensions.get('window');

export default class App extends Component {
  constructor(props) {
    super(props);
  };

  render() {
    return (  
        <DragTextEditor
          minWidth={100}
          minHeight={100}
          w={200}
          h={200}
          x={WINDOW.width/4}
          y={WINDOW.height/3}
          FontColor={"#000000"}
          LineHeight={15}
          TextAlign={"left"}
          LetterSpacing={0}
          FontSize={15}
          isDraggable={true}
          isResizable={true}
          TopRightAction={()=>console.log("-Top Right Pressed")}
          centerPress={()=>console.log("-Center Pressed")} 
          onTextChanged={(text)=>console.log("Text contents =", text)}
          onDragStart={()=>console.log("-Drag Started")}
          onDragEnd={()=>console.log("- Drag ended")}
          onDrag={()=>console.log("- Dragging...")}
          onResizeStart={()=>console.log("- Resize Started")}
          onResize={()=>console.log("- Resizing...")}
          onResizeEnd={()=>console.log("- Resize Ended")}
        /> 
    )
  }
}

Properties

PropDefaultTypeDescription
centerPressconsole.logfunctionCenter Pressed handler
TopRightActionconsole.logfunctionTop Right Press handler
TopLeftActionconsole.logfunctionTop Left Press handler
isDraggabletruebooleanDraggable condition
isResizabletruebooleanResizable condition
onTextChangedconsole.logfunctionText changed callback
onDragStartconsole.logfunctionDrag Start event handler
onDragconsole.logfunctionDrag handler
onDragEndconsole.logfunctionDrag End event handler
onResizeStartconsole.logfunctionResize Start event handler
onResize-functionResize event handler
onResizeEnd-functionResize End event handler
TopLeftIcon./icons/compassed.pngfunctionClickable Top Left Icon Function Component
TopRightIcon./icons/closed.pngfunctionClickable Top Right Icon Function Component
textLorem Ipsum...StringValue of text
FontFamilyRobotoStringFont Family
FontColor#000StringText Color
FontSize15StringFont Size
LetterSpacing0StringLetter Spacing
BackgroundColortransparentStringBackground Color
TextAlignRobotoStringText Align
LineHeight18StringLine Height
x80StringX location of Components
y150StringY location of Components
w200NumberFirst Width
h200NumberFirst Height
minWidth200NumberMinimum Width
minHeight200NumberMinimum Height

Features

- Performs(Visible) in Black and White Backgrounds

- Logs

To Do

  • Performance Optimization (Code Duplicates etc.)
  • textID and textInAction Bug (Type Error)
  • Dynamic Border Management
  • Add Rotation/Rotate Icon
  • Add Center-Snap

License

This project is licensed under the MIT License.

Attributions


Photo by Bernard Hermant on Unsplash