Skip to content

Commit 746e43c

Browse files
committed
Release 4.3.3
1 parent c6dc0f2 commit 746e43c

9 files changed

Lines changed: 122 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.3.3 — 29 May 2026
2+
3+
- Adds an Expo config plugin for Android that applies a theme to prevent `InvalidThemeException` in Expo managed apps. (J#HYB-995)
4+
15
## 4.3.2 — 30 Apr 2026
26

37
- Updated the `getConfiguration` API to return the current `toolbarPosition`. (J#HYB-991)

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,41 @@ Nutrient.setLicenseKey('YOUR_REACT_NATIVE_LICENSE_KEY_GOES_HERE');
5353

5454
To install the Nutrient React Native SDK, run `yarn add @nutrient-sdk/react-native` in your project directory or `npm install @nutrient-sdk/react-native` if you’re using `npm`.
5555

56+
### Expo config plugin (Android)
57+
58+
When using Expo prebuild/dev client, add the package as a plugin so Android `AppTheme` is switched to a MaterialComponents-compatible theme:
59+
60+
```js
61+
// app.config.js
62+
export default {
63+
expo: {
64+
plugins: ['@nutrient-sdk/react-native'],
65+
},
66+
};
67+
```
68+
69+
The plugin defaults to an edge-to-edge-friendly DayNight parent (`@style/NutrientRN.AppTheme`). You can override it:
70+
71+
```js
72+
// app.config.js
73+
export default {
74+
expo: {
75+
plugins: [
76+
[
77+
'@nutrient-sdk/react-native',
78+
{
79+
androidThemePreset: 'fullNutrient',
80+
// or provide a fully custom parent:
81+
// androidAppThemeParent: '@style/YourCustomTheme',
82+
},
83+
],
84+
],
85+
},
86+
};
87+
```
88+
89+
After updating app config, run `npx expo prebuild -p android` (or rebuild with EAS).
90+
5691
### Getting Started
5792

5893
See our [Getting Started on React Native guide](https://www.nutrient.io/getting-started/react-native/?react-native-platform=android-ios&project=new-project) to integrate the SDK into your new or existing application, or follow the steps below:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<resources>
2+
<!--
3+
DayNight + MaterialComponents bridge app theme for Expo host activities.
4+
This includes the required attributes validated by Nutrient theme checks.
5+
-->
6+
<style name="NutrientRN.AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
7+
<item name="colorPrimary">@color/pspdf__primaryLight</item>
8+
<item name="colorPrimaryDark">@color/pspdf__onPrimaryContainerLight</item>
9+
<item name="colorAccent">?colorPrimaryDark</item>
10+
<item name="colorSecondary">@color/pspdf__primaryLight</item>
11+
<item name="windowActionBar">false</item>
12+
<item name="windowNoTitle">true</item>
13+
</style>
14+
</resources>

app.plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./plugin');

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nutrient-sdk/react-native",
3-
"version": "4.3.2",
3+
"version": "4.3.3",
44
"description": "Nutrient React Native SDK",
55
"keywords": [
66
"react native",
@@ -81,6 +81,8 @@
8181
},
8282

8383
"files": [
84+
"app.plugin.js",
85+
"plugin/",
8486
"ios/",
8587
"android/",
8688
"lib/",

plugin/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { createRunOncePlugin } = require('expo/config-plugins');
2+
const withNutrientAndroidTheme = require('./withNutrientAndroidTheme');
3+
const pkg = require('../package.json');
4+
5+
const withNutrient = (config, props = {}) => {
6+
config = withNutrientAndroidTheme(config, props);
7+
return config;
8+
};
9+
10+
module.exports = createRunOncePlugin(withNutrient, pkg.name, pkg.version);

plugin/withNutrientAndroidTheme.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const { withAndroidStyles } = require('expo/config-plugins');
2+
3+
const THEME_PRESET = {
4+
// DayNight + Bridge is the default because it is more robust with Expo edge-to-edge.
5+
edgeToEdge: '@style/NutrientRN.AppTheme',
6+
// Full Nutrient app theme for apps that want the SDK's complete default styling.
7+
fullNutrient: '@style/PSPDFKit.Theme.Default',
8+
};
9+
10+
function resolveThemeParent(props = {}) {
11+
if (typeof props.androidAppThemeParent === 'string' && props.androidAppThemeParent.length > 0) {
12+
return props.androidAppThemeParent;
13+
}
14+
15+
if (props.androidThemePreset && THEME_PRESET[props.androidThemePreset]) {
16+
return THEME_PRESET[props.androidThemePreset];
17+
}
18+
19+
return THEME_PRESET.edgeToEdge;
20+
}
21+
22+
function setAppThemeParent(styles, parent) {
23+
const styleList = styles?.resources?.style;
24+
if (!Array.isArray(styleList)) {
25+
console.warn(
26+
'[@nutrient-sdk/react-native] Could not find <resources><style> in Android styles.xml; AppTheme parent was not modified.'
27+
);
28+
return styles;
29+
}
30+
31+
const appTheme = styleList.find((style) => style?.$?.name === 'AppTheme');
32+
if (!appTheme || !appTheme.$) {
33+
console.warn(
34+
'[@nutrient-sdk/react-native] No <style name="AppTheme"> found in Android styles.xml; theme fix was not applied. Set `androidAppThemeParent` explicitly if your app uses a different theme name.'
35+
);
36+
return styles;
37+
}
38+
39+
appTheme.$.parent = parent;
40+
return styles;
41+
}
42+
43+
const withNutrientAndroidTheme = (config, props = {}) => {
44+
const themeParent = resolveThemeParent(props);
45+
46+
return withAndroidStyles(config, (config) => {
47+
config.modResults = setAppThemeParent(config.modResults, themeParent);
48+
return config;
49+
});
50+
};
51+
52+
module.exports = withNutrientAndroidTheme;

samples/Catalog/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PODS:
99
- hermes-engine/Pre-built (= 0.14.0)
1010
- hermes-engine/Pre-built (0.14.0)
1111
- Instant (26.6.0)
12-
- nutrient-sdk-react-native (4.3.2):
12+
- nutrient-sdk-react-native (4.3.3):
1313
- boost
1414
- DoubleConversion
1515
- fast_float
@@ -2961,7 +2961,7 @@ SPEC CHECKSUMS:
29612961
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
29622962
hermes-engine: 949f245610ade3c3701f96b679119dee1869e1b5
29632963
Instant: 95db4686c0be5e2953d8a80184ce4f239bcda5e5
2964-
nutrient-sdk-react-native: f4071354d6be77af130c79200d52a7c0be541757
2964+
nutrient-sdk-react-native: 483c4d9bf5b99dddff5cca2a33fbc7c304a1d6e0
29652965
PSPDFKit: 8b63d55bf7df1947f9b20319703f7153550b81b3
29662966
RCT-Folly: 59ec0ac1f2f39672a0c6e6cecdd39383b764646f
29672967
RCTDeprecation: a41bbdd9af30bf2e5715796b313e44ec43eefff1

samples/Catalog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "catalog",
3-
"version": "4.3.2",
3+
"version": "4.3.3",
44
"private": true,
55
"scripts": {
66
"android": "npx react-native run-android",

0 commit comments

Comments
 (0)