Recibí el error al evaluar un objeto const, aquí hay un ejemplo de trabajo mínimo:
import React from "react"; import { View, StyleSheet } from "react-native"; const App = () => { return ( <View style={styles.container}></View> ); } const styles = StyleSheet.create({ container: { backgroundColor:colors.bg, }, }); const colors = { bg:'blue', } export default App; Mensaje de error: TypeError: undefined is not an object (evaluating 'colors.bg')
¿Que está pasando aqui?
Tienes que definir los colores const antes que los estilos .
Prueba esto
import React from 'react'; import {View, StyleSheet} from 'react-native'; const App = () => { return <View style={styles.container}></View>; }; const colors = { bg: 'blue', }; const styles = StyleSheet.create({ container: { backgroundColor: colors.bg, }, }); export default App;