From c687dd3a77e28b7318514e5ab318be302f0e7643 Mon Sep 17 00:00:00 2001 From: Pieter Vanderwerff Date: Wed, 3 Aug 2022 17:18:33 -0700 Subject: [PATCH] Add missing class annotations xplat/js [android] Reviewed By: SamChou19815 Differential Revision: D38375460 fbshipit-source-id: 265f36635c3bc672ee222b78a852034c1f865bcc --- .../DrawerAndroid/DrawerLayoutAndroid.android.js | 1 + .../js/examples/Text/TextExample.android.js | 13 ++++++++----- .../examples/TextInput/TextInputExample.android.js | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index dd035b56a8aaa2..78fc70dc0bf4bc 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -162,6 +162,7 @@ class DrawerLayoutAndroid extends React.Component { return {Left: 'left', Right: 'right'}; } + // $FlowFixMe[missing-local-annot] _nativeRef = React.createRef< React.ElementRef, diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index 61581d724d9bae..8980335aba1361 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -21,7 +21,7 @@ import TextLegend from '../../components/TextLegend'; const {LayoutAnimation, StyleSheet, Text, View} = require('react-native'); class Entity extends React.Component<{|children: React.Node|}> { - render() { + render(): React.Node { return ( {this.props.children} @@ -30,7 +30,10 @@ class Entity extends React.Component<{|children: React.Node|}> { } } class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { - state = {fontWeight: 'bold', fontSize: 15}; + state: {fontSize: number, fontWeight: 'bold' | 'normal'} = { + fontWeight: 'bold', + fontSize: 15, + }; toggleWeight = () => { this.setState({ @@ -44,7 +47,7 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { }); }; - render() { + render(): React.Node { const curStyle = { fontWeight: this.state.fontWeight, fontSize: this.state.fontSize, @@ -83,7 +86,7 @@ class AdjustingFontSize extends React.Component< AdjustingFontSizeProps, AdjustingFontSizeState, > { - state = { + state: AdjustingFontSizeState = { dynamicText: '', shouldRender: true, }; @@ -119,7 +122,7 @@ class AdjustingFontSize extends React.Component< }); }; - render() { + render(): React.Node { if (!this.state.shouldRender) { return ; } diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js index 48f1e531e15924..bf41299b8d3016 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js @@ -35,7 +35,7 @@ class ToggleDefaultPaddingExample extends React.Component< super(props); this.state = {hasPadding: false}; } - render() { + render(): React.Node { return ( @@ -79,7 +79,7 @@ class AutogrowingTextInputExample extends React.Component<{...}> { }); } - render() { + render(): React.Node { /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ const {style, multiline, ...props} = this.props;