react native textinput code example

Example 1: react native textinput turnoff capitalize first letter

// Set autoCapitalize to 'none' to stop first letter cap

Example 2: react native textinput

import React, { Component } from 'react';
import { TextInput } from 'react-native';

export default function UselessTextInput() {
  const [textInputValue, setTextInputValue] = React.useState('');

  return (
     setTextInputValue(text)}
      value={textInputValue}
	  placeholder="Insert your text!"
    />
  );
}

Example 3: textinput onpress react native

 console.log("Pressed")}>
  

Example 4: react native input

import React, { Component } from 'react';
import { TextInput } from 'react-native';

export default function UselessTextInput() {
  const [value, onChangeText] = React.useState('Useless Placeholder');

  return (
     onChangeText(text)}
      value={value}
    />
  );
}

Example 5: react native form input

import React, { useState } from 'react'
import * as rn from 'react-native'

const FormLogin = () => {
  const [value, setValue] = useState({
    username: '',
    password: ''
  })

  const onPress = () => {
    rn.Alert.alert(JSON.stringify(value))
    setValue({
      username: '',
      password: ''
    })
  }

  return (
    
      Form Login
      
         setValue({ ...value, username: text })}
          value={value.username}
          autoCompleteType='off'
        />
         setValue({ ...value, password: text })}
          value={value.password}
          autoCompleteType='off'
          secureTextEntry
        />
        
          
        
      
    
  )
}

const styles = rn.StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'flex-start',
    alignItems: 'center',
    padding: 10,
    margin: 10
  },
  titleLogin: {
    fontSize: 22,
    textAlign: 'center',
    color: 'black',
    fontWeight: '600'
  },
  form: {
    width: '100%',
    height: 'auto',
    justifyContent: 'center',
    alignItems: 'center',
    padding: 5,
    marginTop: 5
  },
  input: {
    width: 350,
    height: 40,
    padding: 5,
    margin: 5,
    borderWidth: 1,
    borderColor: 'grey',
    borderStyle: 'solid',
    borderRadius: 3
  },
  button: {
    width: 360,
    height: 40,
    padding: 5,
    margin: 5,
    borderRadius: 3
  }
})

export default FormLogin

Tags: