Compare commits
No commits in common. "9d52fd94efe52f0e76e129d1a03311d0c285591e" and "0385e8ad7691895117a381f4e3186320788881c6" have entirely different histories.
9d52fd94ef
...
0385e8ad76
10 changed files with 65 additions and 166 deletions
|
|
@ -80,11 +80,9 @@ class AnimatedBottomBar extends React.Component<Props, State> {
|
||||||
<Surface style={styles.surface}>
|
<Surface style={styles.surface}>
|
||||||
<View style={styles.fabContainer}>
|
<View style={styles.fabContainer}>
|
||||||
<AnimatedFAB
|
<AnimatedFAB
|
||||||
animation={this.props.seekAttention ? "bounce" : undefined}
|
animation={this.props.seekAttention ? "jello" : undefined}
|
||||||
easing="ease-out"
|
easing="ease-out"
|
||||||
iterationDelay={500}
|
|
||||||
iterationCount="infinite"
|
iterationCount="infinite"
|
||||||
useNativeDriver
|
|
||||||
// useNativeDriver={true}
|
// useNativeDriver={true}
|
||||||
style={styles.fab}
|
style={styles.fab}
|
||||||
icon="account-clock"
|
icon="account-clock"
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
import * as Animatable from "react-native-animatable";
|
|
||||||
import {CommonActions} from "@react-navigation/native";
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
navigation: Object,
|
|
||||||
route: Object,
|
|
||||||
children: React$Node
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class AnimatedFocusView extends React.Component<Props> {
|
|
||||||
|
|
||||||
ref: Object;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.ref = React.createRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.props.navigation.addListener('focus', this.onScreenFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
onScreenFocus = () => {
|
|
||||||
if (this.props.route.params !== undefined) {
|
|
||||||
if (this.props.route.params.animationDir && this.ref.current) {
|
|
||||||
if (this.props.route.params.animationDir === "right")
|
|
||||||
this.ref.current.fadeInRight(300);
|
|
||||||
else
|
|
||||||
this.ref.current.fadeInLeft(300);
|
|
||||||
// reset params to prevent infinite loop
|
|
||||||
this.props.navigation.dispatch(CommonActions.setParams({animationDir: null}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Animatable.View
|
|
||||||
ref={this.ref}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
}}
|
|
||||||
useNativeDriver
|
|
||||||
>
|
|
||||||
{this.props.children}
|
|
||||||
</Animatable.View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -18,25 +18,6 @@ const TAB_BAR_HEIGHT = 48;
|
||||||
*/
|
*/
|
||||||
class CustomTabBar extends React.Component<Props> {
|
class CustomTabBar extends React.Component<Props> {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props): boolean {
|
|
||||||
return (nextProps.theme.dark !== this.props.theme.dark)
|
|
||||||
|| (nextProps.state.index !== this.props.state.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
onItemPress(route: Object, currentIndex: number, destIndex: number) {
|
|
||||||
const event = this.props.navigation.emit({
|
|
||||||
type: 'tabPress',
|
|
||||||
target: route.key,
|
|
||||||
canPreventDefault: true,
|
|
||||||
});
|
|
||||||
if (currentIndex !== destIndex && !event.defaultPrevented) {
|
|
||||||
this.props.navigation.navigate(route.name, {
|
|
||||||
screen: 'index',
|
|
||||||
params: {animationDir: currentIndex < destIndex ? "right" : "left"}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const state = this.props.state;
|
const state = this.props.state;
|
||||||
const descriptors = this.props.descriptors;
|
const descriptors = this.props.descriptors;
|
||||||
|
|
@ -57,7 +38,17 @@ class CustomTabBar extends React.Component<Props> {
|
||||||
|
|
||||||
const isFocused = state.index === index;
|
const isFocused = state.index === index;
|
||||||
|
|
||||||
const onPress = () => this.onItemPress(route, state.index, index);
|
const onPress = () => {
|
||||||
|
const event = navigation.emit({
|
||||||
|
type: 'tabPress',
|
||||||
|
target: route.key,
|
||||||
|
canPreventDefault: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isFocused && !event.defaultPrevented) {
|
||||||
|
navigation.navigate(route.name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onLongPress = () => {
|
const onLongPress = () => {
|
||||||
navigation.emit({
|
navigation.emit({
|
||||||
|
|
@ -75,9 +66,7 @@ class CustomTabBar extends React.Component<Props> {
|
||||||
icon={options.tabBarIcon(iconData)}
|
icon={options.tabBarIcon(iconData)}
|
||||||
color={color}
|
color={color}
|
||||||
label={label}
|
label={label}
|
||||||
focused={isFocused}
|
focused={isFocused}/>
|
||||||
extraData={state.index > index}
|
|
||||||
/>
|
|
||||||
} else
|
} else
|
||||||
return <TabHomeIcon
|
return <TabHomeIcon
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const AnimatedFAB = Animatable.createAnimatableComponent(FAB);
|
||||||
class TabHomeIcon extends React.Component<Props> {
|
class TabHomeIcon extends React.Component<Props> {
|
||||||
|
|
||||||
focusedIcon = require('../../../assets/tab-icon.png');
|
focusedIcon = require('../../../assets/tab-icon.png');
|
||||||
unFocusedIcon = require('../../../assets/tab-icon-outline.png'); // has a weird rotating on icon change
|
unFocusedIcon = require('../../../assets/tab-icon-outline.png');
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
@ -30,15 +30,15 @@ class TabHomeIcon extends React.Component<Props> {
|
||||||
scale: 1, translateY: 0
|
scale: 1, translateY: 0
|
||||||
},
|
},
|
||||||
"0.9": {
|
"0.9": {
|
||||||
scale: 1.3, translateY: -6
|
scale: 1.4, translateY: -6
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
scale: 1.2, translateY: -5
|
scale: 1.3, translateY: -5
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fabFocusOut: {
|
fabFocusOut: {
|
||||||
"0": {
|
"0": {
|
||||||
scale: 1.2, translateY: -5
|
scale: 1.3, translateY: -5
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
scale: 1, translateY: 0
|
scale: 1, translateY: 0
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ type Props = {
|
||||||
onPress: Function,
|
onPress: Function,
|
||||||
onLongPress: Function,
|
onLongPress: Function,
|
||||||
theme: Object,
|
theme: Object,
|
||||||
extraData: any,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AnimatedIcon = Animatable.createAnimatableComponent(MaterialCommunityIcons);
|
const AnimatedIcon = Animatable.createAnimatableComponent(MaterialCommunityIcons);
|
||||||
|
|
@ -35,15 +34,15 @@ class TabIcon extends React.Component<Props> {
|
||||||
scale: 1, translateY: 0
|
scale: 1, translateY: 0
|
||||||
},
|
},
|
||||||
"0.9": {
|
"0.9": {
|
||||||
scale: 1.5, translateY: 7
|
scale: 1.6, translateY: 6
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
scale: 1.4, translateY: 6
|
scale: 1.5, translateY: 5
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
focusOut: {
|
focusOut: {
|
||||||
"0": {
|
"0": {
|
||||||
scale: 1.4, translateY: 6
|
scale: 1.5, translateY: 5
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
scale: 1, translateY: 0
|
scale: 1, translateY: 0
|
||||||
|
|
@ -59,8 +58,7 @@ class TabIcon extends React.Component<Props> {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props): boolean {
|
shouldComponentUpdate(nextProps: Props): boolean {
|
||||||
return (nextProps.focused !== this.props.focused)
|
return (nextProps.focused !== this.props.focused)
|
||||||
|| (nextProps.theme.dark !== this.props.theme.dark)
|
|| (nextProps.theme.dark !== this.props.theme.dark);
|
||||||
|| (nextProps.extraData !== this.props.extraData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): React$Node {
|
render(): React$Node {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Animated, FlatList} from 'react-native';
|
import {Animated, FlatList, 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";
|
||||||
|
|
@ -16,7 +16,6 @@ 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 {AnimatedValue} from "react-native-reanimated";
|
||||||
import AnimatedFAB from "../components/Custom/AnimatedFAB";
|
import AnimatedFAB from "../components/Custom/AnimatedFAB";
|
||||||
import AnimatedFocusView from "../components/Custom/AnimatedFocusView";
|
|
||||||
// import DATA from "../dashboard_data.json";
|
// import DATA from "../dashboard_data.json";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,22 +113,12 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
</MaterialHeaderButtons>;
|
</MaterialHeaderButtons>;
|
||||||
};
|
};
|
||||||
|
|
||||||
onProxiwashClick = () => {
|
onProxiwashClick = () => this.props.navigation.navigate('proxiwash');
|
||||||
this.props.navigation.navigate("proxiwash", {
|
|
||||||
screen: 'index',
|
|
||||||
params: {animationDir: "right"} // Play tab animation
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onProximoClick = () => {
|
|
||||||
this.props.navigation.navigate("proximo", {
|
|
||||||
screen: 'index',
|
|
||||||
params: {animationDir: "left"} // Play tab animation
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onTutorInsaClick = () => this.props.navigation.navigate('tutorinsa');
|
onTutorInsaClick = () => this.props.navigation.navigate('tutorinsa');
|
||||||
|
|
||||||
|
onProximoClick = () => this.props.navigation.navigate('proximo');
|
||||||
|
|
||||||
onMenuClick = () => this.props.navigation.navigate('self-menu');
|
onMenuClick = () => this.props.navigation.navigate('self-menu');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -471,9 +460,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
const nav = this.props.navigation;
|
const nav = this.props.navigation;
|
||||||
return (
|
return (
|
||||||
<AnimatedFocusView
|
<View>
|
||||||
{...this.props}
|
|
||||||
>
|
|
||||||
<WebSectionList
|
<WebSectionList
|
||||||
createDataset={this.createDataset}
|
createDataset={this.createDataset}
|
||||||
navigation={nav}
|
navigation={nav}
|
||||||
|
|
@ -489,7 +476,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
icon="qrcode-scan"
|
icon="qrcode-scan"
|
||||||
onPress={this.openScanner}
|
onPress={this.openScanner}
|
||||||
/>
|
/>
|
||||||
</AnimatedFocusView>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import {
|
||||||
} from '../../utils/Planning';
|
} from '../../utils/Planning';
|
||||||
import {Avatar, Divider, List} from 'react-native-paper';
|
import {Avatar, Divider, List} from 'react-native-paper';
|
||||||
import CustomAgenda from "../../components/Custom/CustomAgenda";
|
import CustomAgenda from "../../components/Custom/CustomAgenda";
|
||||||
import AnimatedFocusView from "../../components/Custom/AnimatedFocusView";
|
|
||||||
|
|
||||||
LocaleConfig.locales['fr'] = {
|
LocaleConfig.locales['fr'] = {
|
||||||
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||||
|
|
@ -27,7 +26,6 @@ LocaleConfig.locales['fr'] = {
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
route: Object,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|
@ -231,9 +229,6 @@ class PlanningScreen extends React.Component<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
// console.log("rendering PlanningScreen");
|
// console.log("rendering PlanningScreen");
|
||||||
return (
|
return (
|
||||||
<AnimatedFocusView
|
|
||||||
{...this.props}
|
|
||||||
>
|
|
||||||
<CustomAgenda
|
<CustomAgenda
|
||||||
{...this.props}
|
{...this.props}
|
||||||
// the list of items that have to be displayed in agenda. If you want to render item as empty date
|
// the list of items that have to be displayed in agenda. If you want to render item as empty date
|
||||||
|
|
@ -262,7 +257,6 @@ class PlanningScreen extends React.Component<Props, State> {
|
||||||
// ref to this agenda in order to handle back button event
|
// ref to this agenda in order to handle back button event
|
||||||
onRef={this.onAgendaRef}
|
onRef={this.onAgendaRef}
|
||||||
/>
|
/>
|
||||||
</AnimatedFocusView>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,12 @@ import i18n from "i18n-js";
|
||||||
import WebSectionList from "../../components/Lists/WebSectionList";
|
import WebSectionList from "../../components/Lists/WebSectionList";
|
||||||
import {List, withTheme} from 'react-native-paper';
|
import {List, withTheme} from 'react-native-paper';
|
||||||
import MaterialHeaderButtons, {Item} from "../../components/Custom/HeaderButton";
|
import MaterialHeaderButtons, {Item} from "../../components/Custom/HeaderButton";
|
||||||
import AnimatedFocusView from "../../components/Custom/AnimatedFocusView";
|
|
||||||
|
|
||||||
const DATA_URL = "https://etud.insa-toulouse.fr/~proximo/data/stock-v2.json";
|
const DATA_URL = "https://etud.insa-toulouse.fr/~proximo/data/stock-v2.json";
|
||||||
const LIST_ITEM_HEIGHT = 84;
|
const LIST_ITEM_HEIGHT = 84;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
route: Object,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|
@ -234,9 +232,6 @@ class ProximoMainScreen extends React.Component<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
const nav = this.props.navigation;
|
const nav = this.props.navigation;
|
||||||
return (
|
return (
|
||||||
<AnimatedFocusView
|
|
||||||
{...this.props}
|
|
||||||
>
|
|
||||||
<WebSectionList
|
<WebSectionList
|
||||||
createDataset={this.createDataset}
|
createDataset={this.createDataset}
|
||||||
navigation={nav}
|
navigation={nav}
|
||||||
|
|
@ -244,7 +239,6 @@ class ProximoMainScreen extends React.Component<Props, State> {
|
||||||
refreshOnFocus={false}
|
refreshOnFocus={false}
|
||||||
fetchUrl={DATA_URL}
|
fetchUrl={DATA_URL}
|
||||||
renderItem={this.getRenderItem}/>
|
renderItem={this.getRenderItem}/>
|
||||||
</AnimatedFocusView>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import AprilFoolsManager from "../../managers/AprilFoolsManager";
|
||||||
import MaterialHeaderButtons, {Item} from "../../components/Custom/HeaderButton";
|
import MaterialHeaderButtons, {Item} from "../../components/Custom/HeaderButton";
|
||||||
import ProxiwashSectionHeader from "../../components/Lists/ProxiwashSectionHeader";
|
import ProxiwashSectionHeader from "../../components/Lists/ProxiwashSectionHeader";
|
||||||
import {withCollapsible} from "../../utils/withCollapsible";
|
import {withCollapsible} from "../../utils/withCollapsible";
|
||||||
import AnimatedFocusView from "../../components/Custom/AnimatedFocusView";
|
|
||||||
|
|
||||||
const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/washinsa/washinsa.json";
|
const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/washinsa/washinsa.json";
|
||||||
|
|
||||||
|
|
@ -26,7 +25,6 @@ const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
route: Object,
|
|
||||||
theme: Object,
|
theme: Object,
|
||||||
collapsibleStack: Object,
|
collapsibleStack: Object,
|
||||||
}
|
}
|
||||||
|
|
@ -422,9 +420,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
const nav = this.props.navigation;
|
const nav = this.props.navigation;
|
||||||
const {containerPaddingTop} = this.props.collapsibleStack;
|
const {containerPaddingTop} = this.props.collapsibleStack;
|
||||||
return (
|
return (
|
||||||
<AnimatedFocusView
|
<View>
|
||||||
{...this.props}
|
|
||||||
>
|
|
||||||
<Banner
|
<Banner
|
||||||
style={{
|
style={{
|
||||||
marginTop: this.state.bannerVisible ? containerPaddingTop : 0,
|
marginTop: this.state.bannerVisible ? containerPaddingTop : 0,
|
||||||
|
|
@ -455,7 +451,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
autoRefreshTime={REFRESH_TIME}
|
autoRefreshTime={REFRESH_TIME}
|
||||||
refreshOnFocus={true}
|
refreshOnFocus={true}
|
||||||
updateData={this.state.machinesWatched.length}/>
|
updateData={this.state.machinesWatched.length}/>
|
||||||
</AnimatedFocusView>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import DateManager from "../../managers/DateManager";
|
||||||
import AnimatedBottomBar from "../../components/Custom/AnimatedBottomBar";
|
import AnimatedBottomBar from "../../components/Custom/AnimatedBottomBar";
|
||||||
import {CommonActions} from "@react-navigation/native";
|
import {CommonActions} from "@react-navigation/native";
|
||||||
import ErrorView from "../../components/Custom/ErrorView";
|
import ErrorView from "../../components/Custom/ErrorView";
|
||||||
import AnimatedFocusView from "../../components/Custom/AnimatedFocusView";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
|
|
@ -300,9 +299,7 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
const {containerPaddingTop} = this.props.collapsibleStack;
|
const {containerPaddingTop} = this.props.collapsibleStack;
|
||||||
return (
|
return (
|
||||||
<AnimatedFocusView
|
<View style={{height: '100%'}}>
|
||||||
{...this.props}
|
|
||||||
>
|
|
||||||
<Banner
|
<Banner
|
||||||
style={{
|
style={{
|
||||||
marginTop: this.state.bannerVisible ? containerPaddingTop : 0,
|
marginTop: this.state.bannerVisible ? containerPaddingTop : 0,
|
||||||
|
|
@ -340,7 +337,7 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
onPress={this.sendMessage}
|
onPress={this.sendMessage}
|
||||||
seekAttention={this.state.currentGroup.id === -1}
|
seekAttention={this.state.currentGroup.id === -1}
|
||||||
/>
|
/>
|
||||||
</AnimatedFocusView>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue