I don’t find where is the error… I think the problem is on the useState declaration.
The first objective is be able to show an alert on the screen asking for tracking permissions in the App.
import { Text, StyleSheet, View, Alert } from 'react-native';
// import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';
import {
getTrackingStatus,
requestTrackingPermission,
TrackingStatus,
} from 'react-native-tracking-transparency';
import Cosa from './cosa';
const App = ()=> {
const [trackingStatus, setTrackingStatus] = useState<TrackingStatus | '(loading)'>('(loading)');
useEffect(() => {
getTrackingStatus()
.then((status) => {
setTrackingStatus(status);
})
.catch((e) => Alert.alert('Error', e?.toString?.() ?? e));
}, []);
return (
<View style={styles.container}>
<Cosa />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});
export default App;