mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
added landscape in post screen and orientation lock
This commit is contained in:
parent
3519e54e75
commit
218f4073ec
@ -30,8 +30,7 @@
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboard|keyboardHidden|screenSize|uiMode"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -5,6 +5,7 @@ import com.facebook.react.ReactActivityDelegate;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
/**
|
||||
@ -31,4 +32,11 @@ public class MainActivity extends ReactActivity {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
Intent intent = new Intent("onConfigurationChanged");
|
||||
intent.putExtra("newConfig", newConfig);
|
||||
this.sendBroadcast(intent); }
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.facebook.soloader.SoLoader;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
import com.getkeepsafe.relinker.ReLinker;
|
||||
import com.bugsnag.android.Bugsnag;
|
||||
import org.wonday.orientation.OrientationActivityLifecycle;
|
||||
|
||||
//See below, Webview debugging
|
||||
//import android.webkit.WebView;
|
||||
@ -62,5 +63,6 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
// Uncomment below line to Debug Webview
|
||||
// WebView.setWebContentsDebuggingEnabled(true);
|
||||
registerActivityLifecycleCallbacks(OrientationActivityLifecycle.getInstance());
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <React/RCTLinkingManager.h>
|
||||
#import "Orientation.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
@ -60,4 +61,7 @@
|
||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
|
||||
return [Orientation getOrientation];
|
||||
}
|
||||
@end
|
||||
|
@ -115,6 +115,8 @@
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
|
@ -331,6 +331,8 @@ PODS:
|
||||
- React (~> 0.60)
|
||||
- react-native-netinfo (5.9.10):
|
||||
- React-Core
|
||||
- react-native-orientation-locker (1.4.0):
|
||||
- React-Core
|
||||
- react-native-randombytes (3.6.1):
|
||||
- React-Core
|
||||
- react-native-receive-sharing-intent (1.0.4):
|
||||
@ -508,6 +510,7 @@ DEPENDENCIES:
|
||||
- react-native-date-picker (from `../node_modules/react-native-date-picker`)
|
||||
- react-native-matomo-sdk (from `../node_modules/react-native-matomo-sdk`)
|
||||
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
|
||||
- react-native-orientation-locker (from `../node_modules/react-native-orientation-locker`)
|
||||
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
|
||||
- react-native-receive-sharing-intent (from `../node_modules/react-native-receive-sharing-intent`)
|
||||
- react-native-restart (from `../node_modules/react-native-restart`)
|
||||
@ -632,6 +635,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/react-native-matomo-sdk"
|
||||
react-native-netinfo:
|
||||
:path: "../node_modules/@react-native-community/netinfo"
|
||||
react-native-orientation-locker:
|
||||
:path: "../node_modules/react-native-orientation-locker"
|
||||
react-native-randombytes:
|
||||
:path: "../node_modules/react-native-randombytes"
|
||||
react-native-receive-sharing-intent:
|
||||
@ -760,6 +765,7 @@ SPEC CHECKSUMS:
|
||||
react-native-date-picker: 242eec7af56cea5fb2706d5db5d3837060b3884b
|
||||
react-native-matomo-sdk: 025c54f92e1e26a4d0acee7c3f28cb0fc7e4729c
|
||||
react-native-netinfo: 30fb89fa913c342be82a887b56e96be6d71201dd
|
||||
react-native-orientation-locker: 2da91e5391971dace445495821c899c111dcad7a
|
||||
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
|
||||
react-native-receive-sharing-intent: feba0a332a07977549a85aa58b496eb44368366a
|
||||
react-native-restart: aaad36f3ed7031daac3565f4a79d67e4f3884a50
|
||||
|
@ -108,6 +108,7 @@
|
||||
"react-native-modal-popover": "^2.1.0",
|
||||
"react-native-modal-translucent": "^5.0.0",
|
||||
"react-native-navigation-bar-color": "^1.0.0",
|
||||
"react-native-orientation-locker": "^1.4.0",
|
||||
"react-native-os": "^1.0.1",
|
||||
"react-native-permissions": "^3.3.0",
|
||||
"react-native-portalize": "^1.0.7",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { Fragment, useEffect, useState } from 'react';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
|
||||
import { OrientationLocker, PORTRAIT, LANDSCAPE } from 'react-native-orientation-locker';
|
||||
import ApplicationContainer from './container/applicationContainer';
|
||||
import WelcomeScreen from './screen/welcomeScreen';
|
||||
import ApplicationScreen from './screen/applicationScreen';
|
||||
@ -41,6 +42,13 @@ const Application = () => {
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<OrientationLocker
|
||||
orientation={PORTRAIT}
|
||||
onChange={(orientation) => console.log('orientation changed : ', orientation)}
|
||||
onDeviceChange={(orientation) =>
|
||||
console.log('device orientation changed : ', orientation)
|
||||
}
|
||||
/>
|
||||
<Modal
|
||||
isOpen={showWelcomeModal && _isAppReady}
|
||||
isFullScreen
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import React, { Fragment, useEffect } from 'react';
|
||||
|
||||
// Components
|
||||
import Orientation, { useDeviceOrientationChange } from 'react-native-orientation-locker';
|
||||
import { BasicHeader, PostDisplay, PostDropdown } from '../../../components';
|
||||
|
||||
const PostScreen = ({
|
||||
@ -14,6 +15,15 @@ const PostScreen = ({
|
||||
isPostUnavailable,
|
||||
author,
|
||||
}) => {
|
||||
useEffect(() => {
|
||||
return () => Orientation.lockToPortrait();
|
||||
}, []);
|
||||
|
||||
useDeviceOrientationChange((orientation) => {
|
||||
if (orientation === 'LANDSCAPE-RIGHT' || orientation === 'LANDSCAPE-LEFT') {
|
||||
Orientation.unlockAllOrientations();
|
||||
}
|
||||
});
|
||||
return (
|
||||
<Fragment>
|
||||
<BasicHeader
|
||||
|
@ -8728,6 +8728,11 @@ react-native-navigation-bar-color@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/react-native-navigation-bar-color/-/react-native-navigation-bar-color-1.0.0.tgz#04ff752a58049af93ceea9ccf266b8d3fbc6514a"
|
||||
integrity sha512-djBE0zSp+JT65VeUm4UpIpr9DA9SpE9YTLwDAcqkWfB9JI8l3djSx+SmrIYfc7dUs216Y6qo2dr0qR3+M5qbOQ==
|
||||
|
||||
react-native-orientation-locker@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-orientation-locker/-/react-native-orientation-locker-1.4.0.tgz#ac27a0cd13d5eaaf06b0a2eed2f98f52fbac2f66"
|
||||
integrity sha512-O/Ki7uw1lltKiTZLcTuLcSh4EzLFqXKKo2J4cLKvyG52YiEawbn/ipsZriZlWzK0mhX4dSe79CoRS4IsyUs1fw==
|
||||
|
||||
react-native-os@^1.0.1:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/react-native-os/-/react-native-os-1.2.6.tgz#1bb16d78ccad1143972183a04f443cf1af9fbefa"
|
||||
|
Loading…
Reference in New Issue
Block a user