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 MyComponent ({spaceId}) { | |
const [space, loading, error] = useSpace(spaceId); | |
if (loading) return <Loading /> | |
if (error) return <Error /> | |
return <SpaceCard space={space} /> | |
} | |
function useSpace (spaceId) { | |
const dispatch = useDispatch(); |
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
aklsdfjkldsa |
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
// jest.config.js | |
module.exports = { | |
projects: [ | |
'<rootDir>/packages/design-system/jest.config.js' | |
], | |
transform: { | |
'^.+\\.jsx?$': '<rootDir>/jest-babel-transformer' | |
}, | |
moduleFileExtensions: ['js', 'jsx'] | |
} |
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 spaceSchema = makeExecutableSchema({ | |
typeDefs: ` | |
type Space { | |
id: Int! | |
name: String | |
location_id: Int! | |
} | |
type Query { | |
spaceById(id: Int!): Space |
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 withPropsAsStyleOverrides (WrappedComponent) { | |
return ({style, ...props}) => { | |
// make style spreadable | |
style = Array.isArray(style) ? style : [style] | |
// split the incoming properties into a style and forward group | |
const {styleProps, forwardProps} = Object.keys(props).reduce((split, key) => { | |
if (isStyleProp(key)) { | |
split.styleProps[key] = props[key] | |
} else { |
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
public class ImmersiveModeModule extends ReactContextBaseJavaModule { | |
public static final String TAG = "ImmersiveMode"; | |
private Handler uiHandler; | |
private Runnable mRunnable; | |
public ImmersiveModeModule(ReactApplicationContext reactContext) { | |
super(reactContext); | |
uiHandler = new Handler(reactContext.getMainLooper()); |
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
var seed = 0; | |
var callbacks = new Map(); | |
function registerCallback (cb) { | |
if (callbacks.has(cb)) { | |
return callbacks.get(cb) | |
} | |
var id = ++seed; | |
callbacks.set(cb, id) |
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
// creates a reducer that registers, unregisters, and routes component-specific state | |
function createMultiUseReducer (group, reducer) { | |
return (managedStates = {}, action) { | |
// register state for a new component | |
if ( | |
action.type === 'REGISTER_REUSABLE_COMPONENT' && | |
action.group === group | |
) { | |
return { |
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
'use strict'; | |
import * as Reselect from 'reselect'; | |
export function createSelector (...args) { | |
const selector = Reselect.createSelector(...args); | |
var debug = false; | |
var debugLabel = null; | |
function debuggableSelector (...selectorArgs) { |
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
{ | |
If(this.props.person) ( | |
<Text>Hello, {this.props.person.name}</Text> // This still gets unsafely evaluated! | |
) | |
} |
NewerOlder