diff --git a/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java b/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java index c646ad75268..14573ae9249 100644 --- a/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java +++ b/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java @@ -96,6 +96,10 @@ private void createLayout() { if (hasBackgroundColor()) { layout.asView().setBackgroundColor(AppStyle.appStyle.screenBackgroundColor.getColor()); } + String screenBackgroundImageName = activityParams.screenParams.styleParams.screenBackgroundImageName; + if (screenBackgroundImageName != null) { + layout.asView().setBackgroundResource(this.getResources().getIdentifier(screenBackgroundImageName, "drawable", this.getPackageName())); + } setContentView(layout.asView()); } diff --git a/android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java b/android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java index 24337a173c7..036f8df91c0 100644 --- a/android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java +++ b/android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java @@ -128,6 +128,7 @@ public String toString() { public int topTabsHeight; public Color screenBackgroundColor; + public String screenBackgroundImageName; public boolean drawScreenAboveBottomTabs; diff --git a/android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java b/android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java index c4a1eab69c7..6839bdfce4f 100644 --- a/android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java +++ b/android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java @@ -79,6 +79,7 @@ public StyleParams parse() { result.topTabsHeight = getInt("topTabsHeight", getDefaultTopTabsHeight()); result.screenBackgroundColor = getColor("screenBackgroundColor", getDefaultScreenBackgroundColor()); + result.screenBackgroundImageName = params.getString("screenBackgroundImageName"); result.bottomTabsInitialIndex = getInt("initialTabIndex", 0); result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden()); diff --git a/docs/styling-the-navigator.md b/docs/styling-the-navigator.md index 70c44a3cea5..87279ee54a2 100644 --- a/docs/styling-the-navigator.md +++ b/docs/styling-the-navigator.md @@ -71,8 +71,9 @@ this.props.navigator.setStyle({ navBarSubtitleFontFamily: 'font-name', // subtitle font, 'sans-serif-thin' for example navBarSubtitleFontSize: 13, // subtitle font size screenBackgroundColor: 'white', // Default screen color, visible before the actual react view is rendered + screenBackgroundImageName: 'ios:, android: ', // Optional. default screen background image. orientation: 'portrait' // Sets a specific orientation to a modal and all screens pushed to it. Default: 'auto'. Supported values: 'auto', 'landscape', 'portrait' - disabledButtonColor: '#ff0000' // chnaged the navigation bar button text color when disabled. + disabledButtonColor: '#ff0000' // changed the navigation bar button text color when disabled. // iOS only statusBarTextColorSchemeSingleScreen: 'light', // same as statusBarTextColorScheme but does NOT remember across pushes @@ -81,7 +82,6 @@ this.props.navigator.setStyle({ disabledBackGesture: false, // default: false. Disable the back gesture (swipe gesture) in order to pop the top screen. disabledSimultaneousGesture: true, // default: true. Disable simultaneous gesture recognition. - screenBackgroundImageName: '', // Optional. default screen background image. rootBackgroundImageName: '', // Static while you transition between screens. Works best with screenBackgroundColor: 'transparent' navBarButtonFontSize: 20, // Change font size nav bar buttons (eg. the back button) (remembered across pushes) diff --git a/src/deprecated/platformSpecificDeprecated.android.js b/src/deprecated/platformSpecificDeprecated.android.js index fa7b74f618d..79b496ca668 100644 --- a/src/deprecated/platformSpecificDeprecated.android.js +++ b/src/deprecated/platformSpecificDeprecated.android.js @@ -190,6 +190,7 @@ function convertStyleParams(originalStyleObject) { topTabsScrollable: originalStyleObject.topTabsScrollable, topTabsHeight: originalStyleObject.topTabsHeight, screenBackgroundColor: processColor(originalStyleObject.screenBackgroundColor), + screenBackgroundImageName: originalStyleObject.screenBackgroundImageName, drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,