Todo With Priority - Nativebase Typing CST Test
Loading…
Todo With Priority — Nativebase Code
Todo app where each task has a priority and displays it using NativeBase.
import React, { useState } from 'react';
import { NativeBaseProvider, Box, Input, Button, VStack, Text } from 'native-base';
export default function App() {
const [todos, setTodos] = useState([]);
const [task, setTask] = useState('');
const [priority, setPriority] = useState('');
const addTodo = () => {
if(task.trim()) {
setTodos([...todos, {task, priority}]);
setTask(''); setPriority('');
}
};
return (
<NativeBaseProvider>
<Box safeArea p={4}>
<VStack space={4} alignItems="center">
<Input placeholder="Task" value={task} onChangeText={setTask} />
<Input placeholder="Priority" value={priority} onChangeText={setPriority} />
<Button onPress={addTodo}>Add</Button>
{todos.map((todo,i) => <Text key={i}>{todo.task} (Priority: {todo.priority})</Text>)}
</VStack>
</Box>
</NativeBaseProvider>
);
}Nativebase Language Guide
NativeBase is an open-source UI component library for React Native, providing a set of cross-platform, customizable components that accelerate mobile app development with consistent design.
Primary Use Cases
- ▸Cross-platform mobile app development
- ▸Rapid UI prototyping
- ▸Enterprise React Native apps
- ▸Apps requiring consistent theming across devices
- ▸Integration with Expo and React Native ecosystem
Notable Features
- ▸Pre-built, customizable components
- ▸Cross-platform support (iOS and Android)
- ▸Themeable design system
- ▸Flexbox-based responsive layouts
- ▸Integration with Expo and third-party libraries
Origin & Creator
Developed by GeekyAnts, first released in 2016 to simplify React Native UI development and provide a consistent cross-platform component library.
Industrial Note
NativeBase is widely used for startups, enterprise mobile apps, and cross-platform React Native projects that need rapid prototyping and production-ready UI components.