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 events = { | |
STOP: 'Stopped', | |
PLAY: 'Playing', | |
} | |
class Walkman extends React.Component { | |
state = { | |
current: events.STOP, | |
} | |
transition = (event) => { |
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
type States = 'loading' | 'loaded' | 'error' | |
type Data = any | |
class SomeComponent extends StateComponent<{}, States, Data> { | |
state = 'loading' | |
data = {} | |
} |
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
type States = { | |
mode: 'loading' | 'loaded' | 'error', | |
data: any, | |
} | |
class DataLoader extends React.Component<{}, States> { | |
state = { | |
mode: 'loading', // state | |
data: {}, // data | |
} |
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
None* | |
BLOCK_SELECT -> BlockEditing | |
TOOL_DRAW_BLOCK -> BlockDrawing | |
TOOL_UPLOAD_SHAPES -> UploadingShapes | |
TOOL_RESOURCE_VIEW -> ResourceView | |
BlockDrawing | |
BLOCK_SHAPE_COMPLETE -> BlockEditing | |
CANCEL_DRAWING -> None | |
BlockEditing |
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
Ejected | |
STOP -> Stopped | |
Stopped* | |
STOP -> Ejected | |
PLAY -> Playing | |
REWIND -> Rewinding | |
FAST_FORWARD -> FastForwarding | |
Active | |
STOP -> Stopped | |
PLAY -> Stopped |
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
DrawerOpen* | |
loadTape -> HasTape | |
closeDrawer -> NoTape | |
DrawerClosed | |
eject -> DrawerOpen | |
NoTape | |
HasTape* |
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
DrawerOpen* | |
loadTape -> HasTape | |
closeDrawer -> NoTape | |
DrawerClosed | |
eject -> DrawerOpen | |
NoTape | |
HasTape* |
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' | |
const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1) | |
// lib, returns Context.Provider, Context. | |
function reactXState ({ name, machine, actions }) { | |
name = name || 'defaultName' | |
const Context = React.createContext(name) | |
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 { Permissions } from 'expo' | |
export default async function verifyPushNotificationsPermissions() { | |
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS) | |
let finalStatus = existingStatus | |
// only ask if permissions have not already been determined, because | |
// iOS won't necessarily prompt the user a second time. | |
if (existingStatus !== 'granted') { | |
// Android remote notification permissions are granted during the app |