11import React from 'react' ;
22import {
3- ActivityIndicator ,
43 Image ,
5- Pressable ,
64 ScrollView ,
75 StatusBar ,
86 StyleSheet ,
97 Text ,
10- TextInput ,
118 View ,
129} from 'react-native' ;
10+ import { PressMe } from './src/PressMe' ;
1311
1412const Section : React . FC < {
1513 title : string ;
@@ -23,20 +21,6 @@ const Section: React.FC<{
2321} ;
2422
2523const App = ( ) => {
26- const [ text , setText ] = React . useState ( '' ) ;
27- const [ isLongPressed , setIsLongPressed ] = React . useState ( false ) ;
28- const [ isLoading , setIsLoading ] = React . useState ( false ) ;
29- const [ isLoaded , setIsLoaded ] = React . useState ( false ) ;
30-
31- React . useEffect ( ( ) => {
32- if ( isLoading ) {
33- setTimeout ( ( ) => {
34- setIsLoading ( false ) ;
35- setIsLoaded ( true ) ;
36- } , 1500 ) ;
37- }
38- } , [ isLoading ] ) ;
39-
4024 return (
4125 < ScrollView
4226 contentInsetAdjustmentBehavior = "automatic"
@@ -48,39 +32,7 @@ const App = () => {
4832
4933 < Image source = { require ( './assets/logo.png' ) } style = { styles . logo } />
5034
51- < View style = { styles . header } >
52- { ! isLoaded && ! isLoading && (
53- < Pressable
54- testID = "Pressable"
55- onPress = { ( ) => setIsLoading ( true ) }
56- onLongPress = { ( ) => setIsLongPressed ( true ) }
57- style = { styles . button }
58- >
59- < Text style = { styles . buttonText } > Press Me</ Text >
60- < Text style = { styles . buttonArrow } > →</ Text >
61- </ Pressable >
62- ) }
63-
64- { isLoading && < ActivityIndicator /> }
65-
66- { isLongPressed && ! isLoading && ! isLoaded && (
67- < Text style = { styles . textLongPressed } > Long Pressed!</ Text >
68- ) }
69-
70- { ! isLoading && isLoaded && (
71- < >
72- < Text style = { styles . textInputLabel } > This is a label *</ Text >
73-
74- < TextInput
75- testID = "TextInput"
76- placeholder = "Type something here"
77- onChangeText = { setText }
78- value = { text }
79- style = { styles . textInput }
80- />
81- </ >
82- ) }
83- </ View >
35+ < PressMe />
8436
8537 < Section title = "Setup" >
8638 Install < Text style = { styles . highlight } > react-native-owl</ Text > and
@@ -129,25 +81,6 @@ const styles = StyleSheet.create({
12981 height : 175 ,
13082 alignSelf : 'center' ,
13183 } ,
132- header : {
133- marginVertical : 35 ,
134- } ,
135- button : {
136- flexDirection : 'row' ,
137- justifyContent : 'space-between' ,
138- alignItems : 'center' ,
139- borderWidth : 2 ,
140- paddingVertical : 7.5 ,
141- paddingHorizontal : 20 ,
142- borderRadius : 20 ,
143- } ,
144- buttonText : {
145- fontSize : 16 ,
146- fontWeight : '600' ,
147- } ,
148- buttonArrow : {
149- fontSize : 20 ,
150- } ,
15184 sectionContainer : {
15285 marginBottom : 32 ,
15386 } ,
0 commit comments