1.5.6 • Published 5 months ago

@team-devmonster/react-form v1.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@team-devmonster/react-form

This is devmonster's react module for make app easily. This is compatible with devmonster's react-native module. @team-devmonster/react-native-form

This use react-hook-form.

author: devmonster

hompage: https://devmonster.co.kr email: aldegad@devmonster.co.kr

author: devmonster

We are always looking for investment or assistance. hompage: https://devmonster.co.kr email: aldegad@devmonster.co.kr

items

Getting started

$ npm install react-hook-form @hookform/error-message

$ npm install @team-devmonster/react-theme@latest @team-devmonster/react-tags@latest @team-devmonster/react-form@latest

Usage

1. Set Provider

This is a way for specifying the default style. You can skip it if you don't want to.

// App.theme.tsx => You can use any file name :)
import { TagProvider, TagStyle, ButtonProps } from '@team-devmonster/react-tags';

export const AppFormProvider = ({children}: {children:React.ReactNode}) => {

  //const { div, button } = useTheme<Theme>();
  const color = { step300: '#cccccc', white: '#ffffff', black: '#111111' };

  const input:TagStyle = {
    position: 'relative',
    backgroundColor: color.white,
    borderColor: color.step300,
    color: color.black,
    borderRadius: 5,
    borderWidth: 1,
    fontSize: fontSize.base,
    paddingTop: 10,
    paddingBottom: 10,
    paddingLeft: 10,
    paddingRight: 10,
    minHeight: 42,
    flex: 1
  }
  return (
    <FormProvider formConfig={{ div, button }}>
      {children}
    </FormProvider>
  )
}
import { AppFormProvider } from './App.theme';

export default function App() {

  return (
    <AppFormProvider>
      <Component></Component>
    </AppFormProvider>
  )
}

1-1. If you use with react-theme

// App.theme.tsx => You can use any file name :)
import { useTheme } from '@team-devmonster/react-theme';
import { TagProvider, TagStyle } from '@team-devmonster/react-tags';

export const AppTagProvider = ({children}: {children:React.ReactNode}) => {

  const { input, checkbox } = useTheme<Theme>();
  
  return (
    <TagProvider formConfig={{ input, checkbox }}>
      {children}
    </TagProvider>
  )
}
import { AppThemeProvider, AppTagProvider, AppFormProvider } from './App.theme';

export default function App() {

  return (
    <AppThemeProvider>
      <AppTagProvider>
        <AppFormProvider>
          <Component></Component>
        </AppFormProvider>
      </AppTagProvider>
    </AppThemeProvider>
  )
}

2. Usage

It's so simple.

import React from "react";
import { View, Text, StyleSheet } from "react-native";
import { useTheme } from '@team-devmonster/react-theme';

import { Theme } from './App.theme';

const TagsEx = () => {

  // if you use with `react-theme`
  const { color, fontSize } = useTheme<Theme>();

  return (
    <Div
      style={{
        backgroundColor: color.white, 
        flex: 1, 
        padding: 18 
      }}>
      <Div style={{ fontSize: fontSize.xl }}>
        {`1. div => <Div></Div>`}
      </Div>
      <Div>
        <Button color={color.primary} onClick={() => Alert.alert('pressed')}>
          {`2. button => <Button></Button>`}
        </Button>
      </Div>
      <Div>
        <Img 
          style={{
            width: '100%',
            aspectRatio: 1.774, 
            backgroundColor: color.step500
          }} 
          src="https://devmonster.co.kr/static/media/main-bg-05.d88f30e7.png"></Img>
      </Div>
      <P style={{  
        marginBottom: 24, 
        height: 80
        }}>
        hello button~
        <Span>hello</Span>
        <Button 
          color={color.primary} 
          style={{ display: 'inline-flex' }}>inline button</Button>
        hello~!
        <P>hello next line!</P>
      </P>
      <P style={{ marginBottom: 20, color: color.primary }}>
        hello?
        <Button color={color.step500}>not inline button. normal button.</Button>
      </P>
      <Button 
        color={color.primary}
        fill="outline"
        style={{ 
          alignSelf: 'stretch', 
          alignItems: 'center',
          fontSize: fontSize.sm,
          ...shadow.base,
          marginBottom: 18
        }}>
          hellohellohello omg~
          <Img 
          style={{
            width: 20,
            aspectRatio: 1.774, 
            backgroundColor: color.step500
          }} 
          src="https://devmonster.co.kr/static/media/main-bg-05.d88f30e7.png"></Img>
      </Button>

      <Button color={color.primary} fill="outline" style={{ marginBottom: 8 }}>
        outline
      </Button>

      <Button color={color.primary} fill="translucent">
        translucent
      </Button>
    </Div>
  )
}

export default TagsEx;

3. Tags Info

Button

propsvaluesdescription
colorHEX
fillbase outline translucentdefault: base
onClickonPresssame as onPress
stylestylestyle
chilrenchilrenchilren

Button

propsvaluesdescription
objectFitcontain coverdefault: contain
stylestylestyle
1.5.6

5 months ago

1.4.6

10 months ago

1.5.5

8 months ago

1.5.4

8 months ago

1.5.3

8 months ago

1.5.1

9 months ago

1.5.0

10 months ago

1.4.9

10 months ago

1.4.11

10 months ago

1.4.8

10 months ago

1.4.10

10 months ago

1.4.7

10 months ago

1.4.5

11 months ago

1.4.4

12 months ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.9

1 year ago

1.3.7

1 year ago

1.3.8

1 year ago

1.3.6

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago