0.0.218 • Published 11 months ago

@devlander/hooks v0.0.218

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Devlander Hooks Collection Header

Netlify Status

Devlander React Native Hooks Collection

Introduction

The Devlander React Native Hooks Collection is a comprehensive library of React Native hooks, designed for seamless integration and addressing common development challenges. This collection streamlines your development process, offering versatile, cross-platform solutions for a variety of use cases.

Featured Hooks

  • useScrollControl: Manage scrolling behavior in your application.
  • useScreenDimensions: Access screen dimensions for responsive designs.
  • useVisibilitySensor: Detect when an element is visible on the screen.

Installation

You can install the Devlander React Native Hooks Collection using npm or yarn:

npm

npm install @devlander/hooks

or

yarn

yarn add @devlander/hooks

Usage

Each hook in the collection is designed for easy integration. Here are examples of how to use some of our featured hooks:

useScrollControl

// ScrollControlComponent.tsx
import React from 'react';
import { Button, View } from 'react-native';
import { useScrollControl } from '@devlander/hooks'; // Adjust the import path as needed

const ScrollControlComponent = () => {
  const { disableScroll, enableScroll } = useScrollControl();

  return (
    <View>
      <Button title="Disable Scrolling" onPress={disableScroll} />
      <Button title="Enable Scrolling" onPress={enableScroll} />
      <View style={{ height: 1000, backgroundColor: '#f0f0f0' }}>
        <Text>Scroll down to see more content...</Text>
      </View>
    </View>
  );
};

export default ScrollControlComponent;

useScreenDimensions

// ExampleComponent.tsx
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { useScreenDimensions } from '@devlander/hooks'; // Adjust the import path as needed

const ExampleComponent = () => {
  const { width, height } = useScreenDimensions();

  return (
    <View style={styles.container}>
      <Text>Screen Width: {width}</Text>
      <Text>Screen Height: {height}</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default ExampleComponent;

useVisibilitySensor

// MyVisibilityComponent.tsx
import React from 'react';
import { View, Text } from 'react-native';
import { useVisibilitySensor } from '@devlander/hooks'; // Adjust import path

const MyVisibilityComponent = () => {
  const viewRef = useVisibilitySensor(isVisible => console.log(`Is Visible: ${isVisible}`));

  return (
    <View ref={viewRef} style={{ height: 100, width: 100, backgroundColor: 'blue' }}>
      <Text>Visibility Tracking Component</Text>
    </View>
  );
};

export default MyVisibilityComponent;

Notes

  • Follow platform-specific guidelines for React Native implementations.

License

This package is open-source, available under the MIT License.

Become a Sponsor!

To do write documentation on the providers and how you can tie them into the hook

0.0.216

12 months ago

0.0.215

12 months ago

0.0.214

12 months ago

0.0.213

12 months ago

0.0.218

11 months ago

0.0.217

11 months ago

0.0.212

12 months ago

0.0.211

12 months ago

0.0.208

1 year ago

0.0.204

1 year ago

0.0.203

1 year ago

0.0.202

1 year ago

0.0.207

1 year ago

0.0.206

1 year ago

0.0.201

2 years ago

0.0.200

2 years ago

0.0.198

2 years ago

0.0.197

2 years ago

0.0.191

2 years ago

0.0.188

2 years ago

0.0.185

2 years ago

0.0.178

2 years ago

0.0.167

2 years ago

0.0.164

2 years ago

0.0.161

2 years ago

0.0.158

2 years ago

0.0.155

2 years ago

0.0.144

2 years ago

0.0.137

2 years ago

0.0.125

2 years ago

0.0.120

2 years ago

0.0.113

2 years ago

0.0.112

2 years ago

0.0.100

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.3

2 years ago