From be7b9fca125d8c6f844c4791d5705dca7d20f7ae Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 21:09:34 +0200 Subject: [PATCH 01/11] Replace createReactClass related 21581 --- .../src/androidTest/js/UIManagerTestModule.js | 125 ++++++++++-------- 1 file changed, 67 insertions(+), 58 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 9cfefe8cd78a..c768bb4d0a86 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -18,9 +18,10 @@ var Text = require('Text'); var createReactClass = require('create-react-class'); var renderApplication = require('renderApplication'); -var FlexTestApp = createReactClass({ - displayName: 'FlexTestApp', - _styles: StyleSheet.create({ + +type FlexTestAppProps = $ReadOnly<{||}>; +class FlexTestApp extends React.Component { + _styles = StyleSheet.create({ container: { width: 200, height: 200, @@ -36,29 +37,29 @@ var FlexTestApp = createReactClass({ width: 50, height: 60, }, - }), - render: function() { + }) + render() { return ( ); - }, -}); + } +} -var FlexWithText = createReactClass({ - displayName: 'FlexWithText', - _styles: StyleSheet.create({ +type FlexWithTextProps = $ReadOnly<{||}>; +class FlexWithText extends React.Component { + _styles = StyleSheet.create({ container: { flexDirection: 'column', margin: 20, @@ -72,8 +73,8 @@ var FlexWithText = createReactClass({ flex: 1, margin: 10, }, - }), - render: function() { + }) + render() { return ( ); - }, -}); + } +} -var AbsolutePositionTestApp = createReactClass({ - displayName: 'AbsolutePositionTestApp', - _styles: StyleSheet.create({ +type AbsolutePositionTestAppProps = $ReadOnly<{||}>; +class AbsolutePositionTestApp extends React.Component { + _styles = StyleSheet.create({ absolute: { position: 'absolute', top: 15, @@ -98,8 +99,8 @@ var AbsolutePositionTestApp = createReactClass({ width: 50, height: 60, }, - }), - render: function() { + }) + render() { return ( ); - }, -}); + } +} -var AbsolutePositionBottomRightTestApp = createReactClass({ - displayName: 'AbsolutePositionBottomRightTestApp', - _styles: StyleSheet.create({ +type AbsolutePositionBottomRightTestAppProps = $ReadOnly<{||}>; +class AbsolutePositionBottomRightTestApp extends React.Component { + _styles = StyleSheet.create({ container: { width: 100, height: 100, @@ -124,8 +125,9 @@ var AbsolutePositionBottomRightTestApp = createReactClass({ width: 50, height: 60, }, - }), - render: function() { + }) + + render() { return ( ); - }, -}); + } +} -var CenteredTextView = createReactClass({ - displayName: 'CenteredTextView', - _styles: StyleSheet.create({ +type CenteredTextViewProps = $ReadOnly<{| + text?: ?string, +|}>; +class CenteredTextView extends React.Component { + _styles = StyleSheet.create({ parent: { width: 200, height: 100, @@ -151,8 +155,9 @@ var CenteredTextView = createReactClass({ fontSize: 15, color: '#672831', }, - }), - render: function() { + }) + + render() { return ( @@ -162,25 +167,29 @@ var CenteredTextView = createReactClass({ ); - }, -}); + } +} + +let flushUpdatePositionInList = null; +type UpdatePositionInListTestAppProps = $ReadOnly<{||}>; +type UpdatePositionInListTestAppState = $ReadOnly<{| + active?: ?boolean + |}>; +class UpdatePositionInListTestApp extends React.Component { + state = { active: false } -var flushUpdatePositionInList = null; -var UpdatePositionInListTestApp = createReactClass({ - displayName: 'UpdatePositionInListTestApp', - _styles: StyleSheet.create({ + _styles = StyleSheet.create({ element: { height: 10, }, active: { height: 50, }, - }), - getInitialState: function() { - flushUpdatePositionInList = () => this.setState({active: true}); - return {active: false}; - }, - render: function() { + }) + + flushUpdatePositionInList = () => this.setState({ active: true }); + + render() { return ( @@ -194,29 +203,29 @@ var UpdatePositionInListTestApp = createReactClass({ ); - }, -}); + } +} -var UIManagerTestModule = { - renderFlexTestApplication: function(rootTag) { +const UIManagerTestModule = { + renderFlexTestApplication = rootTag => { renderApplication(FlexTestApp, {}, rootTag); }, - renderFlexWithTextApplication: function(rootTag) { + renderFlexWithTextApplication = rootTag => { renderApplication(FlexWithText, {}, rootTag); }, - renderAbsolutePositionBottomRightTestApplication: function(rootTag) { + renderAbsolutePositionBottomRightTestApplication = rootTag => { renderApplication(AbsolutePositionBottomRightTestApp, {}, rootTag); }, - renderAbsolutePositionTestApplication: function(rootTag) { + renderAbsolutePositionTestApplication = rootTag => { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, - renderCenteredTextViewTestApplication: function(rootTag, text) { - renderApplication(CenteredTextView, {text: text}, rootTag); + renderCenteredTextViewTestApplication = (rootTag, text) => { + renderApplication(CenteredTextView, { text: text }, rootTag); }, - renderUpdatePositionInListTestApplication: function(rootTag) { + renderUpdatePositionInListTestApplication = rootTag => { renderApplication(UpdatePositionInListTestApp, {}, rootTag); }, - flushUpdatePositionInList: function() { + flushUpdatePositionInList = () => { flushUpdatePositionInList(); }, }; From 6993ed78988123090b5a1bcf5c299a5211fa4a7e Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 21:21:02 +0200 Subject: [PATCH 02/11] prettier pass --- .../src/androidTest/js/UIManagerTestModule.js | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index c768bb4d0a86..1849f6f52830 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -18,7 +18,6 @@ var Text = require('Text'); var createReactClass = require('create-react-class'); var renderApplication = require('renderApplication'); - type FlexTestAppProps = $ReadOnly<{||}>; class FlexTestApp extends React.Component { _styles = StyleSheet.create({ @@ -37,7 +36,7 @@ class FlexTestApp extends React.Component { width: 50, height: 60, }, - }) + }); render() { return ( { testID="container" collapsable={false}> @@ -73,7 +72,7 @@ class FlexWithText extends React.Component { flex: 1, margin: 10, }, - }) + }); render() { return ( { } type AbsolutePositionTestAppProps = $ReadOnly<{||}>; -class AbsolutePositionTestApp extends React.Component { +class AbsolutePositionTestApp extends React.Component< + AbsolutePositionTestAppProps, +> { _styles = StyleSheet.create({ absolute: { position: 'absolute', @@ -99,7 +100,7 @@ class AbsolutePositionTestApp extends React.Component; -class AbsolutePositionBottomRightTestApp extends React.Component { +class AbsolutePositionBottomRightTestApp extends React.Component< + AbsolutePositionBottomRightTestAppProps, +> { _styles = StyleSheet.create({ container: { width: 100, @@ -125,7 +128,7 @@ class AbsolutePositionBottomRightTestApp extends React.Component { fontSize: 15, color: '#672831', }, - }) + }); render() { return ( @@ -173,10 +176,13 @@ class CenteredTextView extends React.Component { let flushUpdatePositionInList = null; type UpdatePositionInListTestAppProps = $ReadOnly<{||}>; type UpdatePositionInListTestAppState = $ReadOnly<{| - active?: ?boolean - |}>; -class UpdatePositionInListTestApp extends React.Component { - state = { active: false } + active?: ?boolean, +|}>; +class UpdatePositionInListTestApp extends React.Component< + UpdatePositionInListTestAppProps, + UpdatePositionInListTestAppState, +> { + state = {active: false}; _styles = StyleSheet.create({ element: { @@ -185,9 +191,9 @@ class UpdatePositionInListTestApp extends React.Component this.setState({ active: true }); + flushUpdatePositionInList = () => this.setState({active: true}); render() { return ( @@ -207,25 +213,25 @@ class UpdatePositionInListTestApp extends React.Component { + renderFlexTestApplication(rootTag) { renderApplication(FlexTestApp, {}, rootTag); }, - renderFlexWithTextApplication = rootTag => { + renderFlexWithTextApplication(rootTag) { renderApplication(FlexWithText, {}, rootTag); }, - renderAbsolutePositionBottomRightTestApplication = rootTag => { + renderAbsolutePositionBottomRightTestApplication(rootTag) { renderApplication(AbsolutePositionBottomRightTestApp, {}, rootTag); }, - renderAbsolutePositionTestApplication = rootTag => { + renderAbsolutePositionTestApplication(rootTag) { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, - renderCenteredTextViewTestApplication = (rootTag, text) => { - renderApplication(CenteredTextView, { text: text }, rootTag); + renderCenteredTextViewTestApplication(rootTag, text) { + renderApplication(CenteredTextView, {text: text}, rootTag); }, - renderUpdatePositionInListTestApplication = rootTag => { + renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); }, - flushUpdatePositionInList = () => { + flushUpdatePositionInList() { flushUpdatePositionInList(); }, }; From 9d52d98f8747d53ec386e254b5c1c30d433923da Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 21:49:20 +0200 Subject: [PATCH 03/11] remove inline styles --- .../src/androidTest/js/UIManagerTestModule.js | 213 +++++++++--------- 1 file changed, 112 insertions(+), 101 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 1849f6f52830..acc66ef0df49 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -9,102 +9,94 @@ 'use strict'; -var BatchedBridge = require('BatchedBridge'); -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var View = require('View'); -var Text = require('Text'); +const BatchedBridge = require('BatchedBridge'); +const React = require('React'); +const StyleSheet = require('StyleSheet'); +const View = require('View'); +const Text = require('Text'); -var createReactClass = require('create-react-class'); -var renderApplication = require('renderApplication'); +const renderApplication = require('renderApplication'); type FlexTestAppProps = $ReadOnly<{||}>; class FlexTestApp extends React.Component { - _styles = StyleSheet.create({ - container: { - width: 200, - height: 200, - flexDirection: 'row', - }, - child: { - flex: 1, - }, - absolute: { - position: 'absolute', - top: 15, - left: 10, - width: 50, - height: 60, - }, - }); render() { return ( ); } } +const FlexTestAppStyles = StyleSheet.create({ + container: { + width: 200, + height: 200, + flexDirection: 'row', + }, + child: { + flex: 1, + }, + absolute: { + position: 'absolute', + top: 15, + left: 10, + width: 50, + height: 60, + }, + bgRed: {backgroundColor: '#ff0000'}, + bgBlue: {backgroundColor: '#0000ff'}, +}); type FlexWithTextProps = $ReadOnly<{||}>; class FlexWithText extends React.Component { - _styles = StyleSheet.create({ - container: { - flexDirection: 'column', - margin: 20, - }, - row: { - flexDirection: 'row', - alignItems: 'flex-end', - height: 300, - }, - inner: { - flex: 1, - margin: 10, - }, - }); render() { return ( - - Hello - World + + Hello + World ); } } +const FlexWithTextStyles = StyleSheet.create({ + container: { + flexDirection: 'column', + margin: 20, + }, + row: { + flexDirection: 'row', + alignItems: 'flex-end', + height: 300, + }, + inner: { + flex: 1, + margin: 10, + }, +}); type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, > { - _styles = StyleSheet.create({ - absolute: { - position: 'absolute', - top: 15, - left: 10, - width: 50, - height: 60, - }, - }); render() { return ( @@ -112,59 +104,58 @@ class AbsolutePositionTestApp extends React.Component< } } +AbsolutePositionTestAppStyles = StyleSheet.create({ + absolute: { + position: 'absolute', + top: 15, + left: 10, + width: 50, + height: 60, + }, +}); + type AbsolutePositionBottomRightTestAppProps = $ReadOnly<{||}>; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, > { - _styles = StyleSheet.create({ - container: { - width: 100, - height: 100, - }, - absolute: { - position: 'absolute', - bottom: 15, - right: 10, - width: 50, - height: 60, - }, - }); - render() { return ( - + ); } } +const AbsolutePositionBottomRightTestAppStyles = StyleSheet.create({ + container: { + width: 100, + height: 100, + }, + absolute: { + position: 'absolute', + bottom: 15, + right: 10, + width: 50, + height: 60, + }, +}); + type CenteredTextViewProps = $ReadOnly<{| text?: ?string, |}>; class CenteredTextView extends React.Component { - _styles = StyleSheet.create({ - parent: { - width: 200, - height: 100, - backgroundColor: '#aa3311', - justifyContent: 'center', - alignItems: 'center', - }, - text: { - fontSize: 15, - color: '#672831', - }, - }); - render() { return ( - - + + {this.props.text} @@ -173,6 +164,20 @@ class CenteredTextView extends React.Component { } } +const CenteredTextViewStyles = StyleSheet.create({ + parent: { + width: 200, + height: 100, + backgroundColor: '#aa3311', + justifyContent: 'center', + alignItems: 'center', + }, + text: { + fontSize: 15, + color: '#672831', + }, +}); + let flushUpdatePositionInList = null; type UpdatePositionInListTestAppProps = $ReadOnly<{||}>; type UpdatePositionInListTestAppState = $ReadOnly<{| @@ -184,34 +189,40 @@ class UpdatePositionInListTestApp extends React.Component< > { state = {active: false}; - _styles = StyleSheet.create({ - element: { - height: 10, - }, - active: { - height: 50, - }, - }); - flushUpdatePositionInList = () => this.setState({active: true}); render() { return ( - + - + ); } } +const UpdatePositionInListTestAppStyles = StyleSheet.create({ + element: { + height: 10, + }, + active: { + height: 50, + }, +}); + const UIManagerTestModule = { renderFlexTestApplication(rootTag) { renderApplication(FlexTestApp, {}, rootTag); From b1e741c52b5ab23f3aff90453baa04d5dbacd958 Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 21:54:50 +0200 Subject: [PATCH 04/11] remove inline styles --- .../src/androidTest/js/UIManagerTestModule.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index acc66ef0df49..08e0540ad146 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -53,8 +53,8 @@ const FlexTestAppStyles = StyleSheet.create({ width: 50, height: 60, }, - bgRed: {backgroundColor: '#ff0000'}, - bgBlue: {backgroundColor: '#0000ff'}, + bgRed: { backgroundColor: '#ff0000' }, + bgBlue: { backgroundColor: '#0000ff' }, }); type FlexWithTextProps = $ReadOnly<{||}>; @@ -92,7 +92,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, -> { + > { render() { return ( ; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, -> { + > { render() { return ( { - state = {active: false}; + > { + state = { active: false }; - flushUpdatePositionInList = () => this.setState({active: true}); + flushUpdatePositionInList = () => this.setState({ active: true }); render() { return ( @@ -237,7 +237,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, {text: text}, rootTag); + renderApplication(CenteredTextView, { text: text }, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From 02b58148d9e45ead285519780352b70be6285cf4 Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 22:02:10 +0200 Subject: [PATCH 05/11] eslint --- .../src/androidTest/js/UIManagerTestModule.js | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 08e0540ad146..dd76fc6a6891 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -36,7 +36,8 @@ class FlexTestApp extends React.Component { ); } -} +}; + const FlexTestAppStyles = StyleSheet.create({ container: { width: 200, @@ -53,8 +54,12 @@ const FlexTestAppStyles = StyleSheet.create({ width: 50, height: 60, }, - bgRed: { backgroundColor: '#ff0000' }, - bgBlue: { backgroundColor: '#0000ff' }, + bgRed: { + backgroundColor: '#ff0000', + }, + bgBlue: { + backgroundColor: '#0000ff', + }, }); type FlexWithTextProps = $ReadOnly<{||}>; @@ -72,7 +77,8 @@ class FlexWithText extends React.Component { ); } -} +}; + const FlexWithTextStyles = StyleSheet.create({ container: { flexDirection: 'column', @@ -102,7 +108,7 @@ class AbsolutePositionTestApp extends React.Component< /> ); } -} +}; const AbsolutePositionTestAppStyles = StyleSheet.create({ absolute: { @@ -131,7 +137,7 @@ class AbsolutePositionBottomRightTestApp extends React.Component< ); } -} +}; const AbsolutePositionBottomRightTestAppStyles = StyleSheet.create({ container: { @@ -162,7 +168,7 @@ class CenteredTextView extends React.Component { ); } -} +}; const CenteredTextViewStyles = StyleSheet.create({ parent: { @@ -187,7 +193,9 @@ class UpdatePositionInListTestApp extends React.Component< UpdatePositionInListTestAppProps, UpdatePositionInListTestAppState, > { - state = { active: false }; + state = { + active: false + }; flushUpdatePositionInList = () => this.setState({ active: true }); @@ -212,7 +220,7 @@ class UpdatePositionInListTestApp extends React.Component< ); } -} +}; const UpdatePositionInListTestAppStyles = StyleSheet.create({ element: { From 4c94f066db7e50e194c50d09398670ab16b27d5a Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Wed, 10 Oct 2018 22:06:42 +0200 Subject: [PATCH 06/11] prettier --- .../src/androidTest/js/UIManagerTestModule.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index dd76fc6a6891..5abedb537feb 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -36,7 +36,7 @@ class FlexTestApp extends React.Component { ); } -}; +} const FlexTestAppStyles = StyleSheet.create({ container: { @@ -77,7 +77,7 @@ class FlexWithText extends React.Component { ); } -}; +} const FlexWithTextStyles = StyleSheet.create({ container: { @@ -98,7 +98,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, - > { +> { render() { return ( ); } -}; +} const AbsolutePositionTestAppStyles = StyleSheet.create({ absolute: { @@ -123,7 +123,7 @@ const AbsolutePositionTestAppStyles = StyleSheet.create({ type AbsolutePositionBottomRightTestAppProps = $ReadOnly<{||}>; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, - > { +> { render() { return ( ); } -}; +} const AbsolutePositionBottomRightTestAppStyles = StyleSheet.create({ container: { @@ -168,7 +168,7 @@ class CenteredTextView extends React.Component { ); } -}; +} const CenteredTextViewStyles = StyleSheet.create({ parent: { @@ -192,12 +192,12 @@ type UpdatePositionInListTestAppState = $ReadOnly<{| class UpdatePositionInListTestApp extends React.Component< UpdatePositionInListTestAppProps, UpdatePositionInListTestAppState, - > { +> { state = { - active: false + active: false, }; - flushUpdatePositionInList = () => this.setState({ active: true }); + flushUpdatePositionInList = () => this.setState({active: true}); render() { return ( @@ -220,7 +220,7 @@ class UpdatePositionInListTestApp extends React.Component< ); } -}; +} const UpdatePositionInListTestAppStyles = StyleSheet.create({ element: { @@ -245,7 +245,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, { text: text }, rootTag); + renderApplication(CenteredTextView, {text: text}, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From 6fa91a118df0fb9ed6ad50d0521ea27d2724251b Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Thu, 11 Oct 2018 08:59:04 +0200 Subject: [PATCH 07/11] flow fixes ans add a constructor --- .../src/androidTest/js/UIManagerTestModule.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 5abedb537feb..aeee73c42af1 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -98,7 +98,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, -> { + > { render() { return ( ; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, -> { + > { render() { return ( ; type UpdatePositionInListTestAppState = $ReadOnly<{| - active?: ?boolean, + active: boolean, |}>; class UpdatePositionInListTestApp extends React.Component< UpdatePositionInListTestAppProps, UpdatePositionInListTestAppState, -> { + > { state = { active: false, }; - flushUpdatePositionInList = () => this.setState({active: true}); + constructor(...args) { + super(...args); + flushUpdatePositionInList = () => this.setState({ active: true }); + } render() { return ( @@ -245,7 +247,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, {text: text}, rootTag); + renderApplication(CenteredTextView, { text: text }, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From 3d6d8682a5be4ad179d9d5ff3c34ca4d1dddc283 Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Thu, 11 Oct 2018 08:59:39 +0200 Subject: [PATCH 08/11] flow fixes ans add a constructor --- ReactAndroid/src/androidTest/js/UIManagerTestModule.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index aeee73c42af1..d96cc91437d4 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -98,7 +98,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, - > { +> { render() { return ( ; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, - > { +> { render() { return ( { +> { state = { active: false, }; constructor(...args) { super(...args); - flushUpdatePositionInList = () => this.setState({ active: true }); + flushUpdatePositionInList = () => this.setState({active: true}); } render() { @@ -247,7 +247,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, { text: text }, rootTag); + renderApplication(CenteredTextView, {text: text}, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From a2179040620dfb48c02ff4574543d57e22de025e Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Thu, 11 Oct 2018 15:02:25 +0200 Subject: [PATCH 09/11] unused var --- .../src/androidTest/js/UIManagerTestModule.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index d96cc91437d4..b796ba69b79b 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -98,7 +98,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, -> { + > { render() { return ( ; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, -> { + > { render() { return ( ; type UpdatePositionInListTestAppState = $ReadOnly<{| active: boolean, @@ -191,15 +193,15 @@ type UpdatePositionInListTestAppState = $ReadOnly<{| class UpdatePositionInListTestApp extends React.Component< UpdatePositionInListTestAppProps, UpdatePositionInListTestAppState, -> { + > { state = { active: false, }; constructor(...args) { super(...args); - flushUpdatePositionInList = () => this.setState({active: true}); - } + flushUpdatePositionInList = () => this.setState({ active: true }); + }; render() { return ( @@ -247,7 +249,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, {text: text}, rootTag); + renderApplication(CenteredTextView, { text: text }, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From f6528b227ceaf143247f326d614e17ab9da5d4f7 Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Thu, 11 Oct 2018 15:18:21 +0200 Subject: [PATCH 10/11] unused var --- .../src/androidTest/js/UIManagerTestModule.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index b796ba69b79b..4513842c0707 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -98,7 +98,7 @@ const FlexWithTextStyles = StyleSheet.create({ type AbsolutePositionTestAppProps = $ReadOnly<{||}>; class AbsolutePositionTestApp extends React.Component< AbsolutePositionTestAppProps, - > { +> { render() { return ( ; class AbsolutePositionBottomRightTestApp extends React.Component< AbsolutePositionBottomRightTestAppProps, - > { +> { render() { return ( ; type UpdatePositionInListTestAppState = $ReadOnly<{| @@ -193,15 +193,17 @@ type UpdatePositionInListTestAppState = $ReadOnly<{| class UpdatePositionInListTestApp extends React.Component< UpdatePositionInListTestAppProps, UpdatePositionInListTestAppState, - > { +> { state = { active: false, }; constructor(...args) { super(...args); - flushUpdatePositionInList = () => this.setState({ active: true }); - }; + this.flushUpdatePositionInList(); + } + + flushUpdatePositionInList = () => this.setState({active: true}); render() { return ( @@ -249,7 +251,7 @@ const UIManagerTestModule = { renderApplication(AbsolutePositionTestApp, {}, rootTag); }, renderCenteredTextViewTestApplication(rootTag, text) { - renderApplication(CenteredTextView, { text: text }, rootTag); + renderApplication(CenteredTextView, {text: text}, rootTag); }, renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); From 5afd27603b3cdecf742bfe8f2e8bf4ba59a0b435 Mon Sep 17 00:00:00 2001 From: Ronaldo Lima Date: Thu, 11 Oct 2018 20:07:22 +0200 Subject: [PATCH 11/11] fixed --- ReactAndroid/src/androidTest/js/UIManagerTestModule.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 4513842c0707..ab87084575b1 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -184,7 +184,7 @@ const CenteredTextViewStyles = StyleSheet.create({ }, }); -let flushUpdatePositionInList; +let flushUpdatePositionInList = null; type UpdatePositionInListTestAppProps = $ReadOnly<{||}>; type UpdatePositionInListTestAppState = $ReadOnly<{| @@ -200,11 +200,9 @@ class UpdatePositionInListTestApp extends React.Component< constructor(...args) { super(...args); - this.flushUpdatePositionInList(); + flushUpdatePositionInList = () => this.setState({active: true}); } - flushUpdatePositionInList = () => this.setState({active: true}); - render() { return ( @@ -256,9 +254,7 @@ const UIManagerTestModule = { renderUpdatePositionInListTestApplication(rootTag) { renderApplication(UpdatePositionInListTestApp, {}, rootTag); }, - flushUpdatePositionInList() { - flushUpdatePositionInList(); - }, + flushUpdatePositionInList, }; BatchedBridge.registerCallableModule(