From f22a654070ba4218f7532f5e1ea65d77ed403c64 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 25 Nov 2020 20:28:41 -0500 Subject: [PATCH] IosCompliantAppleAuthButton types: Limit what can get passed for `style`. Partly in the spirit of 8b30fa9d6, but also because this helps us avoid lots of mystifying error reports from Flow when we take the upgrade to Flow v0.122.0, with the React Native v0.63 upgrade (#4245). See discussion of those errors [1], and Greg's conclusion that Flow might have been a bit more helpful than it was here. Ah, well. [1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/Flow.20errors.20in.20.23M4318/near/1075420 --- src/start/IosCompliantAppleAuthButton/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/start/IosCompliantAppleAuthButton/index.js b/src/start/IosCompliantAppleAuthButton/index.js index 653028184e3..bd984e4c063 100644 --- a/src/start/IosCompliantAppleAuthButton/index.js +++ b/src/start/IosCompliantAppleAuthButton/index.js @@ -1,10 +1,11 @@ /* @flow strict-local */ import React, { PureComponent } from 'react'; import { View } from 'react-native'; -import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type { ViewStyle } from 'react-native/Libraries/StyleSheet/StyleSheet'; import * as AppleAuthentication from 'expo-apple-authentication'; import { connect } from '../../react-redux'; +import type { SubsetProperties } from '../../generics'; import Custom from './Custom'; import type { ThemeName } from '../../reduxTypes'; import type { Dispatch } from '../../types'; @@ -15,7 +16,15 @@ type SelectorProps = $ReadOnly<{| |}>; type Props = $ReadOnly<{| - style?: ViewStyleProp, + // See `ZulipButton`'s `style` prop, where a comment discusses this + // idea. + /* eslint-disable flowtype/generic-spacing */ + style?: SubsetProperties< + ViewStyle, + {| + marginTop?: mixed, + |}, + >, onPress: () => void | Promise, dispatch: Dispatch,