Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
arrowParens: 'avoid',
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
};
9 changes: 8 additions & 1 deletion Example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ ruby ">= 2.6.10"
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
gem 'nkf'
4 changes: 2 additions & 2 deletions Example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ react {

/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]

/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
Expand Down
9 changes: 0 additions & 9 deletions Example/android/app/src/debug/AndroidManifest.xml

This file was deleted.

1 change: 1 addition & 0 deletions Example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/BootTheme"
android:usesCleartextTraffic="${usesCleartextTraffic}"
android:supportsRtl="true">
<activity
android:exported="true"
Expand Down
38 changes: 21 additions & 17 deletions Example/android/app/src/main/java/com/rnjwplayer/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,35 @@ import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.zoontek.rnbootsplash.RNBootSplash
import com.swmansion.rnscreens.fragment.restoration.RNScreensFragmentFactory

class MainActivity : ReactActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
// The splash screen is initialized here, before super.onCreate, rather than from a
// ReactActivityDelegate. The fragment factory is required when using react-native-screens.
supportFragmentManager.fragmentFactory = RNScreensFragmentFactory()
// react-native-bootsplash's post-splash view is deliberately not initialised.
// On API 31+ it draws a large black ring where the logo should be: its compat
// drawable does not resolve ?bootSplashLogo from this theme (verified with
// three different logo assets, and bootSplashBackground has no effect on it
// either), so it falls back to the library's own default. The platform splash
// screen configured in values-v31/BootTheme already shows the branded logo.

super.onCreate(savedInstanceState)


// With the splash view gone, nothing covers the window between the platform
// splash exiting and React's first render, and the bare window is black.
// Painting it with the splash background makes that gap white instead.
window.setBackgroundDrawableResource(R.color.bootsplash_background)
window.decorView.setBackgroundResource(R.color.bootsplash_background)

// Enable edge-to-edge display
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowCompat.setDecorFitsSystemWindows(window, false)
}
}

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
Expand All @@ -33,19 +49,7 @@ class MainActivity : ReactActivity() {
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
MainActivityDelegate(this, mainComponentName, fabricEnabled)

class MainActivityDelegate(
activity: ReactActivity,
mainComponentName: String,
fabricEnabled: Boolean
) :
DefaultReactActivityDelegate(activity, mainComponentName, fabricEnabled) {
override fun loadApp(appKey: String) {
RNBootSplash.init(plainActivity, R.style.BootTheme)
super.loadApp(appKey)
}
}
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,24 @@ import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
override val reactHost: ReactHost by lazy {
getDefaultReactHost(
context = applicationContext,
packageList =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}

override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)
},
)
}

override fun onCreate() {
super.onCreate()
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
loadReactNative(this)
}
}
19 changes: 19 additions & 0 deletions Example/android/app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
API 31+ needs its own BootTheme: with the theme defined only in values/, the
platform splash screen did not pick up bootSplashBackground / bootSplashLogo.

windowSplashScreenIconBackgroundColor is set explicitly because the platform
draws the splash icon on a circular background and chooses its own colour when
the attribute is unset. Matching it to the splash background keeps that circle
invisible, so only the logo shows.
-->
<style name="BootTheme" parent="Theme.BootSplash">
<item name="bootSplashBackground">@color/bootsplash_background</item>
<item name="bootSplashLogo">@mipmap/ic_launcher</item>
<item name="postBootSplashTheme">@style/AppTheme</item>
<item name="darkContentBarsStyle">true</item>
<item name="android:windowSplashScreenIconBackgroundColor">@color/bootsplash_background</item>
</style>
</resources>
1 change: 0 additions & 1 deletion Example/android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bootsplash_background">#FFFFFF</color>
<color name="bootsplash_icon_background">#EC0041</color>
<color name="jw_seekbar_thumb">#E02929</color>
<!-- Sample of overrindg a JW color -->
</resources>
15 changes: 11 additions & 4 deletions Example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>

<!-- BootTheme should inherit from Theme.SplashScreen -->
<!--
Pre-API-31 splash. Theme.BootSplash emulates the platform splash screen below 31
by drawing bootSplashLogo over bootSplashBackground as the window background.
The launcher icon doubles as the logo, so no dedicated asset is required; point
bootSplashLogo at a real drawable if one is ever added.
API 31+ is configured separately in values-v31/styles.xml.
-->
<style name="BootTheme" parent="Theme.BootSplash">
<item name="windowSplashScreenBackground">@color/bootsplash_background</item>
<item name="windowSplashScreenIconBackgroundColor">@color/bootsplash_icon_background</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
<item name="bootSplashBackground">@color/bootsplash_background</item>
<item name="bootSplashLogo">@mipmap/ic_launcher</item>
<item name="postBootSplashTheme">@style/AppTheme</item>
<item name="darkContentBarsStyle">true</item>
</style>

</resources>
6 changes: 3 additions & 3 deletions Example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
ext {
buildToolsVersion = "35.0.0"
buildToolsVersion = "36.0.0"
minSdkVersion = 24
compileSdkVersion = 36
targetSdkVersion = 35
targetSdkVersion = 36
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
kotlinVersion = "2.1.20"
RNJWPlayerUseGoogleCast = true
RNJWPlayerUseGoogleIMA = true
}
Expand Down
8 changes: 7 additions & 1 deletion Example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
hermesEnabled=true

# Use this property to enable edge-to-edge display support.
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.
# Left disabled because MainActivity already applies edge-to-edge via WindowCompat.
edgeToEdgeEnabled=false
Binary file modified Example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions Example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
11 changes: 4 additions & 7 deletions Example/android/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Example/android/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 29 additions & 9 deletions Example/ios/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ import RNBootSplash
import GoogleCast

@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.moduleName = "RNJWPlayer"
self.dependencyProvider = RCTAppDependencyProvider()
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
/*:
kGCKDefaultMediaReceiverApplicationID is a constant from the GoogleCast SDK, representing the default Chromecast receiver.
- https://developers.google.com/android/reference/com/google/android/gms/cast/CastMediaControlIntent#public-static-final-string-default_media_receiver_application_id
Expand All @@ -19,13 +25,27 @@ class AppDelegate: RCTAppDelegate {
let discoveryCriteria = GCKDiscoveryCriteria(applicationID: kGCKDefaultMediaReceiverApplicationID)
let options = GCKCastOptions(discoveryCriteria: discoveryCriteria)
GCKCastContext.setSharedInstanceWith(options)
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = [:]

return super.application(application, didFinishLaunchingWithOptions: launchOptions)
let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()

reactNativeDelegate = delegate
reactNativeFactory = factory

window = UIWindow(frame: UIScreen.main.bounds)

factory.startReactNative(
withModuleName: "RNJWPlayer",
in: window,
launchOptions: launchOptions
)

return true
}
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
Expand All @@ -38,7 +58,7 @@ class AppDelegate: RCTAppDelegate {
#endif
}

override func customize(_ rootView: RCTRootView!) {
override func customize(_ rootView: RCTRootView) {
super.customize(rootView)
RNBootSplash.initWithStoryboard("LaunchScreen", rootView: rootView)
}
Expand Down
Loading