import { PropsWithChildren, useLayoutEffect } from 'react' import { Button, StyleSheet, Text, View } from 'react-native' import { Box, Row, Text as BacaText } from '@/design-system' import { useScreenOptions, useState } from '@/hooks' const COUNT = 1000 const NativeViews = () => { return ( {new Array(COUNT).fill(0).map((_, i) => ( ))} ) } const NativeTexts = () => { return ( {new Array(COUNT).fill(0).map((_, i) => ( {i} ))} ) } const BacaViews = () => { return ( {new Array(COUNT).fill(0).map((_, i) => ( ))} ) } const BacaTexts = () => { return ( {new Array(COUNT).fill(0).map((_, i) => ( {i} ))} ) } const TimedRender = (props: PropsWithChildren) => { const [start] = useState(Date.now()) const [end, setEnd] = useState(0) useLayoutEffect(() => { setEnd(Date.now()) }, []) return ( <> {!!end && Took {end - start}ms} {props.children} ) } type StyleType = 'React Native' | 'React Native Text' | 'Baca' | 'Baca Text' | undefined export const StyleBenchmarkScreen = (): JSX.Element => { // Setting screen title useScreenOptions({ title: 'Style Benchmark', }) const [styleType, setStyleType] = useState(undefined) const onStyleTypePress = (curry: StyleType) => () => { setStyleType(curry) } const renderStyleLibrary = () => { switch (styleType) { case 'React Native': return case 'React Native Text': return case 'Baca': return case 'Baca Text': return default: return null } } // Render return (