1.6.0-beta63 • Published 2 years ago

@huds0n/components v1.6.0-beta63

Weekly downloads
169
License
MIT
Repository
-
Last release
2 years ago

Status GitHub Issues GitHub Pull Requests License


📝 Table of Contents

🧐 About

Enhanced common react native components!

✅ List of Components

  • Badge: Numbered badge, similar to IOS notification badge.
  • Button: Highly customizable button, with built-in spinner.
  • FadeOverlay: Overlay container that enables fading at component edges.
  • FlatList: Enhanced to have built-in pull to refresh, scroll fading, and more.
  • Icon: Use either image or vector icon props, and optional badge.
  • Pressable: Easily control feedback.
  • ScrollView: Automatic scroll to focus when used with @huds0n/inputs, dynamically disables scrolling when content less than view.
  • View: Has onPressThrough method and enables passing layout directly to children._

🏁 Getting Started

Prerequisites

Requires React Native 0.63 or above. If using Expo install @expo/vector-icons and expo-linear-gradient, otherwise install and link react-native-vector-icons and react-native-linear-gradient.

Installing

npm i @huds0n/components

🧑‍💻 Usage

Badge

PropRequired/(Default)DescriptionType
color#E63B2EBackground colorstring
containerStyle-Badge container styleviewstyle
maxValue9Over this value the badge will just show a plusPrevents large badge values which will be difficult to seenumber
offset-Translates badge to the right offset{ x?: number,y?: number }
size14Size of badgenumber
textColor#FFFFFFText colorstring
textStyle#FFFFFFButton text style colortextStyle
valueCurrent badge valuenumber

Button

Inherits all Pressable props.

PropRequired/(Default)DescriptionType
color-Background colorstring
disabledLabelStyle-Label style when disabledtextStyle
disabledStyle-Disabled container styleviewstyle
dismissInputOnPresstrueIf true, input is dismissed on button pressboolean
label-Label textAlso set by passing a string as a child propstring
labelStyle-Label styletextStyle
pressedStyle-Pressed container styleviewstyle
pressedLabelStyle-Pressed label styletextStyle
spinnerfalseShow activitity indicatior instead of labelboolean
spinnerColor#FFFFFFColor of activity indicatorstring
spinnerStyle-Spinner container styleviewStyle
style-Base container styleviewstyle
useIsConnected-If true, becomes disabled when there is no networkRequires @huds0n/network-manager initializedboolean

FadeOverlay

npm.io

PropRequired/(Default)DescriptionType
color#FFFFFFOapaque color colorstring
height-Height of containernumber or string
intensity2The rate fadeinteger
positionTOPDefines which direction to fade'TOP', 'BOTTOM', 'LEFT', or 'RIGHT'
width-Width of containernumber or string

FadeOverlayContainer

PropRequired/(Default)DescriptionType
top-Top fadeFadeOverlay Props or boolean
bottom-Bottom fadeFadeOverlay Props or boolean
left-Left fadeFadeOverlay Props or boolean
right-Right fadeFadeOverlay Props or boolean

This component can be placed within any view, quickly adding fading to any/all sides. If option is true a standard white fade is used

FlatList

Like the ScrollView, the FlatList will automatically disable its scroll if the conents are smaller than the container.

PropRequired/(Default)DescriptionType
activityIndicatorColor-Activity indicator color on pull to refreshstring
fade-Controls edge fadingFadeOverlayContainer Props
keyName-Extract key from an element's propertyData elements must be objectskey of data element
onPullToRefresh-Adds Refresh Control, runs on pulling down() => (void | Promise\)

Icon

Inherits all Pressable props except style.

PropRequired/(Default)DescriptionType
badge0Adds badge with valuenumber
dismissInputOnPresstrueIf true, input is dismissed on icon pressboolean
backgroundColor-Background colorstring
badgeProps-Style badgeBadge props
color-Icon colorstring
containerStyle-Badge container styleviewstyle
size20Icon sizenumber
Component-Icon componentReact.Component
imageProps-Icon image component props, if source is usedImage Props
source-Icon image sourceImage Source
set-VectorIcon set nameSet Name
name-VectorIcon icon nameIcon Name
disableProps-Over-ride props when disabled(any of the above)
pressedProps-Over-ride props when pressed(any of the above)

Icon will preferentially be a vector icon if there is a name and set, then an image icon if there is a source, and finally a component icon.

Pressable

Inherits all React Native's Pressable props except style.

PropRequired/(Default)DescriptionType
android_ripplefalseAdds ripple effect as feedback to android devicesIf true, defaults to darker background colorRippleConfig or boolean
feedback'none'Type of feedback'fade', 'hightlight', or 'none'
feedbackIntensity-The intensity of the fade, highlight, or ripplenumber
whilePress-Take a function that return another functionThe initial function is called on pressThe return function is called on release() => () => void

ScrollView

Like the FlatList, the ScrollView will automatically disable its scroll if the conents are smaller than the container.Also, if the @huds0n/inputs module is being used, the ScrollView will automatically scroll to ensure any focused input is in view.

