From a5b981dae5cd236e647704a2629551f42ed29493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E5=8A=A0=E4=BB=81?= Date: Thu, 19 Sep 2019 17:11:59 +0800 Subject: [PATCH 1/5] feature: add popover support --- .../ScreensExample.xcodeproj/project.pbxproj | 2 ++ Example/nativeStack.js | 31 +++++++++++++++++-- createNativeStackNavigator.js | 19 ++++++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Example/ios/ScreensExample.xcodeproj/project.pbxproj b/Example/ios/ScreensExample.xcodeproj/project.pbxproj index f3aec24c47..09c9f5abda 100644 --- a/Example/ios/ScreensExample.xcodeproj/project.pbxproj +++ b/Example/ios/ScreensExample.xcodeproj/project.pbxproj @@ -975,6 +975,7 @@ "-lc++", ); PRODUCT_NAME = ScreensExample; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -999,6 +1000,7 @@ "-lc++", ); PRODUCT_NAME = ScreensExample; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/Example/nativeStack.js b/Example/nativeStack.js index e5aeb4c8a1..107a11437e 100644 --- a/Example/nativeStack.js +++ b/Example/nativeStack.js @@ -8,6 +8,7 @@ import { Image, Text, ToolbarAndroid, + Platform, } from 'react-native'; import { Screen, @@ -57,13 +58,35 @@ export class Stack extends Component { const active = index === stack.length - 1 || (transitioning !== 0 && index === stack.length - 2); + let stackPresentation = 'transparentModal'; + let popoverConfig = {}; + if (key === 'cyan' && Platform.isPad) { + style = { flex: 1 }; + stackPresentation = 'popover'; + popoverConfig = { + popoverSourceViewNativeID: 'push:pink', + popoverSourceRect: { + x: 10, + y: 10, + width: 44, + height: 44, + }, + popoverPermittedArrowDirections: ['up', 'down'], + preferredContentSize: { + width: 600, + height: 600, + }, + }; + } return ( this.removeByKey(key)}> + stackPresentation={stackPresentation} + onDismissed={() => this.removeByKey(key)} + {...popoverConfig}> {/* {index === 0 && ( @@ -130,7 +153,11 @@ class App extends Component { }} /> {pop &&