0.4.4 • Published 3 years ago

phoenix-rn-helper v0.4.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

phoenix-rn-helper

Notice: Some components relias on the some specific packages. Make sure to install them first to things to work. Full list of packages can be found here.

index

  1. Divider
  2. ColorSelector
  3. CheckBox
  4. ThemeToggler
  5. TouchHere

Divider

This Component adds the pure line throughout the whole width. Example:

<Divider size={2} color="black" margin={10} />

Screenshot TODO://

OptionTypeRequiredDefaultDescription
sizeNumberNoStyleSheet.hairlineWidth (Very thin)Height of Divider
colorStringNogreyColor of the Divider
marginNumberNo0Space left on both horizontal ends

ColorSelector

This component provides one little button alike which opens color pallate Model to choose color.

Warning: You need to install react-native-color-picker as a dependancies for this to work.

Example:

<ColorSelector
  value={flowerColor}
  onChange={(color) => setFlowerColor(color)}
  style={
    {
      // Additional styles
    }
  }
/>

Screenshot: TODO://

OptionTypeRequiredDefaultDescription
valueColor StringYesNoneThe value to represent color
onChangeFunction: colorNo?NoneFunction to be called each time color changes
stylestyle objectNo30x30 square with some border radiusA style object to change the appearance of the button.

Although style prop is allowed, backgroundColor will always be current color value.

CheckBox

This component is simple checkbox. By default it gives retro ✔️ and ❌ vibe. But it is completely customizable.

Example:

<CheckBox
  value={check}
  onChange={(e) => setCheck(e)}
  boxStyle={{
    borderRadius: 0,
    borderWidth: 2,
    borderColor: "black",
  }}
  TrueComponent={() => <Text>T</Text>}
  FalseCoponent={() => <Text>F</Text>}
/>

Notice: To render custom components ( TrueComponent & FalseComponent) You have to provide both component. Providing One component will result in default render.

Screenshot: TODO://

OptionTypeRequiredDefaultDescription
valueBooleanYesnoneThe boolean value to control the checkbox
onChangeFunction: valueYesnoneFunction that will be called with updated boolean value
boxStylestyle objectNo{ width: 30,height: 30,borderRadius: 10,backgroundColor: "lightgrey", borderWidth: 1, borderColor: "black", alignItems: "center", justifyContent: "center", }Outer Box styling. Keep in mind that deafult style will be applied first and then custom style
TrueComponentReact-Native componentNononeComponent to render when checkbox value is true
FalseComponentReact-Native componentNononeComponent to render when checkbox value is false

ThemeToggler

This component provides theme toggler with smooth animation inspired from Telegram's theme toggler button.

Warning: You need to install react-native-svg and react-native-reanimated (v2) as a dependancies for this to work.

Example:

<ThemeToggler
  value={theme}
  onChange={(newTheme) => setTheme(newTheme)}
  boxStyle={{ backgroundColor: "blue" }}
  duration={700} // defaults to 1000(1 second)
  sunColor="#ff0"
  moonColor="#fff"
/>

Screenshot: TODO://

OptionTypeRequiredDefaultDescription
value"light" | "dark"YesnoneString value that contains current theme value
onChangeFunction: ("light" | "dark")YesnoneFunction that will be called each time theme changes
durationNumberNo1000Duration of animation
boxStylestyle objectNo{ width: 60, height: 60, borderRadius: 100, backgroundColor: "#2155ff", padding: 5, alignItems: "center", justifyContent: "center" }Style object for main container. Make sure to have proper backgroundColor reltive to sunColor and moonColor
sunColorColorNo#fffColor of sun (light theme indicator)
moonColorColorNo#fffColor of moon (dark theme indicator)

TouchHere

Warning: This component is not perfect. It is based on Modal component of react-native which is not that much good.

This component shows a hand indicating your user to that they have to touch here. This is generaly used on onboarding page but can be used anywhere.

You have to provide absolute value of point to be shown to click. You generally want to use useLayout hook to calculate where your target element is. This is one of the drawback of this component. I might add custom component based but can't promise.

Warning: You need to install react-native-svg and react-native-reanimated (v2) as a dependancies for this to work.

Example:

<TouchHere
  x={120}
  y={70}
  visible={touchIndicator}
  onRequestClose={() => setTouchIndicator(false)}
  duration={4000}
  delay={2000}
  handColor="white"
  ringColor="black"
/>

Screenshot: TODO://

OptionTypeRequiredDefaultDescription
visibleBooleanYesnoneThe control variable to show the modal. recomended to set true in start and use delay prop to adjust timing
onRequestCloseFunctionYesnoneFunction that will be called on closing of component.
xNumberYes100X cordination of touch to be shown
yNumberYes100Y cordination of touch to be shown
durationNumberNo3500Duration of the whole animation includes both hand down and waves so make sure to have higher value
delayNumberNo0How much time after animation should be shown. Generally you want to wait for the user to touch on desired location and if not touched then show this so you can use delay property for that
handColorColorNo#fffColor of hand. It is just outline like color. Whole hand won't be filled with this color because it is better to show as much as background to user as possible
ringColorColorNo#fffColor of waves. Currently 2 waves will be shown.

External-packages

  • react-native-color-picker (ColorSelector)
  • react-native-reanimated@^2.1.0 (ThemeToggler, TouchHere)
  • react-native-svg (ThemeToggler, TouchHere)

Quick all install

npm i react-native-color-picker react-native-reanimated react-native-svg

OR

yarn add react-native-color-picker react-native-reanimated react-native-svg
0.4.4

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago