Expose the react application context as a singleton.

This commit is contained in:
plougsgaard 2016-09-15 00:57:55 +02:00
parent b5af30248e
commit 2a33908c4f
1 changed files with 5 additions and 1 deletions

View File

@ -79,7 +79,7 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
public static final int MEDIA_TYPE_IMAGE = 1;
public static final int MEDIA_TYPE_VIDEO = 2;
private final ReactApplicationContext _reactContext;
private static ReactApplicationContext _reactContext;
private RCTSensorOrientationChecker _sensorOrientationChecker;
private MediaRecorder mMediaRecorder = new MediaRecorder();
@ -96,6 +96,10 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
_reactContext.addLifecycleEventListener(this);
}
public static ReactApplicationContext getReactContextSingleton() {
return _reactContext;
}
public void onInfo(MediaRecorder mr, int what, int extra) {
if ( what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED ||
what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED) {