UNPKG

@uifabric/experiments

Version:

Experimental React components for building experiences for Microsoft 365.

19 lines 1.21 kB
define(["require", "exports", "tslib", "react", "office-ui-fabric-react"], function (require, exports, tslib_1, react_1, office_ui_fabric_react_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.usePersonaCoinState = function (props) { // TODO: isPictureLoaded was controlled, does it need to be? it's not exposed through component props... // For now use useState. var _a = react_1.useState(false), isPictureLoaded = _a[0], setIsPictureLoaded = _a[1]; var onPhotoLoadingStateChange = props.onPhotoLoadingStateChange; var _onPhotoLoadingStateChange = react_1.useCallback(function (newImageLoadState) { if (onPhotoLoadingStateChange) { onPhotoLoadingStateChange(newImageLoadState); } setIsPictureLoaded(newImageLoadState === office_ui_fabric_react_1.ImageLoadState.loaded); }, [onPhotoLoadingStateChange]); var viewProps = tslib_1.__assign(tslib_1.__assign({}, props), { isPictureLoaded: isPictureLoaded, onPhotoLoadingStateChange: _onPhotoLoadingStateChange }); return viewProps; }; }); //# sourceMappingURL=PersonaCoin.state.js.map