-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
325 lines (303 loc) · 8.98 KB
/
App.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, {useRef} from 'react';
import type {Node} from 'react';
import { setCustomText } from 'react-native-global-props';
import {
StyleSheet,
View,
Image,
TouchableOpacity,
Share,
DrawerLayoutAndroid,
Text
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from './src/Components/HomeScreen';
import LessonScreen from './src/Components/LessonScreen';
import Introduction from './src/Components/Introduction';
import PatternScreen from './src/Components/PatternScreen';
import QuizScreen from './src/Components/QuizScreen';
import ChallengeScreen from './src/Components/ChallengeScreen';
import CongratulationsScreen from './src/Components/CongratulationsScreen';
import './src/Components/Global';
import Rate, { AndroidMarket } from 'react-native-rate'
const Stack = createNativeStackNavigator();
const customTextProps = {
style: {
fontFamily: 'SourceSansPro-Regular',
color:'#09101D',
fontSize:global.scaleFontSize(18)
}
}
setCustomText(customTextProps);
const theme = {
colors: {
background:'#fff'
}
}
const shareBtn = (drawer) => {
return (
<TouchableOpacity onPress={() => drawer.current.openDrawer()}>
<View style={styles.shareContainer}>
<Image
style={{width:17,opacity:0.7, height:17}}
source={require('./assets/images/menu.png')} />
</View>
</TouchableOpacity>
)
}
const homeScreenOptions = (drawer) => {
return {
headerStyle: {
backgroundColor:'#fff',
color:"#000"
},
headerTitleStyle: {
color:'#09101D',
fontSize:global.scaleFontSize(22)
},
title:'Candlestick Patterns',
headerRight: () => shareBtn(drawer),
headerTitleAlign: 'left',
headerLeft: () => { return <Image style={{marginRight:20}} source={require('./assets/images/logo.png')} /> },
headerShadowVisible:false,
}
}
const HeaderLeft = (navigation) => {
return (
<TouchableOpacity
onPress={() => {navigation.goBack(null)}}
>
<View style={styles.imageContainer}>
<Image
style={{
margin:'auto',
width:19,
height:19,
}}
source={require('./assets/images/back.png')} />
</View>
</TouchableOpacity>
)
}
const headerStyle = {
backgroundColor:'#fff',
color:"#000"
}
const headerTitleStyle = {
color:'#09101D',
fontSize:global.scaleFontSize(22)
}
const onShare = async () => {
try {
const result = await Share.share({
message:
'The most complete candlestick pattern learning mobile app | Become a stronger trader download now! https://play.google.com/store/apps/details?id=com.candlestickpatterns',
title:
'Candlestick Patterns Mobile App'
}).then(({action, activityType}) => {
if(action === Share.sharedAction)
console.log('Share was successful');
else
console.log('Share was dismissed');
});
} catch (error) {
alert(error.message);
}
};
const navigationView = () => (
<View style={{marginTop:10}}>
<View style={styles.menuHeader}>
<Image source={require('./assets/images/logo.png')} />
<Text style={{fontFamily:'SourceSansPro-SemiBold'}}> Candlestick Patterns - Stocks</Text>
</View>
<TouchableOpacity
onPress={() => {
const options = {
GooglePackageName:"com.candlestickpatterns",
preferredAndroidMarket: AndroidMarket.Google,
preferInApp:false,
openAppStoreIfInAppFails:true,
fallbackPlatformURL:"https://play.google.com/store/apps/details?id=com.candlestickpatterns",
}
Rate.rate(options, (success, errorMessage)=>{
if (success) {
// this technically only tells us if the user successfully went to the Review Page. Whether they actually did anything, we do not know.
}
if (errorMessage) {
// errorMessage comes from the native code. Useful for debugging, but probably not for users to view
console.error(`Example page Rate.rate() error: ${errorMessage}`)
}
})
}}
>
<Text style={styles.menu}><Image style={styles.icon} source={require('./assets/images/star.png')} /> Rate Us</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => onShare()}>
<Text style={styles.menu}><Image style={styles.icon} source={require('./assets/images/share.png')} /> Share</Text>
</TouchableOpacity>
</View>
);
const App: () => Node = ({navigation}) => {
const drawer = useRef(null);
return (
<NavigationContainer theme={theme}>
<DrawerLayoutAndroid
ref={drawer}
drawerWidth={300}
drawerPosition='left'
renderNavigationView={() => navigationView()}
>
<Stack.Navigator
initialRouteName='Home'
>
<Stack.Screen
name="Home"
component={HomeScreen}
options={homeScreenOptions(drawer)}
/>
<Stack.Screen
name='Lesson'
component={LessonScreen}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
<Stack.Screen
name='Pattern'
component={PatternScreen}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
title:'Pattern Details',
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
<Stack.Screen
name='Introduction'
component={Introduction}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
title:'Basics of candlestick chart',
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
<Stack.Screen
name='Quiz'
component={QuizScreen}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
title:'Take a Quiz #Challenge!',
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
<Stack.Screen
name='Challenge'
component={ChallengeScreen}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
title:'Challenge!',
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
<Stack.Screen
name='Congratulations'
component={CongratulationsScreen}
options={({navigation}) => ({
headerStyle: headerStyle,
headerTitleStyle: headerTitleStyle,
headerShadowVisible:false,
title:'Congratulations!',
headerLeft:() => HeaderLeft(navigation),
headerRight: () => shareBtn(drawer)
})}
/>
</Stack.Navigator>
</DrawerLayoutAndroid>
</NavigationContainer>
);
};
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
menu: {
paddingTop:10,
paddingBottom:10,
paddingLeft:15,
display:'flex',
alignContent:'center',
justifyContent:'center',
fontSize:global.scaleFontSize(18),
// fontFamily:'SourceSansPro-SemiBold'
},
menuHeader: {
borderBottomWidth:1,
borderBottomColor:'#F4F6F9',
paddingBottom:20,
paddingTop:20,
paddingLeft:15,
display:'flex',
flexDirection:'row',
alignItems:'center'
},
icon: {
height:global.scaleFontSize(13),
width:global.scaleFontSize(13)
},
sectionTitle: {
fontSize: global.scaleFontSize(24),
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: global.scaleFontSize(18),
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
imageContainer: {
backgroundColor:'rgba(48, 79, 254, 0.1)',
height:36,
width:36,
display:'flex',
justifyContent:'center',
alignItems:'center',
borderRadius:9,
marginRight: 15
},
shareContainer: {
backgroundColor:'rgba(48, 79, 254, 0.1)',
height:36,
width:36,
display:'flex',
justifyContent:'center',
alignItems:'center',
borderRadius:9
}
});
export default App;