Categories select + modal

This commit is contained in:
Maarten 2024-08-01 14:21:09 +02:00
parent aaedcec4a6
commit 0999ef563a
6 changed files with 210 additions and 40 deletions

View file

@ -5,7 +5,7 @@ import {
Dimensions
} from 'react-native';
import {useState} from 'react';
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';
@ -20,20 +20,22 @@ export default function CategoryScreen() {
const [description, setDescription] = useState('');
// Load item from storage
AsyncStorage.getItem('activeCategory').then((data) => {
const itemData: any = JSON.parse(data ?? '{}');
useEffect(() => {
AsyncStorage.getItem('activeCategory').then((data) => {
const itemData: any = JSON.parse(data ?? '{}');
if (itemData != null) {
const {name, description} = itemData;
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
const source = {html: description};