useScreenOrientation - React Native Snippet

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • react-native-orientation-locker

    A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.

  • Below I set up a useEffect that only fires once because it has no dependencies and then set up two listeners, one for iOS that uses react-native-orientation-locker and another for Android that uses the dimensions event listener from React Native itself (Don't forget to remove the listeners when the hook is destroyed). Basically, then on a screen orientation change we set the state to the correct OrientationType(PORTRAIT, PORTRAIT-UPSIDEDOWN, LANDSCAPE-LEFT, LANDSCAPE-RIGHT). For Android we just check the height against the width to discern whether it's in portrait or landscape. Of course, if when you read this, that react-native-orientation-locker is working consistently for Android then you won't need any of this specific Android code.

  • react-singleton-hook

    Create singleton hook from regular react hook

  • Step 1 Let's set up a basic hook with react-singleton-hook that we can expand on in the next step. The reason we only want a single hook at any one time, is so we don't have multiple listeners listening to changes. For example, if again you are using React Navigation and you push onto the stack three screens, each of those screens could have set up listeners and be setting state, even when they aren't visible.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Any possibility that the React team makes a single instance hook?

    2 projects | /r/reactjs | 27 Sep 2022
  • Helux, a react state lib supports both atom arch and deep dependency collection

    1 project | news.ycombinator.com | 21 Oct 2023
  • React: Fine-grained reactivity should be the norm

    2 projects | dev.to | 15 Sep 2023
  • Meet Eagle Eye: the React Context Based Fast and Simple Observable Context State Manager.

    1 project | /r/reactjs | 22 May 2023
  • Is redux and thunks still used or are there other alternatives for it now?

    12 projects | /r/reactjs | 10 May 2023