Saturday, March 18, 2023
HomeiOS DevelopmentEasy methods to begin React Native App in portrait orientation solely in...

Easy methods to begin React Native App in portrait orientation solely in each iOS and Android?


I wish to begin React Native app with Portrait orientation. At present I am utilizing the react-native-orientation-locker library to deal with the preliminary orientation. However it’s not working appropriately.

My App.js seems to be like this.

import Orientation from 'react-native-orientation-locker';

export const App = () => {
    useLayoutEffect(() => {
        Orientation.lockToPortrait();
    }, []);

    return (
        <RootContainer>
            <MyApp />
        </RootContainer>
    );
};

export default App;

I believe this must be dealt with from the native facet as a result of the JavaScript codes run after the preliminary course of. Perhaps I’ve so as to add a code MainApplication.java and AppDelegate.mm?

RELATED ARTICLES

Most Popular