How to use flipper - 10 common examples

To help you get started, we’ve selected a few flipper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / flipper / src / chrome / DevicesButton.tsx View on Github external
type StateFromProps = {
  selectedDevice: BaseDevice | null | undefined;
  androidEmulators: Array;
  devices: Array;
};

type DispatchFromProps = {
  selectDevice: (device: BaseDevice) => void;
  preferDevice: (device: string) => void;
  setActiveSheet: (sheet: ActiveSheet) => void;
};

type OwnProps = {};

type Props = OwnProps & StateFromProps & DispatchFromProps;
const DropdownButton = styled(Button)({
  fontSize: 11,
});

class DevicesButton extends Component {
  launchEmulator = (name: string) => {
    // On Linux, you must run the emulator from the directory it's in because
    // reasons ...
    which('emulator')
      .then(emulatorPath => {
        if (emulatorPath) {
          const child = spawn(emulatorPath, [`@${name}`], {
            detached: true,
            cwd: dirname(emulatorPath),
          });
          child.stderr.on('data', data => {
            console.error(`Android emulator error: ${data}`);
github facebook / flipper / src / chrome / LocationsButton.tsx View on Github external
type OwnProps = {};

type StateFromProps = {
  currentURI: string | undefined;
  selectedDevice: BaseDevice | null | undefined;
};

type DispatchFromProps = {};

type Bookmark = {
  uri: string;
  commonName: string | null;
};

const DropdownButton = styled(Button)({
  fontSize: 11,
});

const shortenText = (text: string, MAX_CHARACTERS = 30): string => {
  if (text.length <= MAX_CHARACTERS) {
    return text;
  } else {
    return (
      text
        .split('')
        .slice(0, MAX_CHARACTERS)
        .join('') + '...'
    );
  }
};
github facebook / flipper / src / plugins / navigation / components / SearchBar.tsx View on Github external
display: 'inline-flex',
  height: '16px',
  alignItems: 'center',
  '': {
    marginLeft: 10,
    '.icon-button': {
      height: 16,
    },
    'img,div': {
      verticalAlign: 'top',
      alignItems: 'none',
    },
  },
});

const ToolbarContainer = styled.div({
  '.drop-shadow': {
    boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)',
  },
});

const SearchInputContainer = styled.div({
  width: '100%',
  marginLeft: 5,
  marginRight: 9,
  position: 'relative',
});

class SearchBar extends Component {
  state = {
    inputFocused: false,
    autoCompleteSheetOpen: false,
github facebook / flipper / src / plugins / navigation / components / IconButton.tsx View on Github external
padding: 5,
  borderRadius: 100,
  backgroundPosition: 'center',
  transition: 'background 0.5s',
  ':hover': {
    background:
      'rgba(155, 155, 155, 0.2) radial-gradient(circle, transparent 1%, rgba(155, 155, 155, 0.2) 1%) center/15000%',
  },
  ':active': {
    backgroundColor: 'rgba(201, 200, 200, 0.5)',
    backgroundSize: '100%',
    transition: 'background 0s',
  },
});

const IconButton = styled.div({
  ':active': {
    animation: `${shrinkAnimation} .25s ease forwards`,
  },
});

export default function(props: Props) {
  return (
github facebook / flipper / src / plugins / sections / Tree.js View on Github external
const Container = styled.div({
  width: '100%',
  height: '100%',
  overflow: 'hidden',
  background:
    'linear-gradient(-90deg,rgba(0,0,0,.02) 1px,transparent 0),linear-gradient(rgba(0,0,0,.02) 1px,transparent 0),linear-gradient(-90deg,rgba(0,0,0,.03) 1px,transparent 0),linear-gradient(rgba(0,0,0,.03) 1px,transparent 0)',
  backgroundSize:
    '10px 10px,10px 10px,100px 100px,100px 100px,100px 100px,100px 100px,100px 100px,100px 100px',
});

const LabelContainer = styled.div({
  display: 'flex',
});

const IconButton = styled.div({
  position: 'relative',
  left: 5,
  top: -8,
  background: colors.white,
});

type TreeData = Array<{
  identifier: string,
  name: string,
  parent: string | '',
  didTriggerStateUpdate?: boolean,
  isReused?: boolean,
  isDirty?: boolean,
  inserted?: boolean,
  removed?: boolean,
  updated?: boolean,
github facebook / flipper / src / plugins / sections / Tree.js View on Github external
paddingRight: 5,
  background: colors.white,
  display: 'inline-block',
});

const Container = styled.div({
  width: '100%',
  height: '100%',
  overflow: 'hidden',
  background:
    'linear-gradient(-90deg,rgba(0,0,0,.02) 1px,transparent 0),linear-gradient(rgba(0,0,0,.02) 1px,transparent 0),linear-gradient(-90deg,rgba(0,0,0,.03) 1px,transparent 0),linear-gradient(rgba(0,0,0,.03) 1px,transparent 0)',
  backgroundSize:
    '10px 10px,10px 10px,100px 100px,100px 100px,100px 100px,100px 100px,100px 100px,100px 100px',
});

const LabelContainer = styled.div({
  display: 'flex',
});

const IconButton = styled.div({
  position: 'relative',
  left: 5,
  top: -8,
  background: colors.white,
});

type TreeData = Array<{
  identifier: string,
  name: string,
  parent: string | '',
  didTriggerStateUpdate?: boolean,
  isReused?: boolean,
github facebook / flipper / src / plugins / network / RequestDetails.tsx View on Github external
return rows.length > 0 ? (
      
    ) : null;
  }
}

const BodyContainer = styled.div({
  paddingTop: 10,
  paddingBottom: 20,
});

type BodyFormatter = {
  formatRequest?: (request: Request) => any;
  formatResponse?: (request: Request, response: Response) => any;
};

class RequestBodyInspector extends Component<{
  request: Request;
  formattedText: boolean;
}> {
  render() {
    const {request, formattedText} = this.props;
    const bodyFormatters = formattedText ? TextBodyFormatters : BodyFormatters;
github facebook / flipper / src / chrome / MainSidebar.tsx View on Github external
function centerInSidebar(component: any) {
  return styled(component)({
    marginTop: '10px',
    marginBottom: '10px',
    marginLeft: 'auto',
    marginRight: 'auto',
  });
}
github facebook / flipper / src / plugins / sandbox / index.tsx View on Github external
value: string;
};

type SandboxState = {
  sandboxes: Array;
  customSandbox: string;
  showFeedback: boolean;
};

const BigButton = styled(Button)({
  flexGrow: 1,
  fontSize: 24,
  padding: 20,
});

const ButtonContainer = styled(FlexColumn)({
  alignItems: 'center',
  padding: 20,
});

export default class SandboxView extends FlipperPlugin<
  SandboxState,
  any,
  unknown
> {
  state: SandboxState = {
    sandboxes: [],
    customSandbox: '',
    showFeedback: false,
  };

  static TextInput = styled.input({
github facebook / flipper / src / chrome / SignInSheet.tsx View on Github external
Button,
  styled,
  Text,
  FlexRow,
  Spacer,
  Input,
  Link,
  colors,
} from 'flipper';
import React, {Component} from 'react';
import {writeKeychain, getUser} from '../fb-stubs/user';
import {login} from '../reducers/user';
import {connect} from 'react-redux';
import {State as Store} from '../reducers';

const Container = styled(FlexColumn)({
  padding: 20,
  width: 500,
});

const Title = styled(Text)({
  marginBottom: 6,
  fontWeight: 600,
});

const InfoText = styled(Text)({
  lineHeight: 1.35,
  marginBottom: 15,
});

const TokenInput = styled(Input)({
  marginRight: 0,

flipper

Mobile development tool

MIT
Latest version published 1 year ago

Package Health Score

41 / 100
Full package analysis

Popular flipper functions