Skip to content

joel611/react-native-folding-feature

Repository files navigation

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

Prop Type Default Description
closeAngle number 20 Specifies the angle for close pose

Get the folding feature information

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

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

useFoldingFeature Props

Prop Type Default Description
layoutInfo LayoutInfo Folding Feature from android doc
hingeAngle number 180 (range 0 - 180) acquire from SensorManager
isTableTop boolean false HALF_OPENED & HORIZONTAL
isBook boolean false HALF_OPENED & VERTICAL
isFlat boolean true
isClosed boolean false hingeAngle < 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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •