1.0.0 • Published 2 months ago

react-native-window-sensor v1.0.0

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

react-native-window-sensor

Sensor component

Installation

npm install react-native-window-sensor
cd ios && pod install

Usage

import { WindowSensorView } from "react-native-window-sensor";

// ...

const handleMeasure = (e) => {
  console.log('4 corners', e.nativeEvent);
}

const handleOnViewPort = (e) => {
  const {
    intersectionAreaPercentage,
    intersectionHeight,
    intersectionWidth
  } = e;
}

<WindowSensorView
  screen={'screenName'}
  id={`sensorId`}
  onViewPort={handleOnViewPort} // this return intersectionArea, intersectionHeight and intersection Width of parent component
  onCustomMeasure={handleMeasure} // this return 4 corners of parent component
/>

Ask sensor to measure again:

import { SensorManager } from 'react-native-window-sensor';

SensorManager.callMeasureForScreen(navigation.state.routeName);
SensorManager.callMeasure(idsArray); // measure by id

License

MIT


Made with create-react-native-library