0.3.2 • Published 2 years ago
react-native-folding-feature v0.3.2
react-native-folding-feature
Gather android folding feature information https://developer.android.com/reference/kotlin/androidx/window/layout/FoldingFeature
Installation
npm install react-native-folding-featureUsage
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