added orientation locker

This commit is contained in:
Niklas 2021-01-22 14:54:34 +01:00
parent 36cfd8f69f
commit 6bff17f226
6 changed files with 17 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import org.wonday.orientation.OrientationPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;

View File

@ -1,3 +1,5 @@
rootProject.name = 'opendeck'
include ':react-native-orientation-locker'
project(':react-native-orientation-locker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation-locker/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

View File

@ -8,6 +8,8 @@ target 'opendeck' do
use_react_native!(:path => config["reactNativePath"])
pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
target 'opendeckTests' do
inherit! :complete
# Pods for testing

5
package-lock.json generated
View File

@ -10014,6 +10014,11 @@
}
}
},
"react-native-orientation-locker": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/react-native-orientation-locker/-/react-native-orientation-locker-1.2.0.tgz",
"integrity": "sha512-lnwp9Jbt1m/0Gfw9a5Mrwj/APNSuYkVdJEgBKRyQgOshDrKRv5dxpD0P786AgIEjnEbjyrNOS6GQvBdqPYSxsg=="
},
"react-refresh": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz",

View File

@ -12,7 +12,8 @@
},
"dependencies": {
"react": "16.13.1",
"react-native": "0.63.4"
"react-native": "0.63.4",
"react-native-orientation-locker": "^1.2.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",

View File

@ -1,7 +1,11 @@
import React, {PropsWithChildren} from 'react';
import React, {PropsWithChildren, useEffect} from 'react';
import {StyleSheet, View} from 'react-native';
import Orientation from 'react-native-orientation-locker';
export default function Deck(props: PropsWithChildren<{}>) {
useEffect(() => {
Orientation.lockToPortrait();
});
return (
<>
<View style={style.view}>{props.children}</View>