@rific/auto-paper 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,18 +17,21 @@ Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-na
17
17
  npm install @rific/auto-paper
18
18
  ```
19
19
 
20
- Peer dependencies:
20
+ Required peer dependency:
21
21
 
22
22
  ```bash
23
- npm install react-native react-native-paper
23
+ npm install react-native-paper
24
24
  ```
25
25
 
26
- Optional — needed only if you use `BottomNavigation` on Android (syncs the system navigation bar color):
26
+ Optional peer dependencies:
27
27
 
28
28
  ```bash
29
- npm install expo-navigation-bar
29
+ npm install expo-blur # frosted-glass BlurView; without it BlurView renders its solid (non-blur) fallback
30
+ npm install expo-navigation-bar # (>= 56.0.0, SDK 54+) auto-syncs Android nav bar icon style to the theme when BottomNavigation is mounted
30
31
  ```
31
32
 
33
+ The exported Redux slice has no dependency on `@reduxjs/toolkit` — it works with RTK stores, vanilla Redux, or no Redux at all.
34
+
32
35
  ## Usage
33
36
 
34
37
  ### Provider (simplest)
@@ -194,6 +197,7 @@ export default function App() {
194
197
  | `onChange` | `(settings: ThemeSettings) => void` | Called whenever settings change via `useThemeSettings().set()` |
195
198
  | `children` | `ReactNode` | |
196
199
  | `defaults` | `PaperDefaults` | Prop defaults for wrapper components (see below) |
200
+ | `onNavBarChange` | `(color: string, dark: boolean) => void` | Overrides the built-in nav bar sync: called on Android when the theme changes while a `BottomNavigation` is mounted, instead of the automatic `expo-navigation-bar` icon-style sync |
197
201
  | `onReady` | `() => void` | Called once when the theme first resolves |
198
202
  | `statusBarProps` | `StatusBarProps` | Spread over the auto-derived `StatusBar` defaults |
199
203
  | `style` | `StyleProp<ViewStyle>` | Applied to the wrapper `View` |
@@ -249,7 +253,7 @@ import { Appbar } from '@rific/auto-paper'
249
253
 
250
254
  ### `BottomNavigation`
251
255
 
252
- A thin wrapper around `react-native-paper`'s `BottomNavigation` that automatically syncs the Android system navigation bar color and button style to the current theme surface color (requires `expo-navigation-bar`; silently no-ops when not installed).
256
+ A thin wrapper around `react-native-paper`'s `BottomNavigation` that keeps the Android system navigation bar icons readable: when the optional `expo-navigation-bar` peer is installed, the icon style automatically follows the theme's darkness (edge-to-edge safe — no background color calls). Pass `onNavBarChange` to the `Provider` to take full control instead; with neither, it silently no-ops.
253
257
 
254
258
  ```tsx
255
259
  import { BottomNavigation } from '@rific/auto-paper'
@@ -340,7 +344,7 @@ createThemeReducer({ color: '#4caf50' })
340
344
  ### Redux exports
341
345
 
342
346
  ```ts
343
- import { themeReducer, themeActions, selectThemeAppearance, selectThemeColor } from '@rific/auto-paper'
347
+ import { themeReducer, themeActions, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony } from '@rific/auto-paper'
344
348
  import type { ThemeState, ThemeAppearance } from '@rific/auto-paper'
345
349
  ```
346
350
 
@@ -348,7 +352,9 @@ import type { ThemeState, ThemeAppearance } from '@rific/auto-paper'
348
352
  |---|---|
349
353
  | `initialize` | `Partial<ThemeState>` |
350
354
  | `setAppearance` | `ThemeAppearance` |
355
+ | `setBlur` | `boolean` |
351
356
  | `setColor` | `string` |
357
+ | `setHarmony` | `ColorHarmony` |
352
358
 
353
359
  Selectors accept `ThemeState` directly — compose them with your root state selector:
354
360
 
package/dist/index.d.mts CHANGED
@@ -7,9 +7,6 @@ export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, Button
7
7
  import * as react from 'react';