PropRequired/(Default)DescriptionType
inputPadding20The amount of padding the ScrollView will ensure focused inputs will havenumber
fade-Controls edge fadingFadeOverlayContainer Props

View

Inherits all React Native's View props.

PropRequired/(Default)DescriptionType
onPressThrough-Called whenever the view captures a touch eventHowever, touch event still passed down to children() => any
children-Accepts either children or function that receives layoutReact Node or (layout: Layout) => React Node

Similar to Pressable, View can take a function. This function passes in Layout which can be directly used. Layout is undefined initally as it is calculated on mount. Once calculated, height, width, x, and y are available to use.

import { View } from '@huds0n/components';

export function ExampleFunction() {
  return (
    <View style={{ height: '100%', width: '100%' }}>
      {(layout) =>
        layout && (
          <Text style={{ fontSize: layout.height / 2 }}>
            This text will grow with View size
          </Text>
        )
      }
    </View>
  );
}

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

  • Special thanks to my fiance, Arma, who has been so patient with all my extra-curricular work.
1.6.0-beta53

2 years ago

1.6.0-beta54

2 years ago

1.6.0-beta60

2 years ago

1.6.0-beta61

2 years ago

1.6.0-beta63

2 years ago

1.6.0-beta46

2 years ago

1.6.0-beta47

2 years ago

1.6.0-beta48

2 years ago

1.6.0-beta49

2 years ago

1.6.0-beta42

2 years ago

1.6.0-beta44

2 years ago

1.6.0-beta45

2 years ago

1.6.0-beta50

2 years ago

1.6.0-beta51

2 years ago

1.6.0-beta52

2 years ago

1.6.0-beta35

2 years ago

1.6.0-beta36

2 years ago

1.6.0-beta37

2 years ago

1.6.0-beta38

2 years ago

1.6.0-beta31

2 years ago

1.6.0-beta40

2 years ago

1.6.0-beta26

2 years ago

1.6.0-beta13

2 years ago

1.5.1-beta3

3 years ago

1.5.1-beta.1

3 years ago

1.5.1-beta.2

3 years ago

1.5.0-beta.21

3 years ago

1.5.0-beta.20

3 years ago

1.5.0-beta.18

3 years ago

1.5.0-beta.16

3 years ago

1.5.0-beta.15

3 years ago

1.5.0-beta.14

3 years ago

1.5.0-beta.13

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.4-beta.4

3 years ago

1.3.4-beta.3

3 years ago

1.3.4-beta.2

3 years ago

1.3.4-beta.1

3 years ago

1.3.3-beta.7

3 years ago

1.3.3-beta.6

3 years ago

1.3.3-beta.3

3 years ago

1.3.3-beta.5

3 years ago

1.3.3-beta.4

3 years ago

1.3.3-beta.2

3 years ago

1.3.2-beta.8

3 years ago

1.3.2-beta.7

3 years ago

1.3.2-beta.6

3 years ago

1.3.2-beta.5

3 years ago

1.3.2-beta.4

3 years ago

1.3.2-beta.3

4 years ago

1.3.2-beta.1

4 years ago

1.3.1-beta.24

4 years ago

1.3.1-beta.23

4 years ago

1.3.1-beta.22

4 years ago

1.3.1-beta.21

4 years ago

1.3.1-beta.20

4 years ago

1.3.1-beta.16

4 years ago

1.3.1-beta.17

4 years ago

1.3.1-beta.15

4 years ago

1.3.1-beta.11

4 years ago

1.3.1-beta.9

4 years ago

1.3.1-beta.7

4 years ago

1.3.1-beta.6

4 years ago

1.3.0-beta.22

4 years ago

1.3.0-beta.21

4 years ago

1.3.0-beta.20

4 years ago

1.3.0-beta.19

4 years ago

1.3.0-beta.18

4 years ago

1.3.0-beta.17

4 years ago

1.3.0-beta.16

4 years ago

1.3.0-beta.15

4 years ago

1.3.0-beta.13

4 years ago

1.3.0-beta.12

4 years ago

1.3.0-beta.10

4 years ago

1.3.0-beta.7

4 years ago

1.3.0-beta.6

4 years ago

1.3.0-beta.5

4 years ago

1.3.0-beta.4

4 years ago

1.2.0-beta.20

4 years ago

1.3.0-beta.2

4 years ago

1.3.0-beta.3

4 years ago

1.2.0-beta.19

4 years ago

1.2.0-beta.18

4 years ago

1.2.0-beta.17

4 years ago

1.2.0-beta.16

4 years ago

1.2.0-beta.15

4 years ago

1.2.0-beta.12

4 years ago

1.2.0-beta.14

4 years ago

1.2.0-beta.13

4 years ago

1.2.0-beta.9

4 years ago

1.2.0-beta.8

4 years ago

1.2.0-beta.7

4 years ago

1.2.0-beta.6

4 years ago

1.2.0-beta.5

4 years ago

1.2.0-beta.4

4 years ago

1.3.0-beta.1

4 years ago

1.2.0-beta.3

4 years ago

1.2.0-beta.2

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago