From 2a33908c4f8888a4cffe2f667f3b86dbd9fd4918 Mon Sep 17 00:00:00 2001 From: plougsgaard Date: Thu, 15 Sep 2016 00:57:55 +0200 Subject: [PATCH] Expose the react application context as a singleton. --- .../java/com/lwansbrough/RCTCamera/RCTCameraModule.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java b/android/src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java index 837cdda..8764585 100644 --- a/android/src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java +++ b/android/src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java @@ -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) {