Skip to content

Commit

Permalink
Final fixes and seal xplat/js/react-native-github
Browse files Browse the repository at this point in the history
Reviewed By: panagosg7

Differential Revision: D16946423

fbshipit-source-id: 89ca82c955e99a23a14984d51f3c97346c363afd
  • Loading branch information
logandaniels authored and facebook-github-bot committed Aug 23, 2019
1 parent 97b42bb commit b6333f7
Show file tree
Hide file tree
Showing 25 changed files with 280 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Expand Up @@ -54,7 +54,7 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

experimental.well_formed_exports=true
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>

[lints]
sketchy-null-number=warn
Expand Down
2 changes: 1 addition & 1 deletion .flowconfig.android
Expand Up @@ -54,7 +54,7 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

experimental.well_formed_exports=true
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>

[lints]
sketchy-null-number=warn
Expand Down
4 changes: 2 additions & 2 deletions Libraries/BugReporting/NativeBugReporting.js
Expand Up @@ -8,13 +8,13 @@
* @flow
*/

import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
import type {TurboModule} from '../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
+startReportAProblemFlow: () => void;
+setExtraData: (extraData: Object, extraFiles: Object) => void;
+setCategoryID: (categoryID: string) => void;
}

export default TurboModuleRegistry.get<Spec>('BugReporting');
export default (TurboModuleRegistry.get<Spec>('BugReporting'): ?Spec);
Expand Up @@ -10,11 +10,11 @@

'use strict';

import NativeAccessibilityInfo from './NativeAccessibilityInfo';

const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter');
const UIManager = require('../../ReactNative/UIManager');

import NativeAccessibilityInfo from './NativeAccessibilityInfo';

const REDUCE_MOTION_EVENT = 'reduceMotionDidChange';
const TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange';

Expand Down Expand Up @@ -90,7 +90,7 @@ const AccessibilityInfo = {
*
* Same as `isScreenReaderEnabled`
*/
get fetch() {
get fetch(): () => Promise<boolean> {
return this.isScreenReaderEnabled;
},

Expand Down
Expand Up @@ -15,9 +15,10 @@ const React = require('react');
const StatusBar = require('../StatusBar/StatusBar');
const StyleSheet = require('../../StyleSheet/StyleSheet');
const View = require('../View/View');
const nullthrows = require('nullthrows');

const dismissKeyboard = require('../../Utilities/dismissKeyboard');
const nullthrows = require('nullthrows');

import AndroidDrawerLayoutNativeComponent, {
Commands,
} from './AndroidDrawerLayoutNativeComponent';
Expand Down Expand Up @@ -163,15 +164,17 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {

return {Left: 'left', Right: 'right'};
}
static defaultProps = {
static defaultProps: {|
drawerBackgroundColor: 'white',
|} = {
drawerBackgroundColor: 'white',
};

_nativeRef = React.createRef<AndroidDrawerLayoutNativeComponent>();

state = {statusBarBackgroundColor: null};
state: State = {statusBarBackgroundColor: null};

render() {
render(): React.Node {
const {
onDrawerStateChanged,
renderNavigationView,
Expand Down
10 changes: 5 additions & 5 deletions Libraries/Components/ToastAndroid/ToastAndroid.android.js
Expand Up @@ -34,12 +34,12 @@ import NativeToastAndroid from './NativeToastAndroid';

const ToastAndroid = {
// Toast duration constants
SHORT: NativeToastAndroid.getConstants().SHORT,
LONG: NativeToastAndroid.getConstants().LONG,
SHORT: (NativeToastAndroid.getConstants().SHORT: number),
LONG: (NativeToastAndroid.getConstants().LONG: number),
// Toast gravity constants
TOP: NativeToastAndroid.getConstants().TOP,
BOTTOM: NativeToastAndroid.getConstants().BOTTOM,
CENTER: NativeToastAndroid.getConstants().CENTER,
TOP: (NativeToastAndroid.getConstants().TOP: number),
BOTTOM: (NativeToastAndroid.getConstants().BOTTOM: number),
CENTER: (NativeToastAndroid.getConstants().CENTER: number),

show: function(message: string, duration: number): void {
NativeToastAndroid.show(message, duration);
Expand Down
Expand Up @@ -11,8 +11,8 @@
'use strict';

const Platform = require('../../Utilities/Platform');
const React = require('react');
const PropTypes = require('prop-types');
const React = require('react');
const Touchable = require('./Touchable');
const TouchableWithoutFeedback = require('./TouchableWithoutFeedback');
const View = require('../View/View');
Expand Down Expand Up @@ -345,4 +345,4 @@ const TouchableNativeFeedback = createReactClass({
},
});

module.exports = TouchableNativeFeedback;
module.exports = (TouchableNativeFeedback: $FlowFixMe);
38 changes: 37 additions & 1 deletion Libraries/Components/View/ReactNativeStyleAttributes.js
Expand Up @@ -18,7 +18,43 @@ const processColor = require('../../StyleSheet/processColor');
const processTransform = require('../../StyleSheet/processTransform');
const sizesDiffer = require('../../Utilities/differ/sizesDiffer');

const ReactNativeStyleAttributes = {};
type ReturnBoolType = <V>(V) => true;
type BoolifiedDeprecatedViewStylePropTypes = $ObjMap<
typeof DeprecatedViewStylePropTypes,
ReturnBoolType,
>;
type BoolifiedDeprecatedTextStylePropTypes = $ObjMapi<
typeof DeprecatedTextStylePropTypes,
ReturnBoolType,
>;
type BoolifiedDeprecatedImageStylePropTypes = $ObjMapi<
typeof DeprecatedImageStylePropTypes,
ReturnBoolType,
>;

type StyleAttributesType = {
...BoolifiedDeprecatedViewStylePropTypes,
...BoolifiedDeprecatedTextStylePropTypes,
...BoolifiedDeprecatedImageStylePropTypes,
transform: $ReadOnly<{|process: typeof processTransform|}> | true,
shadowOffset: $ReadOnly<{|diff: typeof sizesDiffer|}> | true,
backgroundColor: typeof colorAttributes | true,
borderBottomColor: typeof colorAttributes | true,
borderColor: typeof colorAttributes | true,
borderLeftColor: typeof colorAttributes | true,
borderRightColor: typeof colorAttributes | true,
borderTopColor: typeof colorAttributes | true,
borderStartColor: typeof colorAttributes | true,
borderEndColor: typeof colorAttributes | true,
color: typeof colorAttributes | true,
shadowColor: typeof colorAttributes | true,
textDecorationColor: typeof colorAttributes | true,
tintColor: typeof colorAttributes | true,
textShadowColor: typeof colorAttributes | true,
overlayColor: typeof colorAttributes | true,
};

const ReactNativeStyleAttributes: StyleAttributesType = {};

for (const attributeName of Object.keys({
...DeprecatedViewStylePropTypes,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/View/ViewNativeComponent.js
Expand Up @@ -83,7 +83,7 @@ interface NativeCommands {
) => void;
}

export const Commands = codegenNativeCommands<NativeCommands>({
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['hotspotUpdate', 'setPressed'],
});

Expand Down

0 comments on commit b6333f7

Please sign in to comment.