@dynatrace/react-native-plugin
Version:
This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.
51 lines (50 loc) • 2.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNameForType = exports.isTypeTouchable = exports.isTypeGestureHandlerTouchable = exports.isTypeReactNativeTouchable = void 0;
const Types_1 = require("./Types");
const isTypeReactNativeTouchable = (type) => type === Types_1.Types.TouchableHighlight ||
type === Types_1.Types.TouchableNativeFeedback ||
type === Types_1.Types.TouchableOpacity ||
type === Types_1.Types.TouchableWithoutFeedback;
exports.isTypeReactNativeTouchable = isTypeReactNativeTouchable;
const isTypeGestureHandlerTouchable = (type) => type === Types_1.Types.TouchableHighlightGestureHandler ||
type === Types_1.Types.TouchableNativeFeedbackGestureHandler ||
type === Types_1.Types.TouchableOpacityGestureHandler ||
type === Types_1.Types.TouchableWithoutFeedbackGestureHandler ||
type === Types_1.Types.RectButtonGestureHandler;
exports.isTypeGestureHandlerTouchable = isTypeGestureHandlerTouchable;
const isTypeTouchable = (type) => (0, exports.isTypeGestureHandlerTouchable)(type) || (0, exports.isTypeReactNativeTouchable)(type);
exports.isTypeTouchable = isTypeTouchable;
const getNameForType = (type) => {
switch (type) {
case Types_1.Types.Button:
case Types_1.Types.RectButtonGestureHandler:
return 'Button';
case Types_1.Types.Text:
return 'Text';
case Types_1.Types.TouchableHighlight:
case Types_1.Types.TouchableNativeFeedback:
case Types_1.Types.TouchableOpacity:
case Types_1.Types.TouchableWithoutFeedback:
case Types_1.Types.TouchableHighlightGestureHandler:
case Types_1.Types.TouchableNativeFeedbackGestureHandler:
case Types_1.Types.TouchableOpacityGestureHandler:
case Types_1.Types.TouchableWithoutFeedbackGestureHandler:
return 'Touchable';
case Types_1.Types.Pressable:
return 'Pressable';
case Types_1.Types.Picker:
return 'Picker';
case Types_1.Types.RefreshControl:
return 'Refresh Control';
case Types_1.Types.Switch:
return 'Switch';
case Types_1.Types.ClassComponent:
return 'Class Component';
case Types_1.Types.FunctionalComponent:
return 'Functional Component';
default:
return 'Undefined';
}
};
exports.getNameForType = getNameForType;