Skip to content

Commit 5344f37

Browse files
authored
[ORG-148] Fix scroll and remove check in create application (#123)
* change keyboardavoidingview strategy * remove this not to explode * black * remove unnecesary test
1 parent 87b527f commit 5344f37

File tree

10 files changed

+421
-478
lines changed

10 files changed

+421
-478
lines changed

organizator/app/(tabs)/(home)/[id].tsx

Lines changed: 133 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -219,151 +219,146 @@ export default function EventPage() {
219219

220220
return (
221221
<Container>
222-
<KeyboardAvoidingView
223-
behavior={Platform.OS === "ios" ? "padding" : "height"}
224-
enabled={isEditable}
225-
>
226-
<ScrollView>
227-
{loading ? (
228-
<LoadingPage />
229-
) : (
230-
<View>
231-
{events?.deleted ? (
232-
<EmptyPage
233-
title={`The event ${events?.name} has been removed`}
234-
subtitle="To know more about it, contact the organizers"
235-
image={require("../../../assets/deleted.webp")}
236-
/>
237-
) : (
222+
<ScrollView>
223+
{loading ? (
224+
<LoadingPage />
225+
) : (
226+
<View>
227+
{events?.deleted ? (
228+
<EmptyPage
229+
title={`The event ${events?.name} has been removed`}
230+
subtitle="To know more about it, contact the organizers"
231+
image={require("../../../assets/deleted.webp")}
232+
/>
233+
) : (
234+
<View>
235+
<ImageHeader source={{ uri: events?.headerImage }} />
238236
<View>
239-
<ImageHeader source={{ uri: events?.headerImage }} />
240-
<View>
241-
{isEditable ? (
242-
<View style={{ padding: 30 }}>
243-
<ButtonsRowContainerLeft>
244-
<Button
245-
title="Close"
246-
onPress={() => {
247-
setIsEditable(false);
248-
}}
249-
color={systemColors.destroy}
250-
iconName="close"
251-
/>
252-
</ButtonsRowContainerLeft>
253-
<EventForm
254-
inputs={inputs}
255-
setInputs={setInputs}
256-
createTheEvent={updateTheEvent}
257-
isUpdate
237+
{isEditable ? (
238+
<View style={{ padding: 30 }}>
239+
<ButtonsRowContainerLeft>
240+
<Button
241+
title="Close"
242+
onPress={() => {
243+
setIsEditable(false);
244+
}}
245+
color={systemColors.destroy}
246+
iconName="close"
258247
/>
259-
</View>
260-
) : (
261-
<View style={{ padding: 30 }}>
262-
{!isPast() && (
263-
<ButtonsRowContainerLeft>
264-
{isParticipant ? (
265-
applied ? (
266-
<AppliedContainer>
267-
<TextLine>
268-
<ApplicationStatus>
269-
Your application is:
270-
</ApplicationStatus>
271-
<InformativeChip
272-
name={applicationStatus}
273-
backgroundColor={getColorForApplicationStatus(
274-
applicationStatus,
275-
)}
276-
/>
277-
</TextLine>
278-
</AppliedContainer>
279-
) : (
248+
</ButtonsRowContainerLeft>
249+
<EventForm
250+
inputs={inputs}
251+
setInputs={setInputs}
252+
createTheEvent={updateTheEvent}
253+
isUpdate
254+
/>
255+
</View>
256+
) : (
257+
<View style={{ padding: 30 }}>
258+
{!isPast() && (
259+
<ButtonsRowContainerLeft>
260+
{isParticipant ? (
261+
applied ? (
262+
<AppliedContainer>
263+
<TextLine>
264+
<ApplicationStatus>
265+
Your application is:
266+
</ApplicationStatus>
267+
<InformativeChip
268+
name={applicationStatus}
269+
backgroundColor={getColorForApplicationStatus(
270+
applicationStatus,
271+
)}
272+
/>
273+
</TextLine>
274+
</AppliedContainer>
275+
) : (
276+
<Button
277+
title="Apply now"
278+
onPress={() => {
279+
applyToEvent();
280+
}}
281+
color={systemColors.action}
282+
/>
283+
)
284+
) : isEditable ? null : (
285+
<>
286+
{(isOrganizer || isOrganizerAdmin) && (
280287
<Button
281-
title="Apply now"
288+
title="Edit"
282289
onPress={() => {
283-
applyToEvent();
290+
setIsEditable(true);
284291
}}
285-
color={systemColors.action}
292+
color={systemColors.edit}
293+
iconName="pencil"
286294
/>
287-
)
288-
) : isEditable ? null : (
289-
<>
290-
{(isOrganizer || isOrganizerAdmin) && (
291-
<Button
292-
title="Edit"
293-
onPress={() => {
294-
setIsEditable(true);
295-
}}
296-
color={systemColors.edit}
297-
iconName="pencil"
298-
/>
299-
)}
300-
{isOrganizerAdmin && (
301-
<Button
302-
title="Delete"
303-
onPress={() => {
304-
setShowAlert(true);
305-
}}
306-
color={systemColors.destroy}
307-
iconName="trash"
308-
/>
309-
)}
310-
</>
311-
)}
312-
</ButtonsRowContainerLeft>
313-
)}
314-
<EventDetails event={events} />
315-
</View>
316-
)}
317-
</View>
295+
)}
296+
{isOrganizerAdmin && (
297+
<Button
298+
title="Delete"
299+
onPress={() => {
300+
setShowAlert(true);
301+
}}
302+
color={systemColors.destroy}
303+
iconName="trash"
304+
/>
305+
)}
306+
</>
307+
)}
308+
</ButtonsRowContainerLeft>
309+
)}
310+
<EventDetails event={events} />
311+
</View>
312+
)}
318313
</View>
319-
)}
320-
</View>
321-
)}
322-
<ConfirmDialog
323-
title={`Delete ${events?.name}`}
324-
message="Are you sure about that? This action will not be undone"
325-
onTouchOutside={() => setShowAlert(false)}
326-
visible={showAlert}
327-
negativeButton={{
328-
title: "Cancel",
329-
onPress: () => {
330-
setShowAlert(false);
331-
},
332-
titleStyle: {
333-
color: "red",
334-
fontSize: 20,
335-
},
336-
style: {
337-
backgroundColor: "transparent",
338-
paddingHorizontal: 10,
339-
},
340-
}}
341-
positiveButton={{
342-
title: "Delete!",
343-
onPress: () => {
344-
deleteThisEvent();
345-
},
346-
titleStyle: {
347-
color: "blue",
348-
fontSize: 20,
349-
},
350-
style: {
351-
backgroundColor: "transparent",
352-
paddingHorizontal: 10,
353-
},
354-
}}
355-
contentInsetAdjustmentBehavior="automatic"
356-
onRequestClose={() => setShowAlert(false)}
357-
dialogStyle={{
358-
width: 300,
359-
marginRight: "auto",
360-
marginLeft: "auto",
361-
marginTop: 0,
362-
marginBottom: 0,
363-
}}
364-
/>
365-
</ScrollView>
366-
</KeyboardAvoidingView>
314+
</View>
315+
)}
316+
</View>
317+
)}
318+
<ConfirmDialog
319+
title={`Delete ${events?.name}`}
320+
message="Are you sure about that? This action will not be undone"
321+
onTouchOutside={() => setShowAlert(false)}
322+
visible={showAlert}
323+
negativeButton={{
324+
title: "Cancel",
325+
onPress: () => {
326+
setShowAlert(false);
327+
},
328+
titleStyle: {
329+
color: "red",
330+
fontSize: 20,
331+
},
332+
style: {
333+
backgroundColor: "transparent",
334+
paddingHorizontal: 10,
335+
},
336+
}}
337+
positiveButton={{
338+
title: "Delete!",
339+
onPress: () => {
340+
deleteThisEvent();
341+
},
342+
titleStyle: {
343+
color: "blue",
344+
fontSize: 20,
345+
},
346+
style: {
347+
backgroundColor: "transparent",
348+
paddingHorizontal: 10,
349+
},
350+
}}
351+
contentInsetAdjustmentBehavior="automatic"
352+
onRequestClose={() => setShowAlert(false)}
353+
dialogStyle={{
354+
width: 300,
355+
marginRight: "auto",
356+
marginLeft: "auto",
357+
marginTop: 0,
358+
marginBottom: 0,
359+
}}
360+
/>
361+
</ScrollView>
367362
<Toast />
368363
</Container>
369364
);

organizator/app/(tabs)/(home)/create.tsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,17 @@ export default function CreatePage() {
6060

6161
return (
6262
<Container>
63-
<KeyboardAvoidingView
64-
behavior={Platform.OS === "ios" ? "padding" : "height"}
65-
keyboardVerticalOffset={100}
66-
>
67-
<ScrollView contentContainerStyle={{ padding: 30 }}>
68-
{loading ? (
69-
<LoadingPage />
70-
) : (
71-
<EventForm
72-
inputs={inputs}
73-
setInputs={setInputs}
74-
createTheEvent={createTheEvent}
75-
/>
76-
)}
77-
</ScrollView>
78-
</KeyboardAvoidingView>
63+
<ScrollView contentContainerStyle={{ padding: 30 }}>
64+
{loading ? (
65+
<LoadingPage />
66+
) : (
67+
<EventForm
68+
inputs={inputs}
69+
setInputs={setInputs}
70+
createTheEvent={createTheEvent}
71+
/>
72+
)}
73+
</ScrollView>
7974
<Toast />
8075
</Container>
8176
);

organizator/app/(tabs)/(home)/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function Home() {
6969

7070
return (
7171
<Container>
72-
<ScrollView contentContainerStyle={{ paddingHorizontal: 10 }}>
72+
<ScrollView contentContainerStyle={{ padding: 20 }}>
7373
{loading ? (
7474
<LoadingPage />
7575
) : (

organizator/app/(tabs)/manage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function ListPage() {
4848
image={require("../../../assets/not-logged-in.png")}
4949
/>
5050
) : (
51-
<ScrollView>
51+
<ScrollView contentContainerStyle={{ padding: 20 }}>
5252
{isOrganizer && <OrganizersEventsPage />}
5353
{isParticipant && <MyEventsPage />}
5454
</ScrollView>

0 commit comments

Comments
 (0)