shaun-chiang / rn-android-pip

React Native Android Picture-in-Picture Library.
MIT License
17 stars 24 forks source link

Feature - pip mode events #12

Closed shokimble closed 1 year ago

shokimble commented 2 years ago

Hi,

I have added lifecycle events for when PIP mode is entered or exited as well as fixing a small issue with gradle affecting newer versions of React Native.

The README has also been updated.

shokimble commented 2 years ago

Is someone ok to merge this?

ParasRai2 commented 1 year ago

@shokimble tried the changes as I need the feature but event is not firing

edit: found the issue

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      AppCompatActivity activity = (AppCompatActivity) source;
      boolean isInPiPMode = activity.isInPictureInPictureMode();
      // Check for changes on pip mode.
      if (this.isInPiPMode != isInPiPMode) {
          this.isInPiPMode = isInPiPMode;
          Log.d(this.getName(), "Activity pip mode has changed to " + isInPiPMode);
          // Dispatch onPictureInPicutreModeChangedEvent to js.
          WritableMap args = Arguments.createMap();
          args.putBoolean("isInPiPMode", isInPiPMode);
          sendEvent("onPictureInPictureModeChanged", args);
      }
  }
    here `activity.isInPictureInPictureMode()` is always returning `false`
shaun-chiang commented 1 year ago

Hey guys - thanks for this, but this library is unmaintained as I haven't the time 😬 but I do thank you for your commits. I'll go ahead and archive this repo, please do go ahead and fork the repo and commit the changes! Sorry for the inconvenience!