- Change React and React Native version on
package.json
- run
yarn install
to upgrade dependencies - run
yarn outdated
oryarn upgrade-interactive
libraries that are outdated (make sure that there's no breaking changes, check release notes (one by one)) - check the diff or use the upgrade-helper and update the native code
- open Xcode and link the binaries
- run on iOS
- test iOS
- run on Android
- test Android
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
var join = require('path').join; | |
var cp = require('child_process'); | |
/** | |
* Migrate a file to TypeScript. | |
* | |
* @example | |
* // will rename file and try to infer types | |
* yarn ts:migrate ./src/utils.js | |
* |
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 { scan } from '../scan'; | |
import { BleManager, Device } from 'react-native-ble-plx'; | |
import { | |
BleErrorCodeMessage, | |
BleError, | |
} from 'react-native-ble-plx/src/BleError'; | |
let cb: Parameters<BleManager['startDeviceScan']>[2] = null; | |
jest.mock('react-native-ble-plx', () => ({ | |
BleManager: () => ({ | |
startDeviceScan: jest.fn(((_, __, receivedCb) => { |
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 { useState, useEffect } from 'react'; | |
import NetInfo from '@react-native-community/netinfo'; | |
const useInternetReachable = () => { | |
const [isReachable, setIsReachable] = useState(false); | |
const [isLoading, setIsLoading] = useState(true); | |
useEffect(() => { | |
const unsubscribe = NetInfo.addEventListener(({ isInternetReachable }) => { | |
if (typeof isInternetReachable !== 'boolean') return; |
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 { useEffect, useState } from 'react'; | |
import * as Font from 'expo-font'; | |
import { SplashScreen } from 'expo'; | |
/** | |
* Load and use resources that need to be loaded async by Expo SDK | |
*/ | |
const useExpoResources = () => { | |
const [isLoading, setIsLoading] = useState(true); |
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
svgo path/to/file.svg --enable=inlineStyles --config '{ "plugins": [ { "inlineStyles": { "onlyMatchedOnce": false } }] }' --pretty |
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 { useState, useEffect } from 'react'; | |
import _ from 'underscore'; | |
const DEFAULT_DEBOUNCE_TIMEOUT = 1000; | |
/** | |
* Debounce fast changing value. | |
* The debounced value will only reflect the latest value when the hook has not been called for the specified time period. | |
*/ | |
function useDebounce( |
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 pyedflib | |
import numpy as np | |
import sys | |
from shutil import copyfile | |
import datetime | |
# copy input as output | |
copyfile(sys.argv[1], sys.argv[2]) | |
# read input and get number of signals |
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
// num - number you're looking for | |
// pointArr - your array of points | |
// coordIdx - index of the coordinate you're searching for in the point | |
const closestPoint = (num, pointArr, coordIdx) => { | |
let mid; | |
let left = 0; | |
let right = pointArr.length - 1; | |
while (right - left > 1) { | |
mid = Math.floor((left + right) / 2); | |
if (pointArr[mid][coordIdx] < num) { |
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
{ | |
"defaultSeverity": "error", | |
"extends": [ | |
"tslint:recommended" | |
], | |
"jsRules": {}, | |
"rules": { | |
"no-shadowed-variable": false, | |
"interface-over-type-literal": false, | |
"member-access": false, |