This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react'; | |
import { | |
SafeAreaView, | |
StatusBar, | |
StyleSheet, | |
Text, | |
TouchableOpacity, | |
useColorScheme, | |
useWindowDimensions, | |
View, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RCTDlog.h" | |
@implementation RCTDlog | |
RCT_EXPORT_MODULE(Dlog); | |
- (void)log:(NSString *)message { | |
NSLog(@"%@",message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "CustomModules/CustomModules.h" | |
@interface RCTDlog: NSObject <NativeDlogSpec> | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"codegenConfig": { | |
"libraries": [ | |
{ | |
"name": "CustomModules", | |
"type": "modules", | |
"jsSrcsDir": "src/custom-modules/specs/" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MainApplicationModuleProvider.h" | |
#include <rncore.h> | |
#include <CustomModules.h> // Add this line | |
namespace facebook { | |
namespace react { | |
std::shared_ptr<TurboModule> MainApplicationModuleProvider( | |
const std::string moduleName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
THIS_DIR := $(call my-dir) | |
include $(REACT_ANDROID_DIR)/Android-prebuilt.mk | |
# If you wish to add a custom TurboModule or Fabric component in your app you | |
# will have to include the following autogenerated makefile. | |
include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk | |
include $(CLEAR_VARS) | |
LOCAL_PATH := $(THIS_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.facebook.react.TurboReactPackage; | |
import com.facebook.react.bridge.NativeModule; | |
import com.facebook.react.module.model.ReactModuleInfoProvider; | |
import com.facebook.react.module.model.ReactModuleInfo; | |
import java.util.HashMap; | |
import java.util.Map; | |
import com.rearchdemo.custommodules.Dlog; | |
import androidx.annotation.Nullable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rearchdemo.custommodules; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import android.util.Log; | |
public class Dlog extends NativeDlogSpec { | |
private static final String TAG = "Dlog"; | |
public static final String NAME = "Dlog"; | |
@Override | |
public String getName() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.android.application" | |
// Add the following | |
if (isNewArchitectureEnabled()) { | |
apply plugin: "com.facebook.react" | |
} | |
android { | |
// everything else | |
if (isNewArchitectureEnabled()) { | |
// everything else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type {TurboModule} from 'react-native'; | |
import {TurboModuleRegistry} from 'react-native'; | |
export interface Spec extends TurboModule { | |
log(message: string): void; | |
} | |
export default TurboModuleRegistry.get<Spec>('Dlog'); |
NewerOlder