did some more cleanup of the interface and UI interactions.
This commit is contained in:
@ -10,7 +10,8 @@ import { setupStore } from '../store';
|
||||
export default function TabLayout() {
|
||||
const colorScheme = useColorScheme();
|
||||
const store = setupStore({
|
||||
products: fixtures.map(p => p.asObject)
|
||||
products: fixtures.map(p => p.asObject),
|
||||
units: "ft",
|
||||
});
|
||||
return (
|
||||
<Provider store={store}>
|
||||
@ -22,7 +23,7 @@ export default function TabLayout() {
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: 'Home Screen',
|
||||
title: 'Measure',
|
||||
tabBarIcon: ({ color, focused }) => (
|
||||
<TabBarIcon name={focused ? 'scale' : 'scale-outline'} color={color} />
|
||||
),
|
||||
@ -31,7 +32,7 @@ export default function TabLayout() {
|
||||
<Tabs.Screen
|
||||
name="product-editor"
|
||||
options={{
|
||||
title: 'Products',
|
||||
title: 'Edit Products',
|
||||
tabBarIcon: ({ color, focused }) => (
|
||||
<TabBarIcon name={focused ? 'list' : 'list-outline'} color={color} />
|
||||
),
|
||||
|
12
app/store.ts
12
app/store.ts
@ -3,25 +3,29 @@ import { configureStore } from '@reduxjs/toolkit';
|
||||
import { rememberReducer, rememberEnhancer } from 'redux-remember';
|
||||
import reducers from "@/features/product/productSlice"
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { Product, ProductData, } from "@/lib/product";
|
||||
import { ProductData, } from "@/lib/product";
|
||||
import {Length} from "convert"
|
||||
|
||||
const rememberedKeys = ['products'];
|
||||
|
||||
const rootReducer = reducers;
|
||||
|
||||
const isBrowser = (typeof window !== "undefined");
|
||||
|
||||
export function setupStore(preloadedState = {
|
||||
products: [] as ProductData[],
|
||||
units: "ft" as Length,
|
||||
}) {
|
||||
return configureStore({
|
||||
reducer: rememberReducer(reducers),
|
||||
preloadedState,
|
||||
enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(
|
||||
rememberEnhancer(
|
||||
AsyncStorage,
|
||||
isBrowser ? window.localStorage : AsyncStorage,
|
||||
rememberedKeys,
|
||||
{
|
||||
persistWholeStore: true,
|
||||
}
|
||||
persistWholeStore: false,
|
||||
},
|
||||
)
|
||||
),
|
||||
});
|
||||
|
Reference in New Issue
Block a user