From d9cb55c8ae5d5ed252f9a1d01e1eebc7cacd1ea1 Mon Sep 17 00:00:00 2001 From: Benjamin Elo Date: Mon, 12 Aug 2019 05:49:44 -0700 Subject: [PATCH] Migrate SelectPluginSheet from js to tsx Summary: Migrated SelectPluginSheet.js to SelectPluginSheet.tsx Reviewed By: jknoxville Differential Revision: D16733361 fbshipit-source-id: c48e921761f4008a76a5000dd58aa2dd1aa42d2c --- ...ctPluginSheet.js => SelectPluginSheet.tsx} | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) rename src/chrome/{SelectPluginSheet.js => SelectPluginSheet.tsx} (79%) diff --git a/src/chrome/SelectPluginSheet.js b/src/chrome/SelectPluginSheet.tsx similarity index 79% rename from src/chrome/SelectPluginSheet.js rename to src/chrome/SelectPluginSheet.tsx index b8396b69d..30f4559e9 100644 --- a/src/chrome/SelectPluginSheet.js +++ b/src/chrome/SelectPluginSheet.tsx @@ -6,7 +6,6 @@ */ import { - Component, Text, FlexColumn, styled, @@ -17,21 +16,22 @@ import { colors, View, } from 'flipper'; +import React, {Component} from 'react'; export type PluginSelection = Map; -type Props = {| - onSelect: (plugins: Array) => void, - onHide: () => mixed, - plugins: PluginSelection, -|}; +type Props = { + onSelect: (plugins: Array) => void; + onHide: () => any; + plugins: PluginSelection; +}; const Title = styled(Text)({ margin: 6, }); type State = { - plugins: PluginSelection, + plugins: PluginSelection; }; const Container = styled(FlexColumn)({ @@ -64,9 +64,9 @@ const Padder = styled('div')( ); type PluginRowComponentProps = { - name: string, - selected: boolean, - onChange: (name: string, selected: boolean) => void, + name: string; + selected: boolean; + onChange: (name: string, selected: boolean) => void; }; class PluginRowComponent extends Component { @@ -97,7 +97,7 @@ class PluginRowComponent extends Component { } export default class SelectPluginSheet extends Component { - state = {plugins: new Map()}; + state = {plugins: new Map()}; static getDerivedStateFromProps(props: Props, state: State) { if (state.plugins.size > 0) { return null; @@ -128,20 +128,18 @@ export default class SelectPluginSheet extends Component { Select the plugins for which you want to export the data - {Array.from(plugins.entries()).map( - ([pluginID: string, selected: boolean]) => { - return ( - { - plugins.set(id, selected); - this.setState({plugins}); - }} - /> - ); - }, - )} + {Array.from(plugins.entries()).map(([pluginID, selected]) => { + return ( + { + plugins.set(id, selected); + this.setState({plugins}); + }} + /> + ); + })}