Custom Widgets
Create your widget components as regular React components:
Example
function WeatherWidget({ location, unit = 'celsius' }) {
// Fetch weather data here
return (
<View style={styles.weather}>
<Text>{temperature}°{unit}</Text>
</View>
);
}
// Pass it to the stack with props
const widgets = [{
id: 'weather',
name: 'Weather',
component: WeatherWidget,
props: {
location: 'London',
unit: 'celsius'
}
}];
Best Practices
- Keep widgets lightweight and optimized for frequent re-renders
- Handle data fetching inside widget components
- Use React Query/SWR for automatic background updates
- Implement loading/error states within each widget
Last updated on