Compare commits

..

No commits in common. "f88c98537a5005885bbf19ca36311a30e1fd3a3b" and "fa42f09efb568055516c0b4fda1ba5525b8abc0f" have entirely different histories.

6 changed files with 16 additions and 79 deletions

View file

@ -29,14 +29,11 @@ class ProxiwashListItem extends React.Component<Props> {
(props.nbAvailable <= 1) (props.nbAvailable <= 1)
? i18n.t('proxiwashScreen.numAvailable') ? i18n.t('proxiwashScreen.numAvailable')
: i18n.t('proxiwashScreen.numAvailablePlural')); : i18n.t('proxiwashScreen.numAvailablePlural'));
const iconColor = props.nbAvailable > 0
? this.props.theme.colors.success
: this.props.theme.colors.primary;
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Avatar.Icon <Avatar.Icon
icon={props.isDryer ? 'tumble-dryer' : 'washing-machine'} icon={props.isDryer ? 'tumble-dryer' : 'washing-machine'}
color={iconColor} color={this.props.theme.colors.primary}
style={styles.icon} style={styles.icon}
/> />
<View style={{justifyContent: 'center'}}> <View style={{justifyContent: 'center'}}>

View file

@ -4,7 +4,7 @@ import * as React from 'react';
import {ERROR_TYPE, readData} from "../../utils/WebData"; import {ERROR_TYPE, readData} from "../../utils/WebData";
import i18n from "i18n-js"; import i18n from "i18n-js";
import {Snackbar} from 'react-native-paper'; import {Snackbar} from 'react-native-paper';
import {Animated, RefreshControl, View} from "react-native"; import {RefreshControl, SectionList, View} from "react-native";
import ErrorView from "../Custom/ErrorView"; import ErrorView from "../Custom/ErrorView";
import BasicLoadingScreen from "../Custom/BasicLoadingScreen"; import BasicLoadingScreen from "../Custom/BasicLoadingScreen";
@ -19,7 +19,6 @@ type Props = {
createDataset: Function, createDataset: Function,
updateData: number, updateData: number,
itemHeight: number | null, itemHeight: number | null,
onScroll: Function,
} }
type State = { type State = {
@ -179,7 +178,7 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
return ( return (
<View> <View>
{/*$FlowFixMe*/} {/*$FlowFixMe*/}
<Animated.SectionList <SectionList
sections={dataset} sections={dataset}
extraData={this.props.updateData} extraData={this.props.updateData}
refreshControl={ refreshControl={
@ -204,8 +203,6 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
} }
removeClippedSubviews={true} removeClippedSubviews={true}
getItemLayout={this.props.itemHeight !== null ? this.itemLayout : undefined} getItemLayout={this.props.itemHeight !== null ? this.itemLayout : undefined}
// Animations
onScroll={this.props.onScroll}
/> />
<Snackbar <Snackbar
visible={this.state.snackbarVisible} visible={this.state.snackbarVisible}

View file

@ -194,7 +194,7 @@ function HomeStackComponent(initialRoute: string | null, defaultData: Object) {
component={FeedItemScreen} component={FeedItemScreen}
options={({navigation}) => { options={({navigation}) => {
return { return {
title: i18n.t('screens.feedDisplayScreen'), title: 'FEEEEED',
...TransitionPresets.ModalSlideFromBottomIOS, ...TransitionPresets.ModalSlideFromBottomIOS,
}; };
}} }}

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Animated, FlatList, StyleSheet, View} from 'react-native'; import {FlatList, StyleSheet, View} from 'react-native';
import i18n from "i18n-js"; import i18n from "i18n-js";
import DashboardItem from "../components/Home/EventDashboardItem"; import DashboardItem from "../components/Home/EventDashboardItem";
import WebSectionList from "../components/Lists/WebSectionList"; import WebSectionList from "../components/Lists/WebSectionList";
@ -14,7 +14,6 @@ import ActionsDashBoardItem from "../components/Home/ActionsDashboardItem";
import ConnectionManager from "../managers/ConnectionManager"; import ConnectionManager from "../managers/ConnectionManager";
import {CommonActions} from '@react-navigation/native'; import {CommonActions} from '@react-navigation/native';
import MaterialHeaderButtons, {Item} from "../components/Custom/HeaderButton"; import MaterialHeaderButtons, {Item} from "../components/Custom/HeaderButton";
import {AnimatedValue} from "react-native-reanimated";
// import DATA from "../dashboard_data.json"; // import DATA from "../dashboard_data.json";
@ -27,8 +26,6 @@ const SECTIONS_ID = [
'news_feed' 'news_feed'
]; ];
const AnimatedFAB = Animated.createAnimatedComponent(FAB);
const REFRESH_TIME = 1000 * 20; // Refresh every 20 seconds const REFRESH_TIME = 1000 * 20; // Refresh every 20 seconds
type Props = { type Props = {
@ -37,35 +34,19 @@ type Props = {
theme: Object, theme: Object,
} }
type State = {
showFab: boolean,
fabPosition: AnimatedValue
}
/** /**
* Class defining the app's home screen * Class defining the app's home screen
*/ */
class HomeScreen extends React.Component<Props, State> { class HomeScreen extends React.Component<Props> {
colors: Object; colors: Object;
isLoggedIn: boolean | null; isLoggedIn: boolean | null;
isAnimationDownPlaying: boolean;
isAnimationUpPlaying: boolean;
downAnimation;
upAnimation;
state = {
showFab: true,
fabPosition: new Animated.Value(0),
};
constructor(props) { constructor(props) {
super(props); super(props);
this.colors = props.theme.colors; this.colors = props.theme.colors;
this.isAnimationDownPlaying = false;
this.isAnimationUpPlaying = false;
this.isLoggedIn = null; this.isLoggedIn = null;
} }
@ -398,7 +379,7 @@ class HomeScreen extends React.Component<Props, State> {
} }
dashboardRowRenderItem = ({item}: Object) => { dashboardRowRenderItem = ({item}: Object) => {
return ( return(
<SquareDashboardItem <SquareDashboardItem
color={item.color} color={item.color}
icon={item.icon} icon={item.icon}
@ -417,14 +398,14 @@ class HomeScreen extends React.Component<Props, State> {
*/ */
getDashboardRow(content: Array<Object>) { getDashboardRow(content: Array<Object>) {
return <FlatList return <FlatList
data={content} data={content}
renderItem={this.dashboardRowRenderItem} renderItem={this.dashboardRowRenderItem}
horizontal={true} horizontal={true}
contentContainerStyle={{ contentContainerStyle={{
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
}} }}
/>; />;
} }
/** /**
@ -460,38 +441,6 @@ class HomeScreen extends React.Component<Props, State> {
openScanner = () => this.props.navigation.navigate("scanner"); openScanner = () => this.props.navigation.navigate("scanner");
onScroll = ({nativeEvent}: Object) => {
if (nativeEvent.velocity.y > 0.2) { // Go down
if (!this.isAnimationDownPlaying) {
this.isAnimationDownPlaying = true;
if (this.isAnimationUpPlaying)
this.upAnimation.stop();
this.downAnimation = Animated.spring(this.state.fabPosition, {
toValue: 100,
duration: 50,
useNativeDriver: true,
});
this.downAnimation.start(() => {
this.isAnimationDownPlaying = false
});
}
} else if (nativeEvent.velocity.y < -0.2) { // Go up
if (!this.isAnimationUpPlaying) {
this.isAnimationUpPlaying = true;
if (this.isAnimationDownPlaying)
this.downAnimation.stop();
this.upAnimation = Animated.spring(this.state.fabPosition, {
toValue: 0,
duration: 50,
useNativeDriver: true,
});
this.upAnimation.start(() => {
this.isAnimationUpPlaying = false
});
}
}
};
render() { render() {
const nav = this.props.navigation; const nav = this.props.navigation;
return ( return (
@ -504,13 +453,9 @@ class HomeScreen extends React.Component<Props, State> {
fetchUrl={DATA_URL} fetchUrl={DATA_URL}
renderItem={this.getRenderItem} renderItem={this.getRenderItem}
itemHeight={FEED_ITEM_HEIGHT} itemHeight={FEED_ITEM_HEIGHT}
onScroll={this.onScroll}
/> />
<AnimatedFAB <FAB
style={{ style={styles.fab}
...styles.fab,
transform: [{translateY: this.state.fabPosition}]
}}
icon="qrcode-scan" icon="qrcode-scan"
onPress={this.openScanner} onPress={this.openScanner}
/> />

View file

@ -4,7 +4,6 @@
"planning": "Planning", "planning": "Planning",
"planningDisplayScreen": "Event details", "planningDisplayScreen": "Event details",
"clubDisplayScreen": "Club details", "clubDisplayScreen": "Club details",
"feedDisplayScreen": "Details",
"clubsAbout": "Clubs", "clubsAbout": "Clubs",
"amicaleAbout": "The Amicale", "amicaleAbout": "The Amicale",
"proxiwash": "Proxiwash", "proxiwash": "Proxiwash",

View file

@ -4,7 +4,6 @@
"planning": "Planning", "planning": "Planning",
"planningDisplayScreen": "Détails", "planningDisplayScreen": "Détails",
"clubDisplayScreen": "Détails", "clubDisplayScreen": "Détails",
"feedDisplayScreen": "Détails",
"clubsAbout": "Les Clubs", "clubsAbout": "Les Clubs",
"amicaleAbout": "L' Amicale", "amicaleAbout": "L' Amicale",
"proxiwash": "Proxiwash", "proxiwash": "Proxiwash",