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
export default class LinearGradient extends React.PureComponent<Props> { | |
render() { | |
// See gist for full implementation | |
// https://bit.ly/2X2yJzL | |
// ... | |
} | |
} |
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
module.exports = { | |
// ... | |
resolve: { | |
// ... | |
alias: { | |
"@datacamp/react-native-linear-gradient": path.resolve( | |
__dirname, | |
"./mocked_modules/react-native-linear-gradient" | |
) | |
} |
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
/* @flow */ | |
// https://github.com/necolas/react-native-web/issues/298#issuecomment-292776647 | |
import { View } from 'react-native' | |
import * as React from 'react' | |
import type { Style } from 'app/types' | |
type Point = {| | |
x: number, | |
y: number, |
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
/* @flow */ | |
import { Platform } from 'react-native' | |
const PLATFORM_PREFERENCES = Object.freeze({ | |
ios: ['ios', 'mobile'], | |
android: ['android', 'mobile'], | |
web: ['web'], | |
}) |
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
// Naive example: results in runtime error if native module not present in native binary | |
import {PushNotificationIOS} from 'react-native' // Same problem if you use require | |
if (PushNotificationIOS) { // Referencing this variable immediately throws a runtime exception | |
alert('We have the library') | |
} | |
// Solution: you can wrap in an exception handler | |
const safePushNotificationIOS = () => { | |
try { |
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
### Keybase proof | |
I hereby claim: | |
* I am jdmunro on github. | |
* I am jdmunro (https://keybase.io/jdmunro) on keybase. | |
* I have a public key ASC8mRg8SLIbrIwkV5OEZ6D6b16VuPTHi_rFUeJEbV8xUgo | |
To claim this, I am signing this object: |
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
export const MY_SCHEDULE = false | |
export const MY_MESSAGES = false | |
export const MY_ACCOUNT = 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
describe('Meal Plan List', () => { | |
it('renders correctly', () => { | |
const week = immutable.Map({ | |
week: 4, | |
year: 2017, | |
}); | |
store.dispatch(importMeals(SAMPLE_MEALS)); | |
store.dispatch(setVisibleWeek(week)); |
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
it('does not repeat meals within the same week if enough meals are available', () => { | |
const mealIds = ['1', '2', '3', '4', '5', '6', '7']; | |
const meals = immutable.fromJS({ | |
[mealIds[0]]: {name: 'Spaghetti'}, | |
[mealIds[1]]: {name: 'Fish and Chips'}, | |
[mealIds[2]]: {name: 'Meat and Potato Pie'}, | |
[mealIds[3]]: {name: 'Lasagne'}, | |
[mealIds[4]]: {name: 'Fish Stew'}, | |
[mealIds[5]]: {name: 'Toad in the Hole'}, | |
[mealIds[6]]: {name: 'Pork Cutlets'}, |