I've looked through what I could find on this but as far as I can tell I am doing things correctly.
My configStore.js looks like this:
import diaryReducer from '../reducers/diaryReducer';
[..]
const diaryPersistConfig = {
key: 'diary',
storage: storage,
keyPrefix: '',
blacklist: ['loading', 'uploadModalVisible', 'monthModalVisible', 'editModalVisible', 'entryUploading', 'deleteEntryDisabled']
};
[..]
const persistedReducer = persistReducer(persistConfig, combineReducers({
auth: persistReducer(authPersistConfig, authReducer),
diary: persistReducer(diaryPersistConfig, diaryReducer)
}));
My diaryreducer.js looks like this:
const diaryDefaultState = {
loading: false,
uploadModalVisible: false,
monthModalVisible: false,
editModalVisible: false,
entryUploading: false,
deleteEntryDisabled: false,
entries: []
};
export default (state = diaryDefaultState, action) => {
switch (action.type) {
case 'ENTRIES_LOADING':
return {
...state,
loading: true
};
[..others, don't think these are important for storage, just use during run?..]
And Diary.js looks like this:
//in render()
<Modal
animationType="slide"
onRequestClose={this.onCloseModal}
transparent={false}
visible={this.props.uploadModalVisible}
>
[....]
const mapStateToProps = (state) => {
return {
user: state.auth.user,
loading: state.diary.loading,
uploadModalVisible: state.diary.uploadModalVisible,
monthModalVisible: state.diary.monthModalVisible,
editModalVisible: state.diary.editModalVisible,
entryUploading: state.diary.entryUploading,
deleteEntryDisabled: state.diary.deleteEntryDisabled,
entries: state.diary.entries
};
};
uploadModalVisible is being persisted so when I leave the app while it is open, the value is still true and it is visible when I return to that page after re-launching the app.
As far as I can tell I'm using the blacklist correctly but it's not working for me. Can anyone see what I've done wrong?