This module used for enable/disable app preview feature
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
For bare React Native projects, you must ensure that you have installed and configured the expo
package before continuing.
npm install expo-secureflag
import * as ExpoSecureflag from "expo-secureflag";
import React from "react";
import { Text, View, Button } from "react-native";
export default function App() {
const [isEnabled, setIsEnabled] = React.useState(true);
const disableFunc = () => {
ExpoSecureflag.activate();
setIsEnabled(false);
};
const enableFunc = () => {
ExpoSecureflag.deactivate();
setIsEnabled(true);
};
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>App preview: {isEnabled?'Enabled':'Disabled'}</Text>
{isEnabled ? (
<View style={{ width: "200px", marginTop: 20 }}>
<Button title="Disable App preview" onPress={disableFunc} />
</View>
) : (
<View style={{ width: "200px", marginTop: 20 }}>
<Button title="Enable App preview" onPress={enableFunc} />
</View>
)}
</View>
);
}
Run npx pod-install
after installing the npm package.
Contributions are very welcome! Please refer to guidelines described in the contributing guide.