Skip to content

Commit

Permalink
IosCompliantAppleAuthButton types: Limit what can get passed for `sty…
Browse files Browse the repository at this point in the history
…le`.

Partly in the spirit of 8b30fa9, but also because this helps us
avoid a mystifying error reported by Flow when we take the upgrade
to Flow v0.122.0, with the React Native v0.63 upgrade (zulip#4245).

I was seeing the error on the use of `ZulipButton` in `AuthScreen`;
it didn't like what I was passing for the `style` prop. When I
temporarily commented out the `style` prop passed to
`IosCompliantAppleAuthButton`, the error disappeared. It doesn't
make a lot of sense to me, but it sounds like
`IosCompliantAppleAuthButton`'s type for its `style` prop was
influencing what type `styles.halfMarginTop` was inferred to have,
when it was passed to `ZulipButton`.
  • Loading branch information
chrisbobbe committed Nov 26, 2020
1 parent d3a26f8 commit 3f53782
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/start/IosCompliantAppleAuthButton/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,7 +16,13 @@ type SelectorProps = $ReadOnly<{|
|}>;

type Props = $ReadOnly<{|
style?: ViewStyleProp,
/* eslint-disable flowtype/generic-spacing */
style?: SubsetProperties<
ViewStyle,
{|
marginTop?: mixed,
|},
>,
onPress: () => void | Promise<void>,

dispatch: Dispatch,
Expand Down

0 comments on commit 3f53782

Please sign in to comment.