feat: add Windows and macOS support (#8570)

react-native-gesture-handler doesn't have Windows/macOS implementation yet, use the web version as stubs for now to enable navigation features for Windows and mac.

Close https://github.com/microsoft/react-native-windows/issues/3884
Close https://github.com/microsoft/react-native-windows/issues/4044
This commit is contained in:
Kai Guo
2020-07-28 14:51:41 -07:00
committed by GitHub
parent 1e813dfb5b
commit 8468c46cab
17 changed files with 134 additions and 70 deletions

View File

@@ -29,7 +29,10 @@ function StackNavigator({
}: Props) {
const defaultOptions = {
gestureEnabled: Platform.OS === 'ios',
animationEnabled: Platform.OS !== 'web',
animationEnabled:
Platform.OS !== 'web' &&
Platform.OS !== 'windows' &&
Platform.OS !== 'macos',
};
const { state, descriptors, navigation } = useNavigationBuilder<

View File

@@ -0,0 +1,6 @@
export {
PanGestureHandler,
GestureHandlerRootView,
GestureState,
} from './GestureHandlerStub';
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';

View File

@@ -1,24 +1,6 @@
import * as React from 'react';
import { View } from 'react-native';
import type { PanGestureHandlerProperties } from 'react-native-gesture-handler';
const Dummy: any = ({ children }: { children: React.ReactNode }) => (
<>{children}</>
);
export const PanGestureHandler = Dummy as React.ComponentType<
PanGestureHandlerProperties
>;
export const GestureHandlerRootView = View;
export const GestureState = {
UNDETERMINED: 0,
FAILED: 1,
BEGAN: 2,
CANCELLED: 3,
ACTIVE: 4,
END: 5,
};
export {
PanGestureHandler,
GestureHandlerRootView,
GestureState,
} from './GestureHandlerStub';
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';

View File

@@ -0,0 +1,6 @@
export {
PanGestureHandler,
GestureHandlerRootView,
GestureState,
} from './GestureHandlerStub';
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';

View File

@@ -0,0 +1,24 @@
import * as React from 'react';
import { View } from 'react-native';
import type { PanGestureHandlerProperties } from 'react-native-gesture-handler';
const Dummy: any = ({ children }: { children: React.ReactNode }) => (
<>{children}</>
);
export const PanGestureHandler = Dummy as React.ComponentType<
PanGestureHandlerProperties
>;
export const GestureHandlerRootView = View;
export const GestureState = {
UNDETERMINED: 0,
FAILED: 1,
BEGAN: 2,
CANCELLED: 3,
ACTIVE: 4,
END: 5,
};
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';

View File

@@ -0,0 +1 @@
export { default } from './MaskedViewStub';

View File

@@ -1,10 +1 @@
import type * as React from 'react';
type Props = {
maskElement: React.ReactElement;
children: React.ReactElement;
};
export default function MaskedView({ children }: Props) {
return children;
}
export { default } from './MaskedViewStub';

View File

@@ -0,0 +1 @@
export { default } from './MaskedViewStub';

View File

@@ -0,0 +1,10 @@
import type * as React from 'react';
type Props = {
maskElement: React.ReactElement;
children: React.ReactElement;
};
export default function MaskedView({ children }: Props) {
return children;
}

View File

@@ -0,0 +1,3 @@
import { TouchableOpacity } from 'react-native';
export const TouchableItem = (TouchableOpacity as any) as typeof import('./TouchableItem.native').TouchableItem;

View File

@@ -0,0 +1,3 @@
import { TouchableOpacity } from 'react-native';
export const TouchableItem = (TouchableOpacity as any) as typeof import('./TouchableItem.native').TouchableItem;