New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dooboo-ui/native-edit-text

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dooboo-ui/native-edit-text

[![Npm Version](http://img.shields.io/npm/v/@dooboo-ui/native-edit-text.svg?style=flat-square)](https://npmjs.org/package/@dooboo-ui/native-edit-text) [![Downloads](http://img.shields.io/npm/dm/@dooboo-ui/native-edit-text.svg?style=flat-square)](https://n

  • 0.4.5
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

EditText

Npm Version Downloads

[EditText] component is an enhanced version on pure react-native [TextInput] component.

Preview

DefaultRow
underlinedunderlined_defaultunderlined_row
boxdefaultrow

Props

necessarytypesdefault
testIDstring
errorTestIDstring
isRowbooleanfalse
styleStyleProp<ViewStyle>
labelstring
labelTextStyleStyleProp<TextStyle>
valueTextInputProps
inputContainerTypestringunderlined
inputContainerRadiusstring3
borderStyleStyleProp<ViewStyle>
borderWidthnumber0.6
borderColorstring#eaeaf9
inputLeftMarginnumber110
textStyleStyleProp<TextStyle>
placeholderstring
placeholderTextColorstring
secureTextEntryboolean
onChangeText(e) => {}
onSubmitEditingfunc
leftElementReactElement
leftElementStyleStyleProp<ViewStyle>
rightElementReactElement
rightElementStyleStyleProp<ViewStyle>
textInputPropsTextInputProps
errorTextstring
errorTextStyleStyleProp<TextStyle>

Installation

yarn add @dooboo-ui/native

or

yarn add @dooboo-ui/native-edit-text

Getting started

  • Import

    import { EditText } from '@dooboo-ui/native';
    // or
    import EditText from '@dooboo-ui/native-edit-text';
    
  • Usage

    function Page(props: Props) {
      const validateEmail = (email: string) => {
        const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(email);
      };
    
      const fontStyle: TextStyle = {
        fontWeight: 'bold',
        fontSize: 13,
      };
    
      const [email, setEmail] = useState('');
      const [password, setPassword] = useState('');
      const [errorEmail, setErrorEmail] = useState('');
    
      const onSignIn = () => {
        if (!validateEmail(email)) {
          setErrorEmail('Not a valid email address');
        } else {
          setErrorEmail('');
        }
      };
    
      const onTextChanged = (type: string, text: string) => {
        type === 'EMAIL' ? setEmail(text) : setPassword(text);
    
        if (type === 'EMAIL' && text === '') {
          setErrorEmail('');
        }
      };
    
      return (
        <StyledScrollView
          contentContainerStyle={{
            marginTop: 8,
            paddingHorizontal: 20,
            paddingBottom: 40,
          }}
        >
          <Container>
            <HeaderTitle>Sign in with Email</HeaderTitle>
            <EditText
              testID="EMAIL_INPUT"
              textStyle={{
                color: '#495057',
              }}
              label="Email"
              placeholder="Write email address"
              placeholderTextColor="#ADB5BD"
              value={email}
              onChangeText={(text: string) => onTextChanged('EMAIL', text)}
              style={{ marginTop: 50 }}
              errorText={errorEmail}
              onSubmitEditing={onSignIn}
            />
            <EditText
              testID="PASSWORD_INPUT"
              textStyle={{
                color: '#ADB5BD',
              }}
              secureTextEntry={true}
              label="Password"
              placeholder="Please write your password"
              placeholderTextColor="#ADB5BD"
              value={password}
              onChangeText={(text: string) => onTextChanged('PASSWORD', text)}
              style={{ marginTop: 36 }}
              onSubmitEditing={onSignIn}
            />
            <StyledSignInButton
              testID="btnEmail"
              onClick={() => onSignIn()}
              textStyle={fontStyle}
              text="Login"
            />
            {/* Email SignUp text */}
            <View
              style={{
                marginTop: 20,
                flexDirection: 'row',
                justifyContent: 'center',
                alignItems: 'center',
              }}
            >
              <StyledText testID="NO_ACCOUNT">
                Do not have and account?{' '}
              </StyledText>
              <TouchableOpacity onPress={() => null} style={{ padding: 4 }}>
                <StyledAccentText>Find</StyledAccentText>
              </TouchableOpacity>
            </View>
          </Container>
        </StyledScrollView>
      );
    }
    

Keywords

FAQs

Package last updated on 10 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc