Commit 5960b01e authored by Halvor Horge's avatar Halvor Horge

#9 Added filtering to sidemenu

parent 1249ec41
......@@ -2,8 +2,8 @@
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19001,
"packagerPid": 11656,
"packagerPid": 17356,
"expoServerNgrokUrl": "https://3u-kzx.hhorge.p4.exp.direct",
"packagerNgrokUrl": "https://packager.3u-kzx.hhorge.p4.exp.direct",
"ngrokPid": 19796
"ngrokPid": 15624
}
import React from 'react';
import { View } from 'react-native';
import RadioForm, {RadioButton, RadioButtonInput, RadioButtonLabel} from 'react-native-simple-radio-button';
import React from "react";
import { View } from "react-native";
import RadioForm, {
RadioButton,
RadioButtonInput,
RadioButtonLabel
} from "react-native-simple-radio-button";
import { useDispatch } from "react-redux";
import { filter } from "../actions";
import { useSelector } from "react-redux";
import { toggleSideMenu } from "../actions";
const genres = [
{label: "All", value: ""},
{label: "Akevitt", value: "Akevitt"},
{label: "Bitter", value: "Bitter"},
{label: "Druebrennevin", value: "Druebrennevin"},
{label: "Gin", value: "Gin"},
{label: "Hvitvin", value: "Hvitvin"},
{label: "Likør", value: "Likør"},
{label: "Portvin", value: "Portvin"},
{label: "Rødvin", value: "Rødvin"},
{label: "Vodka", value: "Vodka"},
{label: "Whisky", value: "Whisky"},
]
{ label: "All", value: "" },
{ label: "Akevitt", value: "Akevitt" },
{ label: "Bitter", value: "Bitter" },
{ label: "Druebrennevin", value: "Druebrennevin" },
{ label: "Gin", value: "Gin" },
{ label: "Hvitvin", value: "Hvitvin" },
{ label: "Likør", value: "Likør" },
{ label: "Portvin", value: "Portvin" },
{ label: "Rødvin", value: "Rødvin" },
{ label: "Vodka", value: "Vodka" },
{ label: "Whisky", value: "Whisky" }
];
const Filtering = () => {
const stateType = useSelector(state => state.filter);
const dispatch = useDispatch();
const stateType = useSelector(state => state.filter);
const dispatch = useDispatch();
function updateFilter(e) {
dispatch(filter(e));
}
function updateFilter(e) {
dispatch(filter(e));
}
function onButtonPress(v){
updateFilter(v)
dispatch(toggleSideMenu())
}
function onButtonPress(v) {
updateFilter(v);
dispatch(toggleSideMenu());
}
return(
<View>
<RadioForm
radio_props={genres}
onPress={(value) => onButtonPress(value)}
/>
</View>
)
}
return (
<View>
<RadioForm radio_props={genres} onPress={value => onButtonPress(value)} />
</View>
);
};
export default Filtering;
\ No newline at end of file
export default Filtering;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment