-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from AndrewGable/tgolen-async-promise
Moving files and folders a little
- Loading branch information
Showing
28 changed files
with
116 additions
and
109 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const webpack = { | ||
presets: [require('@babel/preset-react')], | ||
plugins: [['react-native-web', {commonjs: true}]], | ||
presets: ['@babel/preset-react', '@babel/preset-env'], | ||
plugins: [['react-native-web', {commonjs: true}]], | ||
}; | ||
|
||
const metro = { | ||
presets: [require('metro-react-native-babel-preset')], | ||
plugins: [], | ||
presets: [require('metro-react-native-babel-preset')], | ||
plugins: [], | ||
}; | ||
|
||
module.exports = ({caller}) => { | ||
// For `react-native` (iOS/Android) caller will be "metro" | ||
// For `webpack` (Web) caller will be "@babel-loader" | ||
const runningIn = caller(({name}) => name); | ||
return runningIn === 'metro' ? metro : webpack; | ||
// For `react-native` (iOS/Android) caller will be "metro" | ||
// For `webpack` (Web) caller will be "@babel-loader" | ||
const runningIn = caller(({name}) => name); | ||
return runningIn === 'metro' ? metro : webpack; | ||
}; |
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
This file was deleted.
Oops, something went wrong.
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 generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* This module is an abstraction around a persistent storage system. This file can be modified to use whatever | ||
* persistent storage method is desired. | ||
*/ | ||
import AsyncStorage from '@react-native-community/async-storage'; | ||
|
||
/** | ||
* Get a key from storage | ||
* | ||
* @param {string} key | ||
* @returns {Promise} | ||
*/ | ||
function get(key) { | ||
return AsyncStorage.getItem(key) | ||
.then(val => { | ||
const jsonValue = JSON.parse(val); | ||
return jsonValue; | ||
}) | ||
.catch(err => { | ||
console.error(`Unable to get item from persistent storage. Key: ${key} Error: ${err}`); | ||
}); | ||
}; | ||
|
||
/** | ||
* Write a key to storage | ||
* | ||
* @param {string} key | ||
* @param {mixed} val | ||
* @returns {Promise} | ||
*/ | ||
function set(key, val) { | ||
return AsyncStorage.setItem(key, JSON.stringify(val)); | ||
}; | ||
|
||
/** | ||
* Empty out the storage (like when the user signs out) | ||
* | ||
* @returns {Promise} | ||
*/ | ||
function clear() { | ||
return AsyncStorage.clear(); | ||
}; | ||
|
||
export { | ||
get, | ||
set, | ||
clear, | ||
}; |
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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