8
8
  import react__default, { ReactNode } from 'react';
9
9
  import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
10
- import * as _reduxjs_toolkit from '@reduxjs/toolkit';
11
- import { PayloadAction } from '@reduxjs/toolkit';
12
- import * as redux from 'redux';
13
10
 
14
11
  declare function useBlur(override?: boolean): boolean;
15
12
 
@@ -140,45 +137,53 @@ type ThemeState = {
140
137
  color: string;
141
138
  harmony: ColorHarmony;
142
139
  };
143
- declare function createThemeReducer(initialState?: Partial<ThemeState>): redux.Reducer<{
144
- appearance: ThemeAppearance;
145
- blur: boolean;
146
- color: string;
147
- harmony: ColorHarmony;
148
- }>;
149
- declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
150
- initialize: (state: ThemeState, action: PayloadAction<Partial<ThemeState>>) => {
151
- appearance: ThemeAppearance;
152
- blur: boolean;
153
- color: string;
154
- harmony: ColorHarmony;
140
+ type PayloadAction<P> = {
141
+ payload: P;
142
+ type: string;
143
+ };
144
+ declare const themeActions: {
145
+ initialize: {
146
+ (payload: Partial<ThemeState>): PayloadAction<Partial<ThemeState>>;
147
+ type: string;
148
+ match(action: {
149
+ type: string;
150
+ }): action is PayloadAction<Partial<ThemeState>>;
155
151
  };
156
- setAppearance: (state: ThemeState, action: PayloadAction<ThemeAppearance>) => {
157
- appearance: ThemeAppearance;
158
- blur: boolean;
159
- color: string;
160
- harmony: ColorHarmony;
152
+ setAppearance: {
153
+ (payload: ThemeAppearance): PayloadAction<ThemeAppearance>;
154
+ type: string;
155
+ match(action: {
156
+ type: string;
157
+ }): action is PayloadAction<ThemeAppearance>;
161
158
  };
162
- setBlur: (state: ThemeState, action: PayloadAction<boolean>) => {
163
- blur: boolean;
164
- appearance: ThemeAppearance;
165
- color: string;
166
- harmony: ColorHarmony;
159
+ setBlur: {
160
+ (payload: boolean): PayloadAction<boolean>;
161
+ type: string;
162
+ match(action: {
163
+ type: string;
164
+ }): action is PayloadAction<boolean>;
167
165
  };
168
- setColor: (state: ThemeState, action: PayloadAction<string>) => {
169
- color: string;
170
- appearance: ThemeAppearance;
171
- blur: boolean;
172
- harmony: ColorHarmony;
166
+ setColor: {
167
+ (payload: string): PayloadAction<string>;
168
+ type: string;
169
+ match(action: {
170
+ type: string;
171
+ }): action is PayloadAction<string>;
173
172
  };
174
- setHarmony: (state: ThemeState, action: PayloadAction<ColorHarmony>) => {
175
- harmony: ColorHarmony;
176
- appearance: ThemeAppearance;
177
- blur: boolean;
178
- color: string;
173
+ setHarmony: {
174
+ (payload: ColorHarmony): PayloadAction<ColorHarmony>;
175
+ type: string;
176
+ match(action: {
177
+ type: string;
178
+ }): action is PayloadAction<ColorHarmony>;
179
179
  };
180
- }, "theme">;
181
- declare const themeReducer: redux.Reducer<ThemeState>;
180
+ };
181
+ declare function createThemeReducer(initialState?: Partial<ThemeState>): (state: ThemeState | undefined, action: {
182
+ type: string;
183
+ }) => ThemeState;
184
+ declare const themeReducer: (state: ThemeState | undefined, action: {
185
+ type: string;
186
+ }) => ThemeState;
182
187
  declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
183
188
  declare const selectThemeBlur: (state: ThemeState) => boolean;
184
189
  declare const selectThemeColor: (state: ThemeState) => string;
package/dist/index.d.ts CHANGED
@@ -7,9 +7,6 @@ export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, Button
7
7
  import * as react from 'react';
8
8
  import react__default, { ReactNode } from 'react';
9
9
  import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
10
- import * as _reduxjs_toolkit from '@reduxjs/toolkit';
11
- import { PayloadAction } from '@reduxjs/toolkit';
12
- import * as redux from 'redux';
13
10
 
14
11
  declare function useBlur(override?: boolean): boolean;
15
12
 
@@ -140,45 +137,53 @@ type ThemeState = {
140
137
  color: string;
141
138
  harmony: ColorHarmony;
142
139
  };
143
- declare function createThemeReducer(initialState?: Partial<ThemeState>): redux.Reducer<{
144
- appearance: ThemeAppearance;
145
- blur: boolean;
146
- color: string;
147
- harmony: ColorHarmony;
148
- }>;
149
- declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
150
- initialize: (state: ThemeState, action: PayloadAction<Partial<ThemeState>>) => {
151
- appearance: ThemeAppearance;
152
- blur: boolean;
153
- color: string;
154
- harmony: ColorHarmony;
140
+ type PayloadAction<P> = {
141
+ payload: P;
142
+ type: string;
143
+ };
144
+ declare const themeActions: {
145
+ initialize: {
146
+ (payload: Partial<ThemeState>): PayloadAction<Partial<ThemeState>>;
147
+ type: string;
148
+ match(action: {
149
+ type: string;
150
+ }): action is PayloadAction<Partial<ThemeState>>;
155
151
  };
156
- setAppearance: (state: ThemeState, action: PayloadAction<ThemeAppearance>) => {
157
- appearance: ThemeAppearance;
158
- blur: boolean;
159
- color: string;
160
- harmony: ColorHarmony;
152
+ setAppearance: {
153
+ (payload: ThemeAppearance): PayloadAction<ThemeAppearance>;
154
+ type: string;
155
+ match(action: {
156
+ type: string;
157
+ }): action is PayloadAction<ThemeAppearance>;
161
158
  };
162
- setBlur: (state: ThemeState, action: PayloadAction<boolean>) => {
163
- blur: boolean;
164
- appearance: ThemeAppearance;
165
- color: string;
166
- harmony: ColorHarmony;
159
+ setBlur: {
160
+ (payload: boolean): PayloadAction<boolean>;
161
+ type: string;
162
+ match(action: {
163
+ type: string;
164
+ }): action is PayloadAction<boolean>;
167
165
  };
168
- setColor: (state: ThemeState, action: PayloadAction<string>) => {
169
- color: string;
170
- appearance: ThemeAppearance;
171
- blur: boolean;
172
- harmony: ColorHarmony;
166
+ setColor: {
167
+ (payload: string): PayloadAction<string>;
168
+ type: string;
169
+ match(action: {
170
+ type: string;
171
+ }): action is PayloadAction<string>;
173
172
  };
174
- setHarmony: (state: ThemeState, action: PayloadAction<ColorHarmony>) => {
175
- harmony: ColorHarmony;
176
- appearance: ThemeAppearance;
177
- blur: boolean;
178
- color: string;
173
+ setHarmony: {
174
+ (payload: ColorHarmony): PayloadAction<ColorHarmony>;
175
+ type: string;
176
+ match(action: {
177
+ type: string;
178
+ }): action is PayloadAction<ColorHarmony>;
179
179
  };
180
- }, "theme">;
181
- declare const themeReducer: redux.Reducer<ThemeState>;
180
+ };
181
+ declare function createThemeReducer(initialState?: Partial<ThemeState>): (state: ThemeState | undefined, action: {
182
+ type: string;
183
+ }) => ThemeState;
184
+ declare const themeReducer: (state: ThemeState | undefined, action: {
185
+ type: string;
186
+ }) => ThemeState;
182
187
  declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
183
188
  declare const selectThemeBlur: (state: ThemeState) => boolean;
184
189
  declare const selectThemeColor: (state: ThemeState) => string;