Thursday, February 6, 2025
HomeiOS Developmentios - React Native, expo-screen-orientation

ios – React Native, expo-screen-orientation


I’m engaged on IOS React Native Undertaking (utilizing expo with naked workflow).
By default my app use portrait mode, however typically I would like change display screen orientation to panorama mode. I take advantage of expo-screen-orientation library to vary display screen orientation. When app change display screen orientation I’ve difficulty in launched app, though in debug mode it’s works good (each IOS Simulator / IOS system). In launch mode I’ve difficulty with lower display screen. Please test pictures in connect

import { StatusBar } from 'expo-status-bar';
import {StyleSheet, Textual content, View, Button} from 'react-native';
import * as ScreenOrientation from 'expo-screen-orientation';

export default operate App() {

  const foo = async()=>{
    await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_LEFT);
  }

  return (
    <View fashion={types.container}>
      <Textual content fashion={{paddingTop:50}}>Open up App.js to start out working in your app!</Textual content>
      <Button title="Rotate" onPress={foo}/>
      <StatusBar fashion="auto" />
    </View>
  );
}

const types = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#cccccc',
    alignItems: 'middle',
    justifyContent: 'flex-start',
  },
});

Portrait mode


Panorama mode, with lower display screen

Landscape mode with cut screen

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments