react-native-orientation-locker
react-singleton-hook
react-native-orientation-locker | react-singleton-hook | |
---|---|---|
1 | 3 | |
731 | 231 | |
- | - | |
5.6 | 0.0 | |
21 days ago | about 1 year ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
react-native-orientation-locker
-
useScreenOrientation - React Native Snippet
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
- Any possibility that the React team makes a single instance hook?
-
useScreenOrientation - React Native Snippet
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.
-
Making your App really Sexy with a React Singleton Hook
Github: https://github.com/Light-Keeper/react-singleton-hook
What are some alternatives?
react-native-swipe-list-view - A React Native ListView component with rows that swipe open and closed
easy-peasy - Vegetarian friendly state for React
react-native-modal-datetime-picker - A React-Native datetime-picker for Android and iOS
ReactStateMuseum - A whirlwind tour of React state management systems by example
react-native-material-ui - Highly customizable material design components for React Native
reusable - Simplest way to manage global state in React
Detox - Gray box end-to-end testing and automation framework for mobile apps
webpack - A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
ui - Customizable set of components for React Native applications
react-easy-state - Simple React state management. Made with ❤️ and ES6 Proxies.