Skip to content

Mi Primer Aplicación con S42UI y React Native + Expo

Debemos crear una aplicación en Expo, y agregar el siguiente código.

import { usePathname } from 'expo-router'
import { Text } from 'react-native'
import {
useFetchScreen,
S42ScreenBuilder,
ErrorScreen,
LoadingScreen,
} from '@/s42ui-react-native'
type TypeContacts = [{ firstName: string; lastName: string }]
const customFunctionMapper = {
searchContacts: (contacts: TypeContacts) => {
return contacts.filter(contact => contact.firstName === 'best')
},
}
export default function NotFoundScreen() {
const pathname = usePathname()
const [loading, screen, error] = useFetchScreen(pathname)
if (loading) {
return <LoadingScreen />
}
if (error) {
return <ErrorScreen />
}
if (!loading && !screen) {
return <Text>Not Found</Text>
}
return (
<>
<S42ScreenBuilder
screen={screen}
customFunctionMapper={customFunctionMapper}
/>
</>
)
}