Skip to content

Instantly share code, notes, and snippets.

@robertjpayne
robertjpayne / RCTSwiftBridgeModule.h
Last active January 17, 2024 11:43
React Native - Swift Native Modules
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
#define RCT_EXTERN_MODULE(objc_name, objc_supername) \
RCT_EXTERN_REMAP_MODULE(objc_name, objc_name, objc_supername)
#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \
objc_name : objc_supername \
@end \
@interface objc_name (RCTExternModule) <RCTBridgeModule> \
// Have some complicated non-React widgets that manipulate DOM?
// Do they manage a list of DOM elements? Here's how to wrap it
// into a React component so you can "constantly rerender" it.
// A dumb non-react widget that manually manage some DOM node that
// represent a list of items
function NonReactWidget(node) {
this.node = node;
}
@kilbot
kilbot / watermelon.d.ts
Created March 2, 2019 04:16
TypeScript declaration file for WatermelonDB
declare module '@nozbe/watermelondb' {
import * as Q from '@nozbe/watermelondb/QueryDescription'
export { default as Collection } from '@nozbe/watermelondb/Collection'
export { default as Database } from '@nozbe/watermelondb/Database'
export { default as CollectionMap } from '@nozbe/watermelondb/Database/CollectionMap'
export { default as Relation } from '@nozbe/watermelondb/Relation'
export { default as Model, associations } from '@nozbe/watermelondb/Model'
export { default as Query } from '@nozbe/watermelondb/Query'
export { tableName, columnName, appSchema, tableSchema } from '@nozbe/watermelondb/Schema'