# react-native-floating

> test

Latest version **1.2.1** (published 2022-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-floating
pnpm add react-native-floating
yarn add react-native-floating
bun add react-native-floating
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2022-10-17 |
| First published | 2022-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 37.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | keyberth rengel |
| Maintainers | rengel-keyberth |
| Keywords | react-native, ios, android, react native floating, react-native-floating, floating component, picture in picture, react native picture in picture, pip |

## Links

- npm: https://www.npmjs.com/package/react-native-floating
- Repository: https://github.com/keyberth-rengel/react-native-floating
- Homepage: https://github.com/keyberth-rengel/react-native-floating#readme
- Issues: https://github.com/keyberth-rengel/react-native-floating/issues
- npm.io page: https://npm.io/package/react-native-floating

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2022-10-17
- 1.1.2 — 2022-09-25
- 1.0.5 — 2022-09-25
- 1.0.4 — 2022-09-25
- 1.0.3 — 2022-09-25
- 1.1.0 — 2022-09-25
- 1.0.2 — 2022-09-24
- 1.0.1 — 2022-09-24
- 0.2.0 — 2022-09-24

## README

# react-native-floating

## Table of Contents

- [About](#about)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Contributing](../CONTRIBUTING.md)

## About <a name = "about"></a>

Library to generate picture-in-picture of any component within your applications, it will only be delimited by root

## Getting Started <a name = "getting_started"></a>

These instructions will help you set up your project correctly.

<img src="https://user-images.githubusercontent.com/45502428/192113844-fcdd0771-429e-4716-9929-4d8baaa88fed.gif" width="200px" />


### Prerequisites

What things you need to install the software and how to install them.

#### Using npm:

```
npm install react-native-screens@3.17.0 react-native-safe-area-context@4.3.3 react-native-reanimated@2.3.1 react-native-gesture-handler@2.2.0
```

#### Or using yarn

```
yarn add react-native-screens@3.17.0 react-native-safe-area-context@4.3.3 react-native-reanimated@2.3.1 react-native-gesture-handler@2.2.0
```

### Installing

A step by step series of examples that tell you how to get a development env running.
```
npm install react-native-floating
```

Or yarn

```
yarn add react-native-floating
```

### Project installation

#### **babel.config.js**

```javascript
  module.exports = {
    presets: [
      ...
    ],
    plugins: [
      ...
      'react-native-reanimated/plugin',
    ],
  };
```

### Android installation
<details>
  <summary>Android details</summary>

#### **android/build.gradle**

```build.gradle
buildscript {
    ext {
        ...
        // replace 29 to 30
        compileSdkVersion = 30
        ...
    }
    ...
}
```

#### **android/app/src/main/java[Your Packages]/MainApplication.java**

add these two line to the top:

```java
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
```

Add the `ReactNativeHost`

```java
private final ReactNativeHost mReactNativeHost =
  new ReactNativeHost(this) {
    ...

    //add this function
    @Override
    protected JSIModulePackage getJSIModulePackage() {
    return new ReanimatedJSIModulePackage();
    }
};
```
</details>

### IOS installation
<details>
  <summary>IOS details</summary>

Mac Intel

```bash
cd ios/ && pod install && cd ..
```

Mac M1

```bash
cd ios/ && arch -x86_64 pod install && cd ..
```
</details>



## Usage <a name = "usage"></a>

Add this line to the top:
```
import {FloatingHandleRootView, Floating} from "react-native-floating";
```

This is the container that delimits the scope of the floating-component
```
<FloatingHandleRootView>{children}</FloatingHandleRootView>
```

This is the floating-component
```
<Floating />
```


Import into the root of your project
```js
import React from 'react';

import Navigation from './src/navigation';
import {FloatingHandleRootView, Floating} from 'react-native-floating';

const App = () => {
  return (
    <FloatingHandleRootView>
      <Navigation />
      <Floating />
    </FloatingHandleRootView>
  );
};
```

#### bufferConfig
Adjust the buffer settings. This prop takes an object with one or more of the properties listed below.

 Property           | Type                                                | Description
--------------------|-----------------------------------------------------|-------------------------------------------------------------------
 width              | number                                              | The default setting for the float component width is 200.
 height             | number                                              | The default setting for the float component height is 130.
 position           | 'left-top' 'left-bottom' 'right-top' 'right-bottom' | The setting determines for the position of the left-top float component.
 item | React.Element                                       | It has no elements by default just a container to wrap its element.

---
_Source: https://npm.io/package/react-native-floating · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
