react-native-unit-components
Version:
Unit React Native components
74 lines (73 loc) • 2.97 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setShouldShowBottomSheet = exports.setShouldEnableBottomSheetScroll = exports.setScrollState = exports.setNativePlace = exports.setIsComponentLoading = exports.setIsBottomSheetActive = exports.setComponentHeight = exports.selectConfiguration = exports.resetBottomSheetSlice = exports.default = void 0;
var _toolkit = require("@reduxjs/toolkit");
var _bottomSheet = require("../types/internal/bottomSheet.types");
const initialState = {
isBottomSheetActive: false,
isComponentLoading: false,
shouldShowBottomSheet: false,
shouldEnableBottomSheetScroll: true,
nativePlace: _bottomSheet.BottomSheetNativePlaceType.overFullScreen,
componentHeight: 0
};
const BottomSheetSlice = (0, _toolkit.createSlice)({
name: 'BottomSheet',
initialState: initialState,
reducers: {
setIsBottomSheetActive(state, action) {
state.isBottomSheetActive = action.payload;
},
setIsComponentLoading(state, action) {
state.isComponentLoading = action.payload;
},
setShouldShowBottomSheet(state, action) {
state.shouldShowBottomSheet = action.payload;
},
setNativePlace(state, action) {
state.nativePlace = action.payload;
},
setComponentHeight(state, action) {
state.componentHeight = action.payload;
},
setShouldEnableBottomSheetScroll(state, action) {
state.shouldEnableBottomSheetScroll = action.payload;
},
setScrollState(state, action) {
state.scrollState = action.payload;
},
resetBottomSheetSlice(state) {
//resets all besides is active to avoid loops in useEffects invoked by closing the flow
state.isComponentLoading = initialState.isComponentLoading;
state.shouldShowBottomSheet = initialState.shouldShowBottomSheet;
state.nativePlace = initialState.nativePlace;
state.componentHeight = initialState.componentHeight;
state.shouldEnableBottomSheetScroll = initialState.shouldEnableBottomSheetScroll;
state.scrollState = initialState.scrollState;
}
}
});
const {
setIsBottomSheetActive,
setIsComponentLoading,
setShouldShowBottomSheet,
setNativePlace,
setComponentHeight,
setShouldEnableBottomSheetScroll,
setScrollState,
resetBottomSheetSlice
} = BottomSheetSlice.actions;
exports.resetBottomSheetSlice = resetBottomSheetSlice;
exports.setScrollState = setScrollState;
exports.setShouldEnableBottomSheetScroll = setShouldEnableBottomSheetScroll;
exports.setComponentHeight = setComponentHeight;
exports.setNativePlace = setNativePlace;
exports.setShouldShowBottomSheet = setShouldShowBottomSheet;
exports.setIsComponentLoading = setIsComponentLoading;
exports.setIsBottomSheetActive = setIsBottomSheetActive;
const selectConfiguration = state => state.bottomSheet;
exports.selectConfiguration = selectConfiguration;
var _default = exports.default = BottomSheetSlice.reducer;
//# sourceMappingURL=BottomSheetSlice.js.map
;