He seguido este artículo desde aquí para crear una biblioteca nativa de reacción. He publicado la biblioteca y la he usado en mi proyecto local. Funciona bien en Android, pero cuando intento ejecutarlo en iOS arroja errores como:
TypeError: null no es un objeto (evaluando '_exampleBridge.default.showMessage').
Ya abrí el proyecto de la biblioteca en xcode13, se construye con éxito.
Gracias por adelantado.
import React from 'react'; import { SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, useColorScheme, View, Button } from 'react-native'; import {Colors,Header} from 'react-native/Libraries/NewAppScreen'; import RNExampleBridge from 'example-bridge-1.0.8' const App = () => { const isDarkMode = useColorScheme() === 'dark'; const backgroundStyle = { backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, }; function showToastAlert(){ RNExampleBridge.showMessage() } return ( <SafeAreaView style={backgroundStyle}> <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <ScrollView contentInsetAdjustmentBehavior="automatic" style={backgroundStyle}> <Header /> <View style={{ backgroundColor: isDarkMode ? Colors.black : Colors.white, }}> <View> <Button title="Show Native Message" onPress={() => { showToastAlert() }}/> </View> </View> </ScrollView> </SafeAreaView> ); }; export default App;