This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.android.js
executable file
·151 lines (139 loc) · 4.69 KB
/
App.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
View,
ScrollView,
Text,
Picker
} from 'react-native';
import SimpleComponent1 from './Components/SimpleComponent1/SimpleComponent1';
import TextInputComponent from './Components/TextInputComponent/TextInputComponent';
import SliderComponent from './Components/SliderComponent/SliderComponent';
import PickerComponent from './Components/PickerComponent/PickerComponent';
import SwitchComponent from './Components/SwitchComponent/SwitchComponent';
import axios from 'axios';
import ImageGalleryComponent from './Components/ImageGalleryComponent/ImageGalleryComponent';
import TouchableComponent from './Components/TouchableComponent/TouchableComponent';
import TouchableComponentAlt from './Components/TouchableComponentAlt/TouchableComponentAlt';
import StatusBarComponent from './Components/StatusBarComponet/StatusBarComponent';
import ToolBarComponent from './Components/ToolBarComponent/ToolBarComponent';
import IconsComponent from './Components/IconsComponent/IconsComponent';
import ListComponent from './Components/ListComponent/ListComponent';
import FetchComponent from './Components/FetchComponent/FetchComponent';
//import SceneComponent from './Components/SceneComponent/SceneComponent';
const imagesAPIURL = "https://jsonplaceholder.typicode.com/photos";
type Props = {};
export default class App extends Component<Props> {
constructor(props){
super(props);
this.state = {
textValue: "",
sliderValue: 0,
pickerCategory: "default",
switchValue: false,
images: {},
touchableText:"Nkwataako!",
selectedActionText: ""
}
}
changeValue = (value) => {
console.log("change");
this.setState({
textValue: value
});
console.log( value )
}
sliderValueChange = (value)=>{
this.setState({
sliderValue: value
});
}
slidingComplete = (value)=>{
console.log("COMPLETE: "+ value)
}
onPickerValueChange = (value)=>{
this.setState({
pickerCategory: value
});
}
onSwitchValueChange = (value)=>{
this.setState({
switchValue: value
});
console.log(value)
}
onTouchablePress = ()=>{
let text = this.state.touchableText;
if(text === "Nkwataako!")
this.setState({touchableText:"Waa?"});
else
this.setState({touchableText:"Nkwataako!"})
}
passText = (text)=>{
this.setState({
selectedActionText: text
})
}
render() {
let { sliderValue, pickerCategory, switchValue, images, touchableText, selectedActionText } = this.state;
let pickerOptions = {
Technology: "technology",
Nursing: "nursing",
Accounting: "accounting"
};
return (
<ScrollView>
<ToolBarComponent passText = { this.passText } />
<StatusBarComponent
statusText= {"I see Nothing"}
bgColor = {"red"}
barStyle = {"light-content"}
hidden = { false }
translucent = { false }
/>
<IconsComponent />
<FetchComponent />
<ListComponent />
<Text style={{padding: 5, margin: 5, justifyContent: 'center'}}>WYS: { selectedActionText }</Text>
<SimpleComponent1 />
<TextInputComponent
value = { this.state.textValue }
changeValue = { this.changeValue }
/>
<View style={{margin: 10}}>
<Text>{ sliderValue }</Text>
<SliderComponent
value={ sliderValue }
step= { 0.5 }
onValueChange={this.sliderValueChange}
onSlidingComplete={this.slidingComplete}
/>
<Text style={{marginTop: 15, fontWeight: "bold", fontSize: 16}}>Categories</Text>
<PickerComponent
category={ pickerCategory }
onValueChange={ this.onPickerValueChange }
options={ pickerOptions }
/>
<Text style={{marginTop: 15, fontWeight: "bold", fontSize: 16}}>Switch</Text>
<Text style={{marginTop: 15, fontWeight: "bold", fontSize: 16, color: switchValue?"green":"red"}}>{ switchValue?"ON":"OFF" }</Text>
<SwitchComponent
value={ switchValue }
onValueChange = { this.onSwitchValueChange }
/>
<Text style={{marginTop: 15, fontWeight: "bold", fontSize: 16}}>Gallery</Text>
<ImageGalleryComponent URL= { imagesAPIURL } />
<TouchableComponent onPress={ this.onTouchablePress } contentText={touchableText} />
<TouchableComponentAlt onPress={ this.onTouchablePress } contentText={touchableText} />
{/*<SceneComponent />*/}
</View>
</ScrollView>
);
}
}