- Change React and React Native versions in
package.json - Run
yarn installto upgrade dependencies - Run
yarn outdatedoryarn upgrade-interactiveto upgrade outdated libraries. Make sure that there's no breaking changes, check release notes (one by one). - Compare your changes with the diff or use the upgrade-helper and update the native code.
- Open Xcode and link the binaries
- Run iOS
- Test iOS
- Run on Android
- Test Android
This file contains hidden or 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
| /** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ | |
| "use strict"; | |
| /** | |
| * The runtime has a single beforeExit function which is stored in the global | |
| * object with a symbol key. | |
| * The symbol is not exported. | |
| * The process.beforeExit listener is setup in index.js along with all other | |
| * top-level process event listeners. | |
| */ |
This file contains hidden or 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
| // Call this in MainApplication.onCreate(), just after Soloader line. | |
| private static void initialize(Context context) { | |
| if (BuildConfig.DEBUG) { | |
| try { | |
| /* | |
| We use reflection here to pick up the class that initializes Flipper, | |
| since Flipper library is not available in release mode | |
| */ | |
| Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); | |
| aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); |
This file contains hidden or 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
| function adb_connect { | |
| # PORT used to connect. Default: 5555 | |
| PORT=${1:-5555} | |
| # IP address from current device connected | |
| IP_ADDRESS=`adb shell ip route | awk '{print $9}'` | |
| echo "ADB connect to $IP_ADDRESS on port $PORT" | |
| # Change connection from usb to tcpip using $PORT |
This file contains hidden or 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
| /** | |
| * RCTNativeTestModuleSpec.h | |
| * | |
| * NOTE: This file is codegenerated. | |
| */ | |
| #import <vector> | |
| #import <Foundation/Foundation.h> |
This file contains hidden or 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 path = require('path'); | |
| const getWorkspaces = require('get-yarn-workspaces'); | |
| const blacklist = require('metro-config/src/defaults/blacklist'); | |
| const workspaces = getWorkspaces(__dirname); | |
| // Blacklists any react-native that doesn't come from packages/app | |
| const blacklistRE = blacklist([ /(?<!packages\/app\/)node_modules\/react-native\/.*/g]) |
This file contains hidden or 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' | |
| import { View, Text } from 'react-native' | |
| import { withAuthenticator } from 'aws-amplify-react-native' | |
| function App(props) { | |
| function signOut() { | |
| Auth.signOut() | |
| .then(() => { | |
| props.onStateChange('signedOut', null); | |
| }) |
This file contains hidden or 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
| git diff master... --name-only | grep -E '.js$' | xargs ./node_modules/eslint/bin/eslint.js |
This file contains hidden or 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 {useCallback, useEffect, useReducer, useRef} = require('react'); | |
| let effectCapture = null; | |
| exports.useReducerWithEmitEffect = function(reducer, initialArg, init) { | |
| let updateCounter = useRef(0); | |
| let wrappedReducer = useCallback(function(oldWrappedState, action) { | |
| effectCapture = []; | |
| try { | |
| let newState = reducer(oldWrappedState.state, action.action); |
This file contains hidden or 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
| function ProviderComposer({ contexts, children }) { | |
| return contexts.reduceRight( | |
| (kids, parent) => | |
| React.cloneElement(parent, { | |
| children: kids, | |
| }), | |
| children | |
| ); | |
| } |