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
platform :ios, '9.1' | |
abstract_target 'Foo' do | |
# RN related | |
pod 'React', :path => '../node_modules/react-native', :subspecs => [ | |
'Core', | |
'CxxBridge', | |
'RCTAnimation', | |
'RCTBlob', | |
'RCTText', |
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
Show hidden characters
{ | |
"presets": [["@babel/preset-env", { useBuiltIns: "entry" }]] | |
} |
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
const NotifReconciler = new NotificationReconciler(); | |
// add some notification to schedule | |
NotifReconciler.process([ | |
new MyNotification({ date: "01/01/2018", message: "Hello World", id: 1 }), | |
new MyNotification({ date: "01/02/2018", message: "Hello World2", id: 2 }), | |
]); | |
// second notification not needed now |
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
const arraysDiff = (first, second, key) => { | |
const keysInFirst = first.reduce((acc, item) => { | |
const id = item[key]; | |
acc[id] = item; | |
return acc; | |
}, {}); | |
const { common, added } = second.reduce( |
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 from "react"; | |
const linkBlock = "\\[[^\\]]*]\\([^\\)]*\\)"; | |
const linkGrouped = "\\[([^\\]]*)]\\(([^\\)]*)\\)"; | |
const linkRegex = new RegExp(`^${linkGrouped}$`); | |
const variableBlock = "\\{[^\\}]*\\}"; | |
const variableGrouped = "\\{([^\\}]*)\\}"; | |
const variableRegex = new RegExp(`${variableGrouped}`, "g"); |
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
class Immutable { | |
constructor(of) { | |
Object.keys(of).forEach(key => Object.defineProperty(this, key, { enumerable: true, get: () => this.of[key] })); | |
Object.defineProperty(this, "of", { enumerable: false, get: () => of }); | |
} | |
set(key, value) { | |
return new this.constructor({ ...this.of, [key]: value }); | |
} | |
} |
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
const normalizeChatAsync = ({ Messages, Users, ...rest }) => { | |
let messagesIds = []; | |
let usersIds = []; | |
return new Promise((resolve) => { | |
Promise.all( | |
Messages.map( | |
mes => Promise.resolve(mes) | |
.then(mes => mes.id) | |
) |
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
// some-js-file.js | |
export const myFunctionToTestWithRNFS = (fs) => { | |
fs.readDir(...); | |
}; | |
// some-file-when-use-rnfs.js | |
import RNFS from 'react-native-fs'; | |
import { myFunctionToTestWithRNFS } from './some-js-file.js'; | |
myFunctionToTestWithRNFS(RNFS); |
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 <Foundation/Foundation.h> | |
#import <React/RCTBridgeModule.h> | |
#import <React/RCTEventEmitter.h> | |
@interface HeadsetDetector : RCTEventEmitter <RCTBridgeModule> | |
@end |
NewerOlder