Explore category to store
This commit is contained in:
parent
b619fe34f8
commit
d8d8ac35f8
3 changed files with 16 additions and 15 deletions
|
@ -8,7 +8,7 @@ import {
|
|||
import { useEffect, useState } from 'react';
|
||||
import RenderHtml from 'react-native-render-html';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
|
@ -18,23 +18,18 @@ export default function CategoryScreen() {
|
|||
const colorScheme = useColorScheme() ?? 'light';
|
||||
const navigation = useNavigation();
|
||||
const [ description, setDescription ] = useState( '' );
|
||||
const viewCategory = useSelector((state: any) => state.data.viewCategory);
|
||||
|
||||
// Load item from storage
|
||||
useEffect( () => {
|
||||
AsyncStorage.getItem( 'activeCategory' ).then( (data) => {
|
||||
const itemData: any = JSON.parse( data ?? '{}' );
|
||||
const { name, description } = viewCategory;
|
||||
|
||||
if (itemData != null) {
|
||||
const { name, description } = itemData;
|
||||
// Set description
|
||||
// @ts-ignore
|
||||
setDescription( description );
|
||||
|
||||
// Set description
|
||||
// @ts-ignore
|
||||
setDescription( description );
|
||||
|
||||
// Set page title
|
||||
navigation.setOptions( { title: name } );
|
||||
}
|
||||
} );
|
||||
// Set page title
|
||||
navigation.setOptions( { title: name } );
|
||||
}, [] );
|
||||
|
||||
// HTML render props
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue