Control view that should be shown in app switcher when app goes to background. Only works on iOS for now.
Screen.Recording.2023-01-30.at.11.41.03.AM.mov
yarn add react-native-lockscreen-view
// or
npm i react-native-lockscreen-view
- Checkout example/ directory
import { ReactNativeLockscreenView } from "react-native-lockscreen-view";
export default function App() {
const [visible, setVisible] = useState(true);
return (
<View style={styles.container}>
<Text>hello world</Text>
<ReactNativeLockscreenView onReset={() => setVisible(true)}>
{visible ? <Passcode hide={() => setVisible(false)} /> : null}
</ReactNativeLockscreenView>
</View>
);
}
const Passcode = (props) => {
const { hide } = props;
return (
<Modal visible>
<View style={styles.container}>
<Button title="Tap to unlock" onPress={hide} />
</View>
</Modal>
);
};
-
✅ You can use this library with Development Builds. No config plugin is required.
- After installing the library, run expo prebuild command to rebuild the native app.
-
❌ This library can't be used in the "Expo Go" app because it requires custom native code.