Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
102 lines
3.2 KiB
JavaScript
102 lines
3.2 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
var _react = require("react");
|
|
var _reactNative = require("react-native");
|
|
var _blur = require("@react-native-community/blur");
|
|
var _element = require("@wordpress/element");
|
|
var _compose = require("@wordpress/compose");
|
|
var _style = _interopRequireDefault(require("./style.scss"));
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const HIDE_TIMER = 3000;
|
|
const Notice = ({
|
|
onNoticeHidden,
|
|
content,
|
|
id,
|
|
status
|
|
}) => {
|
|
const {
|
|
width
|
|
} = (0, _reactNative.useWindowDimensions)();
|
|
const animationValue = (0, _element.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
const timer = (0, _element.useRef)(null);
|
|
(0, _element.useEffect)(() => {
|
|
// start animation
|
|
_reactNative.Animated.timing(animationValue, {
|
|
toValue: 1,
|
|
duration: 300,
|
|
useNativeDriver: true,
|
|
easing: _reactNative.Easing.out(_reactNative.Easing.quad)
|
|
}).start(({
|
|
finished
|
|
}) => {
|
|
if (finished && onNoticeHidden) {
|
|
timer.current = setTimeout(() => {
|
|
onHide();
|
|
}, HIDE_TIMER);
|
|
}
|
|
});
|
|
return () => {
|
|
clearTimeout(timer?.current);
|
|
};
|
|
}, [animationValue, onHide, onNoticeHidden]);
|
|
const onHide = (0, _element.useCallback)(() => {
|
|
_reactNative.Animated.timing(animationValue, {
|
|
toValue: 0,
|
|
duration: 150,
|
|
useNativeDriver: true,
|
|
easing: _reactNative.Easing.out(_reactNative.Easing.quad)
|
|
}).start(({
|
|
finished
|
|
}) => {
|
|
if (finished && onNoticeHidden) {
|
|
onNoticeHidden(id);
|
|
}
|
|
});
|
|
}, [animationValue, onNoticeHidden, id]);
|
|
const noticeSolidStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.noticeSolid, _style.default.noticeSolidDark);
|
|
const successTextStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.successText, _style.default.successTextDark);
|
|
const errorTextStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.errorText, _style.default.errorTextDark);
|
|
const textStyles = [status === 'success' && successTextStyles, status === 'error' && errorTextStyles];
|
|
const containerStyles = [_style.default.notice, !_element.Platform.isIOS && noticeSolidStyles, {
|
|
width,
|
|
transform: [{
|
|
translateY: animationValue.interpolate({
|
|
inputRange: [0, 1],
|
|
outputRange: [-24, 0]
|
|
})
|
|
}]
|
|
}];
|
|
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_reactNative.Animated.View, {
|
|
style: containerStyles
|
|
}, (0, _react.createElement)(_reactNative.TouchableWithoutFeedback, {
|
|
onPress: onHide
|
|
}, (0, _react.createElement)(_reactNative.View, {
|
|
style: _style.default.noticeContent
|
|
}, (0, _react.createElement)(_reactNative.Text, {
|
|
numberOfLines: 3,
|
|
style: textStyles
|
|
}, content))), _element.Platform.isIOS && (0, _react.createElement)(_blur.BlurView, {
|
|
style: _style.default.blurBackground,
|
|
blurType: "prominent",
|
|
blurAmount: 10
|
|
})));
|
|
};
|
|
var _default = Notice;
|
|
exports.default = _default;
|
|
//# sourceMappingURL=index.native.js.map
|