GawdZillaa / react-native-body-highlighter

react-native-body-highlighter 💪

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-body-highlighter

npm Downloads CircleCI

SVG human body muscles highlighter for react-native.

body-highlighter

Installation

$ npm install react-native-body-highlighter --save

or use yarn

$ yarn add react-native-body-highlighter

Usage

Note: If you don't use Expo, ensure to add react-native-svg to your project before using this package.

The snippet below shows how the component can be used

import Body from "react-native-body-highlighter";

const data = [
  { slug: "chest", intensity: 1 },
  { slug: "abs", intensity: 2 },
];

export default function App() {
  return (
    <View>
      <Body data={data} />
    </View>
  );
}

Props

Prop Required Purpose
data Yes (Array) Array of MuscleObject to highlight
onMusclePress No (Func) (muscle: MuscleObject) => {} Callback called when a user tap a muscle, disabled if zoomOnPress is set to true
colors No (Array) Defaults to ['#0984e3', '#74b9ff']
frontOnly No (Boolean) Display only the front, Defaults to false
backOnly No (Boolean) Display only the back, Defaults to false
zoomOnPress No (Boolean) Defaults to false
scale No (Float) Defaults to 1

Muscle object model

  • MucleObject : { slug: MuscleName, intensity: IntensityNumber }

  • MuscleName : Muscle name to highlight (See the list of available muscles below)

  • IntensityNumber : Color intensity (if the colors property is set: from 1 to colors.length + 1. If not, intensity can be 1 or 2)

List of muscles

// Back
trapezius
upper-back
lower-back

// Chest
chest

// Arms
biceps
triceps
forearm
back-deltoids
front-deltoids

// Abs
abs
obliques

// Legs
adductor
hamstring
quadriceps
abductors
calves
gluteal

// Head
head
neck

About

react-native-body-highlighter 💪

License:MIT License


Languages

Language:TypeScript 99.1%Language:JavaScript 0.9%