@react-native-ohos/sample-package
Version:
react native harmony sample package
45 lines (44 loc) • 1.71 kB
JavaScript
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/
import React from 'react';
import GeneratedSampleNativeComponent from './specs/ArkTSNativeComponent';
import { UIManager, findNodeHandle, processColor } from 'react-native';
export const GeneratedSampleComponentArkTS = /*#__PURE__*/React.forwardRef(({
children,
testProps: {
colorTest,
...otherTestProps
},
onDirectEvent,
onBubblingEvent
}, ref) => {
const nativeRef = React.useRef(null);
React.useImperativeHandle(ref, () => ({
emitNativeEvent(eventType) {
if (nativeRef !== null && nativeRef !== void 0 && nativeRef.current) {
UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), 'emitNativeEvent', [eventType, false]);
}
}
}), []);
return /*#__PURE__*/React.createElement(GeneratedSampleNativeComponent, _extends({
ref: nativeRef,
style: {
width: '100%',
height: 272
},
children: children
}, otherTestProps, {
colorTest: processColor(colorTest),
onBubblingEvent: e => {
onBubblingEvent === null || onBubblingEvent === void 0 || onBubblingEvent(e.nativeEvent);
},
onDirectEvent: e => {
onDirectEvent === null || onDirectEvent === void 0 || onDirectEvent(e.nativeEvent);
}
}));
});
//# sourceMappingURL=ArkTSFabric.js.map