已开启
test:react-native-nfc-manager 82demo提交 #706
hewanglong创建于 1月24日
test:react-native-nfc-manager 82demo提交 #706
已开启
共 8 个文件变更+18-16
| @@ -43,7 +43,7 @@ | |||
| 43 | // "@react-native-ohos/react-native-system-setting": "../../node_modules/@react-native-ohos/react-native-system-setting/harmony/react_native_system_setting.har", | 43 | // "@react-native-ohos/react-native-system-setting": "../../node_modules/@react-native-ohos/react-native-system-setting/harmony/react_native_system_setting.har", |
| 44 | // "@react-native-ohos/react-native-keyboard-controller": "file:../../node_modules/@react-native-ohos/react-native-keyboard-controller/harmony/keyboard_controller.har", | 44 | // "@react-native-ohos/react-native-keyboard-controller": "file:../../node_modules/@react-native-ohos/react-native-keyboard-controller/harmony/keyboard_controller.har", |
| 45 | // "@react-native-ohos/react-native-text-input-mask": "file:../../node_modules/@react-native-ohos/react-native-text-input-mask/harmony/text_input_mask.har", | 45 | // "@react-native-ohos/react-native-text-input-mask": "file:../../node_modules/@react-native-ohos/react-native-text-input-mask/harmony/text_input_mask.har", |
| 46 | -// "@react-native-ohos/react-native-nfc-manager": "file:../../node_modules/@react-native-ohos/react-native-nfc-manager/harmony/nfc_manager.har", | 46 | + "@react-native-ohos/react-native-nfc-manager": "file:../../node_modules/@react-native-ohos/react-native-nfc-manager/harmony/nfc_manager.har", |
| 47 | // "@react-native-ohos/react-native-haptic-feedback": "file:../../node_modules/@react-native-ohos/react-native-haptic-feedback/harmony/haptic_feedback.har", | 47 | // "@react-native-ohos/react-native-haptic-feedback": "file:../../node_modules/@react-native-ohos/react-native-haptic-feedback/harmony/haptic_feedback.har", |
| 48 | // "@react-native-ohos/react-native-custom-keyboard": "file:../../node_modules/@react-native-ohos/react-native-custom-keyboard/harmony/custom_keyboard.har", | 48 | // "@react-native-ohos/react-native-custom-keyboard": "file:../../node_modules/@react-native-ohos/react-native-custom-keyboard/harmony/custom_keyboard.har", |
| 49 | // "@react-native-ohos/react-native-idle-timer": "file:../../node_modules/@react-native-ohos/react-native-idle-timer/harmony/idle_timer.har", | 49 | // "@react-native-ohos/react-native-idle-timer": "file:../../node_modules/@react-native-ohos/react-native-idle-timer/harmony/idle_timer.har", |
| @@ -52,7 +52,7 @@ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-crop-picke | |||
| 52 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-system-setting/src/main/cpp" ./system-setting) | 52 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-system-setting/src/main/cpp" ./system-setting) |
| 53 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-keyboard-controller/src/main/cpp" ./keyboard-controller) | 53 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-keyboard-controller/src/main/cpp" ./keyboard-controller) |
| 54 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) | 54 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) |
| 55 | -#add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-nfc-manager/src/main/cpp" ./nfc-manager) | 55 | +add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-nfc-manager/src/main/cpp" ./nfc-manager) |
| 56 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-haptic-feedback/src/main/cpp" ./haptic-feedback) | 56 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-haptic-feedback/src/main/cpp" ./haptic-feedback) |
| 57 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-custom-keyboard/src/main/cpp" ./custom-keyboard) | 57 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-custom-keyboard/src/main/cpp" ./custom-keyboard) |
| 58 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-idle-timer/src/main/cpp" ./idle-timer) | 58 | #add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-idle-timer/src/main/cpp" ./idle-timer) |
| @@ -124,7 +124,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh_image_crop_picker) | |||
| 124 | #target_link_libraries(rnoh_app PUBLIC rnoh_system_setting) | 124 | #target_link_libraries(rnoh_app PUBLIC rnoh_system_setting) |
| 125 | #target_link_libraries(rnoh_app PUBLIC rnoh_keyboard_controller) | 125 | #target_link_libraries(rnoh_app PUBLIC rnoh_keyboard_controller) |
| 126 | #target_link_libraries(rnoh_app PUBLIC text_input_mask) | 126 | #target_link_libraries(rnoh_app PUBLIC text_input_mask) |
| 127 | -#target_link_libraries(rnoh_app PUBLIC rnoh_nfc_manager) | 127 | +target_link_libraries(rnoh_app PUBLIC rnoh_nfc_manager) |
| 128 | #target_link_libraries(rnoh_app PUBLIC rnoh_haptic_feedback) | 128 | #target_link_libraries(rnoh_app PUBLIC rnoh_haptic_feedback) |
| 129 | #target_link_libraries(rnoh_app PUBLIC rnoh_custom_keyboard_package) | 129 | #target_link_libraries(rnoh_app PUBLIC rnoh_custom_keyboard_package) |
| 130 | #target_link_libraries(rnoh_app PUBLIC rnoh_idle_timer) | 130 | #target_link_libraries(rnoh_app PUBLIC rnoh_idle_timer) |
| @@ -37,7 +37,7 @@ | |||
| 37 | //#include "RNSystemSettingPackage.h" | 37 | //#include "RNSystemSettingPackage.h" |
| 38 | //#include "keyboardControllerPackage.h" | 38 | //#include "keyboardControllerPackage.h" |
| 39 | //#include "RNTextInputMaskPackage.h" | 39 | //#include "RNTextInputMaskPackage.h" |
| 40 | -//#include "NfcManagerPackage.h" | 40 | +#include "NfcManagerPackage.h" |
| 41 | //#include "RNHapticFeedbackPackage.h" | 41 | //#include "RNHapticFeedbackPackage.h" |
| 42 | //#include "CustomKeyboardPackage.h" | 42 | //#include "CustomKeyboardPackage.h" |
| 43 | //#include "IdleTimerRNOHGeneratedPackage.h" | 43 | //#include "IdleTimerRNOHGeneratedPackage.h" |
| @@ -98,7 +98,7 @@ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Cont | |||
| 98 | // std::make_shared<RNSystemSettingPackage>(ctx), | 98 | // std::make_shared<RNSystemSettingPackage>(ctx), |
| 99 | // std::make_shared<KeyboardControllerPackage>(ctx), | 99 | // std::make_shared<KeyboardControllerPackage>(ctx), |
| 100 | // std::make_shared<RNTextInputMaskPackage>(ctx), | 100 | // std::make_shared<RNTextInputMaskPackage>(ctx), |
| 101 | -// std::make_shared<NfcManagerPackage>(ctx), | 101 | + std::make_shared<NfcManagerPackage>(ctx), |
| 102 | // std::make_shared<RNHapticFeedbackPackage>(ctx), | 102 | // std::make_shared<RNHapticFeedbackPackage>(ctx), |
| 103 | // std::make_shared<CustomKeyboardPackage>(ctx), | 103 | // std::make_shared<CustomKeyboardPackage>(ctx), |
| 104 | // std::make_shared<IdleTimerRNOHGeneratedPackage>(ctx), | 104 | // std::make_shared<IdleTimerRNOHGeneratedPackage>(ctx), |
| @@ -31,7 +31,7 @@ import { ImageCropPickerPackage } from '@react-native-ohos/react-native-image-cr | |||
| 31 | // import { RNSystemSettingPackage } from '@react-native-ohos/react-native-system-setting/ts'; | 31 | // import { RNSystemSettingPackage } from '@react-native-ohos/react-native-system-setting/ts'; |
| 32 | // import { RNKeyboardControllerPackage, RNStatusBarManagerCompatPackage } from "@react-native-ohos/react-native-keyboard-controller/ts"; | 32 | // import { RNKeyboardControllerPackage, RNStatusBarManagerCompatPackage } from "@react-native-ohos/react-native-keyboard-controller/ts"; |
| 33 | // import { RNTextInputMaskPackage } from '@react-native-ohos/react-native-text-input-mask/ts'; | 33 | // import { RNTextInputMaskPackage } from '@react-native-ohos/react-native-text-input-mask/ts'; |
| 34 | -// import { RNNfcManagerPackage } from '@react-native-ohos/react-native-nfc-manager/ts'; | 34 | + import { RNNfcManagerPackage } from '@react-native-ohos/react-native-nfc-manager/ts'; |
| 35 | // import { RNHapticFeedbackPackage } from '@react-native-ohos/react-native-haptic-feedback/ts'; | 35 | // import { RNHapticFeedbackPackage } from '@react-native-ohos/react-native-haptic-feedback/ts'; |
| 36 | // import { RNCustomKeyboardPackage } from '@react-native-ohos/react-native-custom-keyboard/ts'; | 36 | // import { RNCustomKeyboardPackage } from '@react-native-ohos/react-native-custom-keyboard/ts'; |
| 37 | // import { RNIdleTimerPackage } from '@react-native-ohos/react-native-idle-timer/ts'; | 37 | // import { RNIdleTimerPackage } from '@react-native-ohos/react-native-idle-timer/ts'; |
| @@ -86,7 +86,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { | |||
| 86 | // new RNKeyboardControllerPackage(ctx), | 86 | // new RNKeyboardControllerPackage(ctx), |
| 87 | // new RNStatusBarManagerCompatPackage(ctx), | 87 | // new RNStatusBarManagerCompatPackage(ctx), |
| 88 | // new RNTextInputMaskPackage(ctx), | 88 | // new RNTextInputMaskPackage(ctx), |
| 89 | - // new RNNfcManagerPackage(ctx), | 89 | + new RNNfcManagerPackage(ctx), |
| 90 | // new RNHapticFeedbackPackage(ctx), | 90 | // new RNHapticFeedbackPackage(ctx), |
| 91 | // new RNCustomKeyboardPackage(ctx), | 91 | // new RNCustomKeyboardPackage(ctx), |
| 92 | // new RNIdleTimerPackage(ctx), | 92 | // new RNIdleTimerPackage(ctx), |
| @@ -2,14 +2,14 @@ import { RNAbility } from "@rnoh/react-native-openharmony"; | |||
| 2 | import Want from '@ohos.app.ability.Want'; | 2 | import Want from '@ohos.app.ability.Want'; |
| 3 | // import { RNThemeControlModule } from '@react-native-ohos/react-native-theme-control'; | 3 | // import { RNThemeControlModule } from '@react-native-ohos/react-native-theme-control'; |
| 4 | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; | 4 | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; |
| 5 | -// import { RNNfcManagerModule } from '@react-native-ohos/react-native-nfc-manager'; | 5 | +import { RNNfcManagerModule } from '@react-native-ohos/react-native-nfc-manager'; |
| 6 | // import { AFServiceCenter } from '@alipay/afservicesdk/Index'; | 6 | // import { AFServiceCenter } from '@alipay/afservicesdk/Index'; |
| 7 | 7 | ||
| 8 | export default class EntryAbility extends RNAbility { | 8 | export default class EntryAbility extends RNAbility { |
| 9 | onCreate(want: Want): void { | 9 | onCreate(want: Want): void { |
| 10 | super.onCreate(want); | 10 | super.onCreate(want); |
| 11 | // RNThemeControlModule.recoverApplicationTheme(this.context); | 11 | // RNThemeControlModule.recoverApplicationTheme(this.context); |
| 12 | - // RNNfcManagerModule.registerAbilityEvents(this.context,'onCreate',want); | 12 | + RNNfcManagerModule.registerAbilityEvents(this.context,'onCreate',want); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | onForeground(): void { | 15 | onForeground(): void { |
| @@ -22,7 +22,7 @@ export default class EntryAbility extends RNAbility { | |||
| 22 | 22 | ||
| 23 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 23 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 24 | super.onNewWant(want,launchParam); | 24 | super.onNewWant(want,launchParam); |
| 25 | - // RNNfcManagerModule.registerAbilityEvents(this.context,'onNewWant',want); | 25 | + RNNfcManagerModule.registerAbilityEvents(this.context,'onNewWant',want); |
| 26 | // let r = AFServiceCenter.handleResponse(want); | 26 | // let r = AFServiceCenter.handleResponse(want); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| @@ -32,7 +32,7 @@ export default class EntryAbility extends RNAbility { | |||
| 32 | 32 | ||
| 33 | onDestroy(): void { | 33 | onDestroy(): void { |
| 34 | super.onDestroy(); | 34 | super.onDestroy(); |
| 35 | - // RNNfcManagerModule.unRegisterAbilityEvents(this.context); | 35 | + RNNfcManagerModule.unRegisterAbilityEvents(this.context); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | }; | 38 | }; |
| @@ -28,6 +28,7 @@ | |||
| 28 | "@react-native-ohos/slider": "5.1.2-rc.1", | 28 | "@react-native-ohos/slider": "5.1.2-rc.1", |
| 29 | "@react-native-ohos/react-native-video": "6.13.1-rc.1", | 29 | "@react-native-ohos/react-native-video": "6.13.1-rc.1", |
| 30 | "@react-native-ohos/react-native-image-crop-picker": "0.51.2-rc.1", | 30 | "@react-native-ohos/react-native-image-crop-picker": "0.51.2-rc.1", |
| 31 | + "@react-native-ohos/react-native-nfc-manager": "", | ||
| 31 | "@react-native-ohos/react-native-safe-area-context": "5.6.3-rc.1", | 32 | "@react-native-ohos/react-native-safe-area-context": "5.6.3-rc.1", |
| 32 | "react-native-image-crop-picker": "^0.51.1", | 33 | "react-native-image-crop-picker": "^0.51.1", |
| 33 | "react-native-video": "6.13.0", | 34 | "react-native-video": "6.13.0", |
| @@ -290,6 +290,7 @@ export default function NfcManagerDemo() { | |||
| 290 | 0x00 // Block Number 0 | 290 | 0x00 // Block Number 0 |
| 291 | ]; // change the raw data to be correct. | 291 | ]; // change the raw data to be correct. |
| 292 | byte = await NfcManager.nfcVHandler.transceive(cmdData); | 292 | byte = await NfcManager.nfcVHandler.transceive(cmdData); |
| 293 | + console.log("nfcVTransceive transceive 超时时间 = ", await NfcManager.getTimeout()); | ||
| 293 | } catch (ex) { | 294 | } catch (ex) { |
| 294 | handleException(ex); | 295 | handleException(ex); |
| 295 | } finally { | 296 | } finally { |
| @@ -226,11 +226,11 @@ const Components: Array<RNTesterModuleInfo> = [ | |||
| 226 | // category: 'Basic', | 226 | // category: 'Basic', |
| 227 | // module: require('../examples/react-native-credit-card-input/DemoEntry').default, | 227 | // module: require('../examples/react-native-credit-card-input/DemoEntry').default, |
| 228 | // }, | 228 | // }, |
| 229 | - // { | 229 | + { |
| 230 | - // key: 'ReactNativeNfcManagerExample', | 230 | + key: 'ReactNativeNfcManagerExample', |
| 231 | - // category: 'Basic', | 231 | + category: 'Basic', |
| 232 | - // module: require('../examples/react-native-nfc-manager/NfcManagerDemo') | 232 | + module: require('../examples/react-native-nfc-manager/NfcManagerDemo') |
| 233 | - // }, | 233 | + }, |
| 234 | // { | 234 | // { |
| 235 | // key: 'ReactNativeHapticFeedbackExample', | 235 | // key: 'ReactNativeHapticFeedbackExample', |
| 236 | // category: 'Basic', | 236 | // category: 'Basic', |