fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,85 @@
import { createElement, Fragment } from "react";
/**
* External dependencies
*/
import { View } from 'react-native';
/**
* WordPress dependencies
*/
import { useNavigation } from '@react-navigation/native';
import { useState } from '@wordpress/element';
import { Icon, chevronRight, check } from '@wordpress/icons';
import { __, sprintf } from '@wordpress/i18n';
import { BottomSheet } from '@wordpress/components';
/**
* Internal dependencies
*/
import styles from './style.scss';
const BottomSheetSelectControl = ({
label,
icon,
options: items,
onChange,
value: selectedValue,
disabled
}) => {
const [showSubSheet, setShowSubSheet] = useState(false);
const navigation = useNavigation();
const onChangeValue = value => {
return () => {
goBack();
onChange(value);
};
};
const selectedOption = items.find(option => option.value === selectedValue);
const goBack = () => {
setShowSubSheet(false);
navigation.goBack();
};
const openSubSheet = () => {
navigation.navigate(BottomSheet.SubSheet.screenName);
setShowSubSheet(true);
};
return createElement(BottomSheet.SubSheet, {
navigationButton: createElement(BottomSheet.Cell, {
label: label,
separatorType: "none",
icon: icon,
value: selectedOption.label,
onPress: openSubSheet,
accessibilityRole: 'button',
accessibilityLabel: sprintf(
// translators: %1$s: Select control button label e.g. "Button width". %2$s: Select control option value e.g: "Auto, 25%".
__('%1$s. Currently selected: %2$s'), label, selectedOption.label),
accessibilityHint: sprintf(
// translators: %s: Select control button label e.g. "Button width"
__('Navigates to select %s'), label),
disabled: disabled
}, disabled ? null : createElement(Icon, {
icon: chevronRight
})),
showSheet: showSubSheet
}, createElement(Fragment, null, createElement(BottomSheet.NavBar, null, createElement(BottomSheet.NavBar.BackButton, {
onPress: goBack
}), createElement(BottomSheet.NavBar.Heading, null, label)), createElement(View, {
style: styles.selectControl
}, items.map((item, index) => createElement(BottomSheet.Cell, {
customActionButton: true,
separatorType: "none",
label: item.label,
icon: item.icon,
onPress: onChangeValue(item.value),
leftAlign: true,
key: index,
accessibilityRole: 'button',
accessibilityLabel: item.value === selectedValue ? sprintf(
// translators: %s: Select control option value e.g: "Auto, 25%".
__('Selected: %s'), item.label) : item.label,
accessibilityHint: __('Double tap to select')
}, item.value === selectedValue && createElement(Icon, {
icon: check
}))))));
};
export default BottomSheetSelectControl;
//# sourceMappingURL=index.native.js.map

File diff suppressed because one or more lines are too long