Reorganize all the navigators

This commit is contained in:
Adolfo Reyna
2022-12-22 14:48:17 -05:00
parent c2ed9af093
commit 44c5bf0eea
3 changed files with 100 additions and 64 deletions

View File

@@ -71,24 +71,21 @@ let Feed = ({ navigation, route }) => {
return (
<SafeAreaView style={styles.container}>
<View>
<FlatList
data={Posts}
renderItem={renderPost}
keyExtractor={item => item._id || item.createdAt}
ListHeaderComponent={<NewPost newPostCB={(newPost) => setPosts([newPost, ...Posts])} />}
refreshing={Posts.length === 0}
onRefresh={() => {
API.getPosts().then(setPosts);
}}
initialNumToRender={3}
maxToRenderPerBatch={3}
removeClippedSubviews={true}
/>
</View>
<StatusBar style="auto" />
<SafeAreaView>
<FlatList
data={Posts}
renderItem={renderPost}
keyExtractor={item => item._id || item.createdAt}
//ListHeaderComponent={<NewPost newPostCB={(newPost) => setPosts([newPost, ...Posts])} />}
refreshing={Posts.length === 0}
onRefresh={() => {
API.getPosts().then(setPosts);
}}
initialNumToRender={3}
maxToRenderPerBatch={3}
removeClippedSubviews={true}
style={styles.container}
/>
</SafeAreaView>
);
}
@@ -97,7 +94,6 @@ export default Feed;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#edf2f7",
},
});

43
Views/Menu.js Normal file
View File

@@ -0,0 +1,43 @@
import React from "react";
import { View } from "react-native";
import { Text, List, RadioButton } from "react-native-paper";
import { SafeAreaView } from "react-native-safe-area-context";
import i18n from "../i18nMessages.js";
import Moment from 'moment';
let MenuView = ()=>{
const [value, setValue] = React.useState('es');
React.useEffect(()=>{
i18n.locale = value;
Moment.updateLocale(i18n.locale);
}, [value])
return (
<View>
<List.Section title="Settings">
<List.Accordion
title="User Actions"
left={props => <List.Icon {...props} icon="person" />}
expanded={true}
>
<List.Item title="Sign out" left={props => <List.Icon {...props} icon="logout" />} />
</List.Accordion>
<List.Item title="About" left={props => <List.Icon {...props} icon="more" />} />
</List.Section>
<RadioButton.Group onValueChange={newValue => setValue(newValue)} value={value}>
<View>
<Text>Español</Text>
<RadioButton value="es" />
</View>
<View>
<Text>English</Text>
<RadioButton value="en" />
</View>
</RadioButton.Group>
</View>
)
}
export default MenuView;