Skip to content

Instantly share code, notes, and snippets.

@andrepimenta
Created July 11, 2019 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrepimenta/6db692a7c339e5d957ad66146e0788f9 to your computer and use it in GitHub Desktop.
Save andrepimenta/6db692a7c339e5d957ad66146e0788f9 to your computer and use it in GitHub Desktop.
React Native iOS Bridge TEMPLATE
//
// BridgeTemplate.m
// ReactNativeLoadingSpinnerOverlayNative
//
// Created by Andre Pimenta on 11/07/2019.
// Copyright © 2019 Facebook. All rights reserved.
//
#import "React/RCTLog.h"
#import "LoadingOverlay.h" // Here put the name of your module
@implementation LoadingOverlay // Here put the name of your module
// This RCT (React) "macro" exposes the current module to JavaScript
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(toggle:(BOOL *)show
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
dispatch_async(dispatch_get_main_queue(), ^{
@try{
resolve(@{ @"key": [NSNumber numberWithBool:1] });
}
@catch(NSException *exception){
reject(@"get_error",exception.reason, nil);
}
});
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment