mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Annotate React hooks in xplat, defaulting to any
Summary: Add explicit annotations to React hook callbacks as required for Flow's Local Type Inference project. This codemod prepares the codebase to match Flow's new typechecking algorithm. The new algorithm will make Flow more reliable and predictable. This diff adds `any` or `$FlowFixMe` in cases where more precise types could not be determined. Details: - Codemod script: `.facebook/flowd codemod annotate-react-hooks ../../xplat/js --default-any --write` - Local Type Inference announcement: [post](https://fb.workplace.com/groups/flowlang/posts/788206301785035) - Support group: [Flow Support](https://fb.workplace.com/groups/flow) drop-conflicts bypass-lint Reviewed By: SamChou19815 Differential Revision: D41231214 fbshipit-source-id: d5f5ce8d61020baa1138292c9e9f1c69dffd324c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2c7e89d17c
commit
8c2a4d0d26
@@ -10,18 +10,19 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import React, {useRef, useState} from 'react';
|
||||
import type {Node} from 'react';
|
||||
|
||||
import React, {useRef, useState} from 'react';
|
||||
import {
|
||||
Button,
|
||||
DrawerLayoutAndroid,
|
||||
Text,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
const Drawer = () => {
|
||||
const drawer = useRef(null);
|
||||
const drawer = useRef<null | React$ElementRef<any>>(null);
|
||||
const [drawerPosition, setDrawerPosition] = useState('left');
|
||||
const changeDrawerPosition = () => {
|
||||
if (drawerPosition === 'left') {
|
||||
|
||||
Reference in New Issue
Block a user