Compare commits

...

5 commits

7 changed files with 41 additions and 41 deletions

View file

@ -26,7 +26,7 @@ class ClubListHeader extends React.Component<Props> {
selected={isItemInCategoryFilter(this.props.selectedCategories, [category.id])}
mode={'outlined'}
onPress={onPress}
style={{marginRight: 5, marginBottom: 5}}
style={{marginRight: 5, marginLeft: 5, marginBottom: 5}}
key={key}
>
{category.name}

View file

@ -55,7 +55,11 @@ class ClubListItem extends React.Component<Props> {
onPress={this.props.onPress}
left={(props) => <Avatar.Image
{...props}
style={{backgroundColor: 'transparent'}}
style={{
backgroundColor: 'transparent',
marginLeft: 10,
marginRight: 10,
}}
size={64}
source={{uri: this.props.item.logo}}/>}
right={(props) => <Avatar.Icon

View file

@ -21,15 +21,25 @@ class CustomHTML extends React.Component<Props> {
return <Text {...passProps}>{children}</Text>;
};
getListBullet = (htmlAttribs, children, convertedCSSStyles, passProps) => {
return (
<Text>- </Text>
);
};
render() {
// Surround description with p to allow text styling if the description is not html
return <HTML
html={"<p>" + this.props.html + "</p>"}
renderers={{
p: this.getBasicText,
li: this.getBasicText,
}}
listsPrefixesRenderers={{
ul: this.getListBullet
}}
ignoredTags={['img']}
ignoredStyles={['color', 'background-color']}
onLinkPress={this.openWebLink}/>;
}
}

View file

@ -25,6 +25,7 @@ const links = {
"Coucou !\n\n",
yohanLinkedin: 'https://www.linkedin.com/in/yohan-simard',
react: 'https://facebook.github.io/react-native/',
meme: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
};
type Props = {
@ -84,7 +85,7 @@ class AboutScreen extends React.Component<Props> {
*/
authorData: Array<Object> = [
{
onPressCallback: () => console.log('cc'),
onPressCallback: () => openWebLink(links.meme),
icon: 'account-circle',
text: 'Arnaud VERGNET',
showChevron: false

View file

@ -11,6 +11,7 @@ import {Avatar, Card, Divider, List, TouchableRipple, withTheme} from "react-nat
import type {CustomTheme} from "../../managers/ThemeManager";
import i18n from 'i18n-js';
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
import ConnectionManager from "../../managers/ConnectionManager";
type Props = {
navigation: Object,
@ -61,13 +62,13 @@ class ServicesScreen extends React.Component<Props, State> {
title: i18n.t('screens.clubsAbout'),
subtitle: i18n.t('servicesScreen.descriptions.clubs'),
image: CLUBS_IMAGE,
onPress: () => nav.navigate("club-list"),
onPress: () => this.onAmicaleServicePress("club-list"),
},
{
title: i18n.t('screens.profile'),
subtitle: i18n.t('servicesScreen.descriptions.profile'),
image: PROFILE_IMAGE,
onPress: () => nav.navigate("profile"),
onPress: () => this.onAmicaleServicePress("profile"),
},
{
title: i18n.t('screens.amicaleWebsite'),
@ -79,7 +80,7 @@ class ServicesScreen extends React.Component<Props, State> {
title: i18n.t('screens.vote'),
subtitle: i18n.t('servicesScreen.descriptions.vote'),
image: VOTE_IMAGE,
onPress: () => nav.navigate("vote"),
onPress: () => this.onAmicaleServicePress("vote"),
},
];
this.studentsDataset = [
@ -196,6 +197,13 @@ class ServicesScreen extends React.Component<Props, State> {
/>
}
onAmicaleServicePress(route: string) {
if (ConnectionManager.getInstance().isLoggedIn())
this.props.navigation.navigate(route);
else
this.props.navigation.navigate("login", {nextScreen: route});
}
renderItem = ({item}: { item: listItem }) => {
return (
<TouchableRipple

View file

@ -6,10 +6,7 @@ import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import {withCollapsible} from "../../utils/withCollapsible";
import {Collapsible} from "react-navigation-collapsible";
import {CommonActions} from "@react-navigation/native";
import ConnectionManager from "../../managers/ConnectionManager";
import type {listItem} from "./ServicesScreen";
import ErrorView from "../../components/Screens/ErrorView";
import {ERROR_TYPE} from "../../utils/WebData";
type Props = {
navigation: Object,
@ -17,29 +14,13 @@ type Props = {
collapsibleStack: Collapsible,
}
type State = {
isLoggedIn: boolean,
}
class ServicesSectionScreen extends React.Component<Props, State> {
class ServicesSectionScreen extends React.Component<Props> {
finalDataset: listItem;
constructor(props) {
super(props);
this.handleNavigationParams();
this.state = {
isLoggedIn: ConnectionManager.getInstance().isLoggedIn(),
}
}
componentDidMount() {
this.props.navigation.addListener('focus', this.onFocus);
}
onFocus = () => {
this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})
}
handleNavigationParams() {
@ -57,19 +38,16 @@ class ServicesSectionScreen extends React.Component<Props, State> {
render() {
const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
if (!this.state.isLoggedIn && this.finalDataset.shouldLogin)
return <ErrorView {...this.props} errorCode={ERROR_TYPE.BAD_TOKEN}/>;
else
return <CardList
dataset={this.finalDataset.content}
isHorizontal={false}
onScroll={onScroll}
contentContainerStyle={{
paddingTop: containerPaddingTop,
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20
}}
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
/>
return <CardList
dataset={this.finalDataset.content}
isHorizontal={false}
onScroll={onScroll}
contentContainerStyle={{
paddingTop: containerPaddingTop,
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20
}}
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
/>
}
}

View file

@ -16,7 +16,6 @@ export const AmicaleWebsiteScreen = (props: Object) => {
path = path.replace(URL, '');
}
}
console.log(URL + path);
return (
<WebViewScreen
{...props}