This repository has been archived by the owner on Apr 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Changelog
Alec Aivazis edited this page Dec 29, 2016
·
14 revisions
This page describes various changes in the API as well as the migration path to each version where applicable.
The initial media type can be set with the initialMediaType
argument to the reducer factory.
This version introduced a number of changes into the codebase resulting in a much more performant experience for the general user as well as adding increased support for adapting the responsive state to fit your particular use case.
-
calculateStateInitially
is nowcalculateInitialState
-
performanceMode
is now default (no more throttled handler or associated options)
- no more height/width (see README for instructions on migration forward)
- Added
is
field to responsiveState (browser.is.small
<=>browser.mediaType === "small"
) - ReducerFactory now accepts options as second argument (after breakpoints)
-
infinityType
argument is now theinfinity
field of the argument - user-defined fields can be added to the responsive state with the
extraFields
option which is defined as a function that takes the current responsive state and returns the new fields to add (is spread over old state so user could also overwrite values if they wanted)
- Added
performanceMode
to store enhancer factory. See documentation for more details.
- Added support for non-react environments by moving the StyleSheet higher-order component to
redux-responsive/react
. Removed "orEqual" variations to reduce computations when browser is resizing.
- added "orEqual" variations in responsive state to remove coupling across breakpoints (ie, not having to remember "superLarge" comes right after "larger")
- added StyleSheet higher-order component. See readme for details.
-
addResponsiveHandlers
was removed (previously deprecated) in favor ofresponsiveStoreEnchaner
. - enhancer factory options are now passed as an object, instead of arguments.
- Examples:
import {responsiveStoreEnhancer} from 'redux-responsive'
// adding the store enhancer to the factory
const store = createStore(
reducer,
compose(
responsiveStoreEnhancer,
applyMiddlewares(middleware1, middleware2)
)
)
// passing configuration options to the factory
import {createResponsiveStoreEnhancer} from 'redux-responsive'
const store = createStore(
reducer,
compose(
createResponsiveStoreEnhancer({throttleTime: 400}), // used to be createResponsiveStoreEnhancer(400)
applyMiddlewares(middleware1, middleware2)
)
)