|
1 | | -import {useContext, useState} from "react"; |
2 | | -import Context from "../../Context/Context"; |
3 | | -import {Clipboard, Text, TouchableOpacity, View} from "react-native"; |
4 | | -import {FontAwesomeIcon} from "@fortawesome/react-native-fontawesome"; |
5 | | -import {faCopy, faRobot} from "@fortawesome/free-solid-svg-icons"; |
6 | | -import TypeWriter from "react-native-typewriter"; |
| 1 | +/* eslint-disable react/react-in-jsx-scope */ |
| 2 | +/* eslint-disable react-native/no-inline-styles */ |
| 3 | +import {useContext, useState} from 'react'; |
| 4 | +import Context from '../../Context/Context'; |
| 5 | +import {Clipboard, Dimensions, Text, TouchableOpacity, View} from 'react-native'; |
| 6 | +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'; |
| 7 | +import {faCopy, faRobot} from '@fortawesome/free-solid-svg-icons'; |
| 8 | +import TypeWriter from 'react-native-typewriter'; |
7 | 9 |
|
8 | 10 | export const AiThinking = () => { |
9 | | - const [random,setRandom]=useState(Math.floor(Math.random() * 7)) |
10 | | - const Dailogs = [ |
11 | | - "Thinking...💭", |
12 | | - "Till I am thinking your answer, Did you know:\nPeater Parker is Spiderman🕸️", |
13 | | - "While I am thinking, Do you know:\n\"The Eiffel Tower can be 15 cm taller during the summer🧠\"", |
14 | | - "Your response is on the route...🚗", |
15 | | - "Your answer is on the way, Till the time here is a fun fact:\n\"Scotland's national animal is unicorn!🫏\"", |
16 | | - "Spinning the hamster wheel of progress...🐭", |
17 | | - "Riding the waves of data...👩💻" |
18 | | - ] |
19 | | - const [writing,setWriting]=useState(1) |
20 | | - return ( |
21 | | - <View style={{ |
22 | | - backgroundColor:Style1.color5, |
23 | | - elevation:1, |
24 | | - marginVertical:10 |
| 11 | + const [random, setRandom] = useState(Math.floor(Math.random() * 7)); |
| 12 | + const Dailogs = [ |
| 13 | + 'Thinking...💭', |
| 14 | + 'Till I am thinking your answer, Did you know:\nPeater Parker is Spiderman🕸️', |
| 15 | + 'While I am thinking, Do you know:\n"The Eiffel Tower can be 15 cm taller during the summer🧠"', |
| 16 | + 'Your response is on the route...🚗', |
| 17 | + 'Your answer is on the way, Till the time here is a fun fact:\n"Scotland\'s national animal is unicorn!🫏"', |
| 18 | + 'Spinning the hamster wheel of progress...🐭', |
| 19 | + 'Riding the waves of data...👩💻', |
| 20 | + ]; |
| 21 | + const [writing, setWriting] = useState(1); |
| 22 | + const width = Dimensions.get('window').width; |
| 23 | + return ( |
| 24 | + <View |
| 25 | + style={{ |
| 26 | + padding: width * 0.02, |
| 27 | + marginVertical: 4, |
| 28 | + }}> |
| 29 | + <View |
| 30 | + style={{ |
| 31 | + backgroundColor: '#5248a8', |
| 32 | + alignSelf: 'flex-end', |
| 33 | + fontSize: 17, |
| 34 | + borderRadius: 10, |
| 35 | + padding: width * 0.04, |
25 | 36 | }}> |
26 | | - <View style={{ |
27 | | - paddingHorizontal:10, |
28 | | - paddingTop:10, |
29 | | - flexDirection:"row", |
30 | | - alignItems:"center", |
31 | | - }}> |
32 | | - <FontAwesomeIcon icon={ faRobot } style={{ |
33 | | - padding:10, |
34 | | - color:Style1.color2 |
35 | | - }}/> |
36 | | - <Text style={{ |
37 | | - color:Style1.color2, |
38 | | - fontSize:17, |
39 | | - paddingLeft:5 |
40 | | - }}>Thinking...</Text> |
41 | | - </View> |
42 | | - <View style={{ |
43 | | - padding:15, |
44 | | - paddingTop:2, |
45 | | - paddingLeft:27, |
46 | | - marginTop:3, |
47 | | - fontSize:17, |
48 | | - }}> |
49 | | - <TypeWriter minDelay={1} maxDelay={1} typing={writing} style={{ |
50 | | - color:Style1.color4 |
51 | | - }} onTypingEnd={()=>{ |
52 | | - if(writing===-1){ |
53 | | - setRandom(Math.floor(Math.random() * 7)) |
54 | | - setTimeout(()=>{ |
55 | | - setWriting(1) |
56 | | - },1000) |
57 | | - |
58 | | - }else { |
59 | | - setTimeout(()=>{ |
60 | | - setWriting(-1) |
61 | | - },5000) |
62 | | - } |
63 | | - }}>{Dailogs[random]}</TypeWriter> |
64 | | - </View> |
65 | | - |
66 | | - </View> |
67 | | - ) |
68 | | -} |
| 37 | + <TypeWriter |
| 38 | + minDelay={1} |
| 39 | + maxDelay={1} |
| 40 | + typing={writing} |
| 41 | + style={{ |
| 42 | + color: 'white', |
| 43 | + }} |
| 44 | + onTypingEnd={() => { |
| 45 | + if (writing === -1) { |
| 46 | + setRandom(Math.floor(Math.random() * 7)); |
| 47 | + setTimeout(() => { |
| 48 | + setWriting(1); |
| 49 | + }, 1000); |
| 50 | + } else { |
| 51 | + setTimeout(() => { |
| 52 | + setWriting(-1); |
| 53 | + }, 5000); |
| 54 | + } |
| 55 | + }}> |
| 56 | + {Dailogs[random]} |
| 57 | + </TypeWriter> |
| 58 | + </View> |
| 59 | + </View> |
| 60 | + ); |
| 61 | +}; |
0 commit comments