mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands
Summary: `codegenNativeCommands` returns an object with functions for each command that has the previous behavior inside the React Renderer, and the new Fabric logic inside of the Fabric React Native Renderer. Changelog: [Internal] - Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands Reviewed By: rickhanlonii Differential Revision: D16529887 fbshipit-source-id: 24a5307944a7f62e18482d60d26052fea3be2051
This commit is contained in:
committed by
Facebook Github Bot
parent
e2f82b122e
commit
e906af18a1
@@ -10,7 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
import * as React from 'react';
|
||||
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
|
||||
import type {
|
||||
WithDefault,
|
||||
@@ -28,6 +30,11 @@ type DrawerSlideEvent = $ReadOnly<{|
|
||||
offset: Float,
|
||||
|}>;
|
||||
|
||||
interface NativeCommands {
|
||||
+openDrawer: (viewRef: React.Ref<'AndroidDrawerLayout'>) => void;
|
||||
+closeDrawer: (viewRef: React.Ref<'AndroidDrawerLayout'>) => void;
|
||||
}
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
/**
|
||||
@@ -106,4 +113,8 @@ type NativeProps = $ReadOnly<{|
|
||||
statusBarBackgroundColor?: ?ColorValue,
|
||||
|}>;
|
||||
|
||||
export const Commands = codegenNativeCommands<NativeCommands>({
|
||||
supportedCommands: ['openDrawer', 'closeDrawer'],
|
||||
});
|
||||
|
||||
export default codegenNativeComponent<NativeProps>('AndroidDrawerLayout');
|
||||
|
||||
Reference in New Issue
Block a user