Please provide the following:
- SDK Version: 4.7.2
- Platforms(Android/iOS/web/all): iOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
I created a basic Expo blank project. It uses the StatusBar component from “expo-status-bar”.
I added a button and in the “onPress” event added a call to “setStatusBarHidden”. When I run the app and click the button I get the error: “Can’t find variable setStatusBarHidden.”
Here’s the code. Any help is appreciated.
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View, Button } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
<Button
onPress={() => {
setStatusBarHidden(true, 'slide');
}}
title="Click Me"
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});