0.3.2 • Published 8 months ago

react-native-folding-feature v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-native-folding-feature

npm

Gather android folding feature information https://developer.android.com/reference/kotlin/androidx/window/layout/FoldingFeature

Installation

npm install react-native-folding-feature

Usage

Android set screen orientation at AndroidManifest.xml

android:screenOrientation="fullSensor"

Warp App component with FoldingFeatureProvider

import { FoldingFeatureProvider } from 'react-native-folding-feature';

...
<FoldingFeatureProvider option={options}>
  ... app component ...
</FoldingFeatureProvider>
...

Options

PropTypeDefaultDescription
closeAnglenumber20Specifies the angle for close pose

Get the folding feature information

import { useFoldingFeature } from 'react-native-folding-feature';

...
const { layoutInfo, isTableTop, isBook } = useFoldingFeature();
...

useFoldingFeature Props

PropTypeDefaultDescription
layoutInfoLayoutInfoFolding Feature from android doc
hingeAnglenumber180(range 0 - 180) acquire from SensorManager
isTableTopbooleanfalseHALF_OPENED & HORIZONTAL
isBookbooleanfalseHALF_OPENED & VERTICAL
isFlatbooleantrue
isClosedbooleanfalsehingeAngle < closeAngle (default 20)

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.3.0

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.2.0

9 months ago