Open zacharyweidenbach opened 6 years ago
Have the same issue
For landscape mode in Android, you can modify the native package file "RSSignatureCaptureMainView", replace SCREEN_ORIENTATION_LANDSCAPE to SCREEN_ORIENTATION_SENSOR_LANDSCAPE, and it should works fine.
For landscape mode in Android, you can modify the native package file "RSSignatureCaptureMainView", replace SCREEN_ORIENTATION_LANDSCAPE to SCREEN_ORIENTATION_SENSOR_LANDSCAPE, and it should works fine.
I've tried updating it here in RSSignatureCaptureMainView.java
but it seems to still get locked. I've tried rebuilding the project with Android Studio. Anything else I could be missing?
public void setViewMode(String viewMode) {
this.viewMode = viewMode;
if (viewMode.equalsIgnoreCase("portrait")) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else if (viewMode.equalsIgnoreCase("landscape")) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
}
However, If I just update the code to do this, close the Metro Bundler and allow the launch script to reopen it
public void setViewMode(String viewMode) {
this.viewMode = viewMode;
// This seems to lock my screen....
// if (viewMode.equalsIgnoreCase("portrait")) {
// mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
// } else if (viewMode.equalsIgnoreCase("landscape")) {
// mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
// }
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
}
Now I lose the ability to say I prefer it in Landscape or Portrait, but at least it isn't locking my screen.
@davidfritch
Hmm, weird..., we have exactly same code lol.
Btw, did you tried to log the viewMode
, just to make sure your function did received the param.
Here's my working code.
landscape
is my requirement, so i just hardcoded it, usually shouldn't.
// RSSignatureCaptureMainView.java
public void setViewMode(String viewMode) {
this.viewMode = viewMode;
Log.d("viewMode:", "" + viewMode);
if (viewMode.equalsIgnoreCase("portrait")) {
mActivity.setRequestedOrientation(ActivityInfo. SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else if (viewMode.equalsIgnoreCase("landscape")) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
}
// signature.js
<Signature
style={ styles.signature }
ref={sign => this.sign = sign}
onSaveEvent={this.onSaveEvent.bind(this)}
onDragEvent={this.onDragEvent.bind(this)}
showNativeButtons={false}
viewMode={ this.getOrientation }
/>
getOrientation() {
var orientation = 'portrait'
if (condition) {
orientation = 'landscape'
}
return orientation
}
We're having the same issue on Android only.
HI guys, I have the same issue. My issue goes away when I remove the viewMode={"portrait"}
. Now I am able to rotate screen but don't know if it will affect the lib's functions
Having the same issue in Android, has anyone resolved this?
same here...
In android only, orientation becomes locked to the
viewMode
that is passed in to theSignatureCapture
component. Ie. if I pass in 'portrait', the entire app then becomes locked in portrait mode.Example:
Functionality is fine on iOS.
Related Issue: https://github.com/RepairShopr/react-native-signature-capture/issues/31
But the issue above makes it seem like this is only a problem in 'landscape' mode. Rather, this is a problem regardless of orientation.