Skip to content

Examples

Basic style caching

```tsx import React from 'react'; import { View, Text } from 'react-native'; import { getCachedStyle } from 'medhira-rn-styles-cache';

const boxStyle = getCachedStyle({ width: 100, height: 100, backgroundColor: 'blue', borderRadius: 10, });

export function BasicExample() { return ( Hello World ); } ```

Dynamic styles

```tsx import React, { useState } from 'react'; import { View, Text, Button } from 'react-native'; import { getCachedStyle } from 'medhira-rn-styles-cache';

export function DynamicExample() { const [count, setCount] = useState(0);

const dynamicStyle = getCachedStyle({ width: 100 + count * 10, height: 50, backgroundColor: count % 2 === 0 ? 'blue' : 'red', });

return ( Count: {count}