1import * as React from 'react'; 2import { StatusBar } from 'react-native'; 3 4import Button from '../components/Button'; 5import { Page, Section } from '../components/Page'; 6 7export default function StatusBarScreen() { 8 const randomAnimation = () => { 9 return Math.random() > 0.5 ? 'slide' : 'fade'; 10 }; 11 12 const hide = () => { 13 StatusBar.setHidden(true, randomAnimation()); 14 }; 15 16 const show = () => { 17 StatusBar.setHidden(false, randomAnimation()); 18 }; 19 20 return ( 21 <Page> 22 <Section title="Toggle" row> 23 <Button onPress={hide} title="Hide" /> 24 25 <Button onPress={show} title="Show" /> 26 </Section> 27 </Page> 28 ); 29} 30 31StatusBarScreen.navigationOptions = { 32 title: 'StatusBar', 33}; 34