Copy and Paste  -   An Application to Copy/Paste Text  

 
S.No 5785 Name fire wood Date/Time 21-Sep-2023 10:34:52 AM

Copy text from below

import { StyleSheet, Text, View,TextInput, TouchableOpacity} from 'react-native';
import {useState } from "react"


export default function App() {
  const [text,settext]=useState("")
  const [comtext,setcomtext]=useState("")
  const [win,setwin]=useState("...")

  winner=()=>{
 
    if(text=="fire" && comtext=="wood")
   return "User"
    else if(text=="wood" && comtext=="fire")
   return "computer"
    else if(text=="wood" && comtext=="water")
   return "user"
    else if(text=="water" && comtext=="wood")
   return "computer"
   else if(text=="water" && comtext=="fire")
   return "user"
   else if(text=="fire" && comtext=="water")
   return "computer"

     else if(text==comtext)
   return "draw"
 
     
  }
  indexchoise=()=>{
return choise[Math.floor(Math.random()*choise.length)]
  }

  var choise = ["fire","wood","water"]
  return (
   <View style={{
       
          height: 200,
          backgroundColor: 'powderblue',
        }}>
        <Text>Your choise:</Text>
   <TextInput
   value={text}
    style={{
         
          backgroundColor: 'white',
          borderWidth:2
         
        }}/>
        <Text>computer choise:</Text>
   <TextInput
   value={comtext}
    style={{
         
          backgroundColor: 'white',
          borderWidth:2
         
        }}/>
        <Text>winner!!</Text>
   <TextInput
   value={win}
    style={{
         
          backgroundColor: 'white',
          borderWidth:2
         
        }}/>


   
          <View style={{flexDirection:'row'}}>

   <TouchableOpacity
   style={styles.button}
    onPress={()=>{settext("fire")
                 setcomtext(indexchoise)  
                 setwin("") ;  
    }}
   >
 
        <Text
        style = {styles.text}>Fire</Text>
     
      </TouchableOpacity>
        <TouchableOpacity
   style={styles.button}
    onPress={()=>{settext("wood")
        setcomtext(indexchoise)
        setwin("") ;
    }}
   >
 
        <Text
        style = {styles.text}>wood</Text>
     
      </TouchableOpacity>
       <TouchableOpacity
   style={styles.button}
    onPress={()=>{settext("water")
        setcomtext(indexchoise)
        setwin("") ;
    }}
   >
 
        <Text
        style = {styles.text}>water</Text>
     
      </TouchableOpacity>
     
      <TouchableOpacity
   style={styles.button}
    onPress={()=>{
                 setwin(winner) ;  
    }}
   >
 
        <Text
        style = {styles.text}>result</Text>
     
      </TouchableOpacity>

      </View>
     

    </View>
  );
}



const styles = StyleSheet.create({
 
  button: {
    alignItems: 'center',
    backgroundColor: 'blue',
    width: 73,
    margin:5,    
  },

  text: {
    color: 'white'
  }
 
});






comments powered by Disqus
NEW ENTRIES
S.No Name Entry Time/Date
5993 KIDs Videos 22-Jul-2024 07:26:57 AM
5992 S3XY GIRL 17-Jul-2024 09:48:56 AM
5991 bb 15-Jul-2024 11:05:23 AM
5990 main 15-Jul-2024 11:04:16 AM
5989 landscape 12-Jul-2024 04:02:16 PM
5988 aaa 12-Jul-2024 09:32:46 AM
5987 Emi Pet Mobi 11-Jul-2024 10:29:07 AM
5986 snake 11-Jul-2024 08:24:29 AM
5985 player 10-Jul-2024 02:00:49 PM
5984 movement 10-Jul-2024 08:52:29 AM
5983 snake 10-Jul-2024 08:50:12 AM
5982 af 09-Jul-2024 09:24:28 AM
5981 aa 08-Jul-2024 10:55:34 PM
5980 flu1 08-Jul-2024 04:02:35 PM
5979 flu 08-Jul-2024 03:58:49 PM
5978 Emi Pet | Po 08-Jul-2024 03:40:03 PM
5977 Empire Home 07-Jul-2024 08:31:42 AM
5976 Empire Meals 05-Jul-2024 11:37:32 AM
5975 prb 05-Jul-2024 09:07:27 AM
5974 Vital Eagles 03-Jul-2024 09:09:55 AM
5973 C34 02-Jul-2024 03:07:34 PM
5972 C33 02-Jul-2024 02:32:40 PM
5971 Vital Inc. 02-Jul-2024 07:55:25 AM
5970 container 01-Jul-2024 03:06:18 PM
5969 new 01-Jul-2024 12:48:17 PM
5968 360 Modular 29-Jun-2024 03:16:17 PM
5967 quiz 28-Jun-2024 08:10:48 PM
5966 gesture 28-Jun-2024 07:56:05 PM
5965 Garden Distr 28-Jun-2024 09:34:32 AM
5964 Child Sexy 27-Jun-2024 10:29:38 AM

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 [Next] [Last]
 
web counter
web counter


To report any error messages or bugs, or other issues, please send email at: info@pakproject.